def main(client, customer_id, campaign_id, bid_modifier_value):
    campaign_service = client.get_service('CampaignService', version='v1')
    campaign_bm_service = client.get_service('CampaignBidModifierService', version='v1')
    campaign_bid_modifier_operation = client.get_type('CampaignBidModifierOperation')
    campaign_bid_modifier = campaign_bid_modifier_operation.create
    campaign_bid_modifier.campaign.value = campaign_service.campaign_path(customer_id, campaign_id)
    campaign_bid_modifier.bid_modifier.value = bid_modifier_value
    campaign_bid_modifier.interaction_type.type = client.get_type('InteractionTypeEnum', version='v1').CALLS
    try:
        campaign_bm_response = campaign_bm_service.mutate_campaign_bid_modifiers(customer_id, [campaign_bid_modifier_operation])
    except google.ads.google_ads.errors.GoogleAdsException as ex:
        print(('Request with ID "%s" failed with status "%s" and includes the following errors:' % (ex.request_id, ex.error.code().name)))
        for error in ex.failure.errors:
            print(('\tError with message "%s".' % error.message))
            if error.location:
                for field_path_element in error.location.field_path_elements:
                    print(('\t\tOn field: %s' % field_path_element.field_name))
        sys.exit(1)
    print(('Created campaign bid modifier: %s.' % campaign_bm_response.results[0].resource_name))
def main(client, customer_id, campaign_id, bid_modifier_value):
    campaign_service = client.get_service('CampaignService', version='v1')
    campaign_bm_service = client.get_service('CampaignBidModifierService', version='v1')
    campaign_bid_modifier_operation = client.get_type('CampaignBidModifierOperation')
    campaign_bid_modifier = campaign_bid_modifier_operation.create
    campaign_bid_modifier.campaign.value = campaign_service.campaign_path(customer_id, campaign_id)
    campaign_bid_modifier.bid_modifier.value = bid_modifier_value
    campaign_bid_modifier.interaction_type.type = client.get_type('InteractionTypeEnum', version='v1').CALLS
    try:
        campaign_bm_response = campaign_bm_service.mutate_campaign_bid_modifiers(customer_id, [campaign_bid_modifier_operation])
    except google.ads.google_ads.errors.GoogleAdsException as ex:
        print(('Request with ID "%s" failed with status "%s" and includes the following errors:' % (ex.request_id, ex.error.code().name)))
        for error in ex.failure.errors:
            print(('\tError with message "%s".' % error.message))
            if error.location:
                for field_path_element in error.location.field_path_elements:
                    print(('\t\tOn field: %s' % field_path_element.field_name))
        sys.exit(1)
    print(('Created campaign bid modifier: %s.' % campaign_bm_response.results[0].resource_name))