diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index dd98abbd..a934f1e0 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:08e34975760f002746b1d8c86fdc90660be45945ee6d9db914d1508acdf9a547 + digest: sha256:4f9b3b106ad0beafc2c8a415e3f62c1a0cc23cabea115dbe841b848f581cfe99 # created: 2023-10-09T14:06:13.397766266Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 0332d326..16170d0c 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -467,9 +467,9 @@ typing-extensions==4.4.0 \ --hash=sha256:1511434bb92bf8dd198c12b1cc812e800d4181cfcb867674e0f8279cc93087aa \ --hash=sha256:16fa4864408f655d35ec496218b85f79b3437c829e93320c7c9215ccfd92489e # via -r requirements.in -urllib3==1.26.17 \ - --hash=sha256:24d6a242c28d29af46c3fae832c36db3bbebcc533dd1bb549172cd739c82df21 \ - --hash=sha256:94a757d178c9be92ef5539b8840d48dc9cf1b2709c9d6b588232a055c524458b +urllib3==1.26.18 \ + --hash=sha256:34b97092d7e0a3a8cf7cd10e386f401b3737364026c45e622aa02903dffe0f07 \ + --hash=sha256:f8ecc1bba5667413457c529ab955bf8c67b45db799d159066261719e328580a0 # via # requests # twine diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d3535156..788b0fa7 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.21.0" + ".": "0.22.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 0407e87a..c3a80e7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [0.22.0](https://github.com/googleapis/python-analytics-admin/compare/v0.21.0...v0.22.0) (2023-10-19) + + +### Features + +* Add `DataRedactionSettings`, `RollupPropertySourceLink`, `SubpropertyEventFilterCondition`, `SubpropertyEventFilterExpression`, `SubpropertyEventFilterExpressionList`, `SubpropertyEventFilterClause`, `SubpropertyEventFilter` types ([49d0449](https://github.com/googleapis/python-analytics-admin/commit/49d0449e05cceca61fc976b35f542b1c344e4c23)) +* Add `include_all_users`, `expand_groups` fields to `RunAccessReportRequest` ([49d0449](https://github.com/googleapis/python-analytics-admin/commit/49d0449e05cceca61fc976b35f542b1c344e4c23)) +* Add `UpdateDataRedactionSettings`, `CreateRollupProperty`, `GetRollupPropertySourceLink`, `ListRollupPropertySourceLinks`, `CreateRollupPropertySourceLink`, `DeleteRollupPropertySourceLink`, `CreateSubproperty`, `CreateSubpropertyEventFilter`, `CreateSubpropertyEventFilter`, `ListSubpropertyEventFilters`, `UpdateSubpropertyEventFilter`, `DeleteSubpropertyEventFilter` methods to the Admin API v1 alpha ([49d0449](https://github.com/googleapis/python-analytics-admin/commit/49d0449e05cceca61fc976b35f542b1c344e4c23)) +* Add the `data_redaction_settings` field to the `ChangeHistoryResource.resource` oneof field ([49d0449](https://github.com/googleapis/python-analytics-admin/commit/49d0449e05cceca61fc976b35f542b1c344e4c23)) +* Add the `DATA_REDACTION_SETTINGS` option to the `ChangeHistoryResourceType` enum ([49d0449](https://github.com/googleapis/python-analytics-admin/commit/49d0449e05cceca61fc976b35f542b1c344e4c23)) + + +### Bug Fixes + +* Delete BatchDeleteUserLinks, DeleteUserLink, BatchUpdateUserLinks, UpdateUserLink, BatchCreateUserLinks, CreateUserLink, AuditUserLinks, ListUserLinks, BatchGetUserLinks, GetUserLink from the Admin API v1 alpha as per the announcement in https://bit.ly/46yBIDt ([49d0449](https://github.com/googleapis/python-analytics-admin/commit/49d0449e05cceca61fc976b35f542b1c344e4c23)) + ## [0.21.0](https://github.com/googleapis/python-analytics-admin/compare/v0.20.0...v0.21.0) (2023-10-10) diff --git a/docs/admin_v1alpha/services.rst b/docs/admin_v1alpha/services_.rst similarity index 100% rename from docs/admin_v1alpha/services.rst rename to docs/admin_v1alpha/services_.rst diff --git a/docs/admin_v1alpha/types.rst b/docs/admin_v1alpha/types_.rst similarity index 100% rename from docs/admin_v1alpha/types.rst rename to docs/admin_v1alpha/types_.rst diff --git a/docs/admin_v1beta/services.rst b/docs/admin_v1beta/services_.rst similarity index 100% rename from docs/admin_v1beta/services.rst rename to docs/admin_v1beta/services_.rst diff --git a/docs/admin_v1beta/types.rst b/docs/admin_v1beta/types_.rst similarity index 100% rename from docs/admin_v1beta/types.rst rename to docs/admin_v1beta/types_.rst diff --git a/docs/index.rst b/docs/index.rst index 8571dc5d..f787db4a 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -11,16 +11,16 @@ API Reference .. toctree:: :maxdepth: 2 - admin_v1alpha/services - admin_v1alpha/types + admin_v1alpha/services_ + admin_v1alpha/types_ API Reference ------------- .. toctree:: :maxdepth: 2 - admin_v1beta/services - admin_v1beta/types + admin_v1beta/services_ + admin_v1beta/types_ Changelog diff --git a/google/analytics/admin/__init__.py b/google/analytics/admin/__init__.py index af9b57d8..4e71d1ba 100644 --- a/google/analytics/admin/__init__.py +++ b/google/analytics/admin/__init__.py @@ -53,22 +53,13 @@ ArchiveAudienceRequest, ArchiveCustomDimensionRequest, ArchiveCustomMetricRequest, - AuditUserLinksRequest, - AuditUserLinksResponse, BatchCreateAccessBindingsRequest, BatchCreateAccessBindingsResponse, - BatchCreateUserLinksRequest, - BatchCreateUserLinksResponse, BatchDeleteAccessBindingsRequest, - BatchDeleteUserLinksRequest, BatchGetAccessBindingsRequest, BatchGetAccessBindingsResponse, - BatchGetUserLinksRequest, - BatchGetUserLinksResponse, BatchUpdateAccessBindingsRequest, BatchUpdateAccessBindingsResponse, - BatchUpdateUserLinksRequest, - BatchUpdateUserLinksResponse, CancelDisplayVideo360AdvertiserLinkProposalRequest, CreateAccessBindingRequest, CreateAdSenseLinkRequest, @@ -88,9 +79,14 @@ CreateGoogleAdsLinkRequest, CreateMeasurementProtocolSecretRequest, CreatePropertyRequest, + CreateRollupPropertyRequest, + CreateRollupPropertyResponse, + CreateRollupPropertySourceLinkRequest, CreateSearchAds360LinkRequest, CreateSKAdNetworkConversionValueSchemaRequest, - CreateUserLinkRequest, + CreateSubpropertyEventFilterRequest, + CreateSubpropertyRequest, + CreateSubpropertyResponse, DeleteAccessBindingRequest, DeleteAccountRequest, DeleteAdSenseLinkRequest, @@ -106,9 +102,10 @@ DeleteGoogleAdsLinkRequest, DeleteMeasurementProtocolSecretRequest, DeletePropertyRequest, + DeleteRollupPropertySourceLinkRequest, DeleteSearchAds360LinkRequest, DeleteSKAdNetworkConversionValueSchemaRequest, - DeleteUserLinkRequest, + DeleteSubpropertyEventFilterRequest, FetchAutomatedGa4ConfigurationOptOutRequest, FetchAutomatedGa4ConfigurationOptOutResponse, FetchConnectedGa4PropertyRequest, @@ -123,6 +120,7 @@ GetConversionEventRequest, GetCustomDimensionRequest, GetCustomMetricRequest, + GetDataRedactionSettingsRequest, GetDataRetentionSettingsRequest, GetDataSharingSettingsRequest, GetDataStreamRequest, @@ -135,9 +133,10 @@ GetGoogleSignalsSettingsRequest, GetMeasurementProtocolSecretRequest, GetPropertyRequest, + GetRollupPropertySourceLinkRequest, GetSearchAds360LinkRequest, GetSKAdNetworkConversionValueSchemaRequest, - GetUserLinkRequest, + GetSubpropertyEventFilterRequest, ListAccessBindingsRequest, ListAccessBindingsResponse, ListAccountsRequest, @@ -178,12 +177,14 @@ ListMeasurementProtocolSecretsResponse, ListPropertiesRequest, ListPropertiesResponse, + ListRollupPropertySourceLinksRequest, + ListRollupPropertySourceLinksResponse, ListSearchAds360LinksRequest, ListSearchAds360LinksResponse, ListSKAdNetworkConversionValueSchemasRequest, ListSKAdNetworkConversionValueSchemasResponse, - ListUserLinksRequest, - ListUserLinksResponse, + ListSubpropertyEventFiltersRequest, + ListSubpropertyEventFiltersResponse, ProvisionAccountTicketRequest, ProvisionAccountTicketResponse, RunAccessReportRequest, @@ -200,6 +201,7 @@ UpdateConversionEventRequest, UpdateCustomDimensionRequest, UpdateCustomMetricRequest, + UpdateDataRedactionSettingsRequest, UpdateDataRetentionSettingsRequest, UpdateDataStreamRequest, UpdateDisplayVideo360AdvertiserLinkRequest, @@ -212,7 +214,7 @@ UpdatePropertyRequest, UpdateSearchAds360LinkRequest, UpdateSKAdNetworkConversionValueSchemaRequest, - UpdateUserLinkRequest, + UpdateSubpropertyEventFilterRequest, ) from google.analytics.admin_v1alpha.types.audience import ( Audience, @@ -252,7 +254,6 @@ ActorType, AdSenseLink, AttributionSettings, - AuditUserLink, BigQueryLink, ChangeHistoryChange, ChangeHistoryEvent, @@ -263,6 +264,7 @@ ConversionValues, CustomDimension, CustomMetric, + DataRedactionSettings, DataRetentionSettings, DataSharingSettings, DataStream, @@ -285,10 +287,17 @@ Property, PropertySummary, PropertyType, + RollupPropertySourceLink, SearchAds360Link, ServiceLevel, SKAdNetworkConversionValueSchema, - UserLink, +) +from google.analytics.admin_v1alpha.types.subproperty_event_filter import ( + SubpropertyEventFilter, + SubpropertyEventFilterClause, + SubpropertyEventFilterCondition, + SubpropertyEventFilterExpression, + SubpropertyEventFilterExpressionList, ) __all__ = ( @@ -320,22 +329,13 @@ "ArchiveAudienceRequest", "ArchiveCustomDimensionRequest", "ArchiveCustomMetricRequest", - "AuditUserLinksRequest", - "AuditUserLinksResponse", "BatchCreateAccessBindingsRequest", "BatchCreateAccessBindingsResponse", - "BatchCreateUserLinksRequest", - "BatchCreateUserLinksResponse", "BatchDeleteAccessBindingsRequest", - "BatchDeleteUserLinksRequest", "BatchGetAccessBindingsRequest", "BatchGetAccessBindingsResponse", - "BatchGetUserLinksRequest", - "BatchGetUserLinksResponse", "BatchUpdateAccessBindingsRequest", "BatchUpdateAccessBindingsResponse", - "BatchUpdateUserLinksRequest", - "BatchUpdateUserLinksResponse", "CancelDisplayVideo360AdvertiserLinkProposalRequest", "CreateAccessBindingRequest", "CreateAdSenseLinkRequest", @@ -355,9 +355,14 @@ "CreateGoogleAdsLinkRequest", "CreateMeasurementProtocolSecretRequest", "CreatePropertyRequest", + "CreateRollupPropertyRequest", + "CreateRollupPropertyResponse", + "CreateRollupPropertySourceLinkRequest", "CreateSearchAds360LinkRequest", "CreateSKAdNetworkConversionValueSchemaRequest", - "CreateUserLinkRequest", + "CreateSubpropertyEventFilterRequest", + "CreateSubpropertyRequest", + "CreateSubpropertyResponse", "DeleteAccessBindingRequest", "DeleteAccountRequest", "DeleteAdSenseLinkRequest", @@ -373,9 +378,10 @@ "DeleteGoogleAdsLinkRequest", "DeleteMeasurementProtocolSecretRequest", "DeletePropertyRequest", + "DeleteRollupPropertySourceLinkRequest", "DeleteSearchAds360LinkRequest", "DeleteSKAdNetworkConversionValueSchemaRequest", - "DeleteUserLinkRequest", + "DeleteSubpropertyEventFilterRequest", "FetchAutomatedGa4ConfigurationOptOutRequest", "FetchAutomatedGa4ConfigurationOptOutResponse", "FetchConnectedGa4PropertyRequest", @@ -390,6 +396,7 @@ "GetConversionEventRequest", "GetCustomDimensionRequest", "GetCustomMetricRequest", + "GetDataRedactionSettingsRequest", "GetDataRetentionSettingsRequest", "GetDataSharingSettingsRequest", "GetDataStreamRequest", @@ -402,9 +409,10 @@ "GetGoogleSignalsSettingsRequest", "GetMeasurementProtocolSecretRequest", "GetPropertyRequest", + "GetRollupPropertySourceLinkRequest", "GetSearchAds360LinkRequest", "GetSKAdNetworkConversionValueSchemaRequest", - "GetUserLinkRequest", + "GetSubpropertyEventFilterRequest", "ListAccessBindingsRequest", "ListAccessBindingsResponse", "ListAccountsRequest", @@ -445,12 +453,14 @@ "ListMeasurementProtocolSecretsResponse", "ListPropertiesRequest", "ListPropertiesResponse", + "ListRollupPropertySourceLinksRequest", + "ListRollupPropertySourceLinksResponse", "ListSearchAds360LinksRequest", "ListSearchAds360LinksResponse", "ListSKAdNetworkConversionValueSchemasRequest", "ListSKAdNetworkConversionValueSchemasResponse", - "ListUserLinksRequest", - "ListUserLinksResponse", + "ListSubpropertyEventFiltersRequest", + "ListSubpropertyEventFiltersResponse", "ProvisionAccountTicketRequest", "ProvisionAccountTicketResponse", "RunAccessReportRequest", @@ -467,6 +477,7 @@ "UpdateConversionEventRequest", "UpdateCustomDimensionRequest", "UpdateCustomMetricRequest", + "UpdateDataRedactionSettingsRequest", "UpdateDataRetentionSettingsRequest", "UpdateDataStreamRequest", "UpdateDisplayVideo360AdvertiserLinkRequest", @@ -479,7 +490,7 @@ "UpdatePropertyRequest", "UpdateSearchAds360LinkRequest", "UpdateSKAdNetworkConversionValueSchemaRequest", - "UpdateUserLinkRequest", + "UpdateSubpropertyEventFilterRequest", "Audience", "AudienceDimensionOrMetricFilter", "AudienceEventFilter", @@ -507,7 +518,6 @@ "AccountSummary", "AdSenseLink", "AttributionSettings", - "AuditUserLink", "BigQueryLink", "ChangeHistoryChange", "ChangeHistoryEvent", @@ -516,6 +526,7 @@ "ConversionValues", "CustomDimension", "CustomMetric", + "DataRedactionSettings", "DataRetentionSettings", "DataSharingSettings", "DataStream", @@ -532,9 +543,9 @@ "PostbackWindow", "Property", "PropertySummary", + "RollupPropertySourceLink", "SearchAds360Link", "SKAdNetworkConversionValueSchema", - "UserLink", "ActionType", "ActorType", "ChangeHistoryResourceType", @@ -546,4 +557,9 @@ "LinkProposalState", "PropertyType", "ServiceLevel", + "SubpropertyEventFilter", + "SubpropertyEventFilterClause", + "SubpropertyEventFilterCondition", + "SubpropertyEventFilterExpression", + "SubpropertyEventFilterExpressionList", ) diff --git a/google/analytics/admin/gapic_version.py b/google/analytics/admin/gapic_version.py index 2fe35b14..5552ce40 100644 --- a/google/analytics/admin/gapic_version.py +++ b/google/analytics/admin/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.21.0" # {x-release-please-version} +__version__ = "0.22.0" # {x-release-please-version} diff --git a/google/analytics/admin_v1alpha/__init__.py b/google/analytics/admin_v1alpha/__init__.py index 7b23f8a0..fd926254 100644 --- a/google/analytics/admin_v1alpha/__init__.py +++ b/google/analytics/admin_v1alpha/__init__.py @@ -51,22 +51,13 @@ ArchiveAudienceRequest, ArchiveCustomDimensionRequest, ArchiveCustomMetricRequest, - AuditUserLinksRequest, - AuditUserLinksResponse, BatchCreateAccessBindingsRequest, BatchCreateAccessBindingsResponse, - BatchCreateUserLinksRequest, - BatchCreateUserLinksResponse, BatchDeleteAccessBindingsRequest, - BatchDeleteUserLinksRequest, BatchGetAccessBindingsRequest, BatchGetAccessBindingsResponse, - BatchGetUserLinksRequest, - BatchGetUserLinksResponse, BatchUpdateAccessBindingsRequest, BatchUpdateAccessBindingsResponse, - BatchUpdateUserLinksRequest, - BatchUpdateUserLinksResponse, CancelDisplayVideo360AdvertiserLinkProposalRequest, CreateAccessBindingRequest, CreateAdSenseLinkRequest, @@ -86,9 +77,14 @@ CreateGoogleAdsLinkRequest, CreateMeasurementProtocolSecretRequest, CreatePropertyRequest, + CreateRollupPropertyRequest, + CreateRollupPropertyResponse, + CreateRollupPropertySourceLinkRequest, CreateSearchAds360LinkRequest, CreateSKAdNetworkConversionValueSchemaRequest, - CreateUserLinkRequest, + CreateSubpropertyEventFilterRequest, + CreateSubpropertyRequest, + CreateSubpropertyResponse, DeleteAccessBindingRequest, DeleteAccountRequest, DeleteAdSenseLinkRequest, @@ -104,9 +100,10 @@ DeleteGoogleAdsLinkRequest, DeleteMeasurementProtocolSecretRequest, DeletePropertyRequest, + DeleteRollupPropertySourceLinkRequest, DeleteSearchAds360LinkRequest, DeleteSKAdNetworkConversionValueSchemaRequest, - DeleteUserLinkRequest, + DeleteSubpropertyEventFilterRequest, FetchAutomatedGa4ConfigurationOptOutRequest, FetchAutomatedGa4ConfigurationOptOutResponse, FetchConnectedGa4PropertyRequest, @@ -121,6 +118,7 @@ GetConversionEventRequest, GetCustomDimensionRequest, GetCustomMetricRequest, + GetDataRedactionSettingsRequest, GetDataRetentionSettingsRequest, GetDataSharingSettingsRequest, GetDataStreamRequest, @@ -133,9 +131,10 @@ GetGoogleSignalsSettingsRequest, GetMeasurementProtocolSecretRequest, GetPropertyRequest, + GetRollupPropertySourceLinkRequest, GetSearchAds360LinkRequest, GetSKAdNetworkConversionValueSchemaRequest, - GetUserLinkRequest, + GetSubpropertyEventFilterRequest, ListAccessBindingsRequest, ListAccessBindingsResponse, ListAccountsRequest, @@ -176,12 +175,14 @@ ListMeasurementProtocolSecretsResponse, ListPropertiesRequest, ListPropertiesResponse, + ListRollupPropertySourceLinksRequest, + ListRollupPropertySourceLinksResponse, ListSearchAds360LinksRequest, ListSearchAds360LinksResponse, ListSKAdNetworkConversionValueSchemasRequest, ListSKAdNetworkConversionValueSchemasResponse, - ListUserLinksRequest, - ListUserLinksResponse, + ListSubpropertyEventFiltersRequest, + ListSubpropertyEventFiltersResponse, ProvisionAccountTicketRequest, ProvisionAccountTicketResponse, RunAccessReportRequest, @@ -198,6 +199,7 @@ UpdateConversionEventRequest, UpdateCustomDimensionRequest, UpdateCustomMetricRequest, + UpdateDataRedactionSettingsRequest, UpdateDataRetentionSettingsRequest, UpdateDataStreamRequest, UpdateDisplayVideo360AdvertiserLinkRequest, @@ -210,7 +212,7 @@ UpdatePropertyRequest, UpdateSearchAds360LinkRequest, UpdateSKAdNetworkConversionValueSchemaRequest, - UpdateUserLinkRequest, + UpdateSubpropertyEventFilterRequest, ) from .types.audience import ( Audience, @@ -250,7 +252,6 @@ ActorType, AdSenseLink, AttributionSettings, - AuditUserLink, BigQueryLink, ChangeHistoryChange, ChangeHistoryEvent, @@ -261,6 +262,7 @@ ConversionValues, CustomDimension, CustomMetric, + DataRedactionSettings, DataRetentionSettings, DataSharingSettings, DataStream, @@ -283,10 +285,17 @@ Property, PropertySummary, PropertyType, + RollupPropertySourceLink, SearchAds360Link, ServiceLevel, SKAdNetworkConversionValueSchema, - UserLink, +) +from .types.subproperty_event_filter import ( + SubpropertyEventFilter, + SubpropertyEventFilterClause, + SubpropertyEventFilterCondition, + SubpropertyEventFilterExpression, + SubpropertyEventFilterExpressionList, ) __all__ = ( @@ -334,23 +343,13 @@ "AudienceFilterScope", "AudienceSequenceFilter", "AudienceSimpleFilter", - "AuditUserLink", - "AuditUserLinksRequest", - "AuditUserLinksResponse", "BatchCreateAccessBindingsRequest", "BatchCreateAccessBindingsResponse", - "BatchCreateUserLinksRequest", - "BatchCreateUserLinksResponse", "BatchDeleteAccessBindingsRequest", - "BatchDeleteUserLinksRequest", "BatchGetAccessBindingsRequest", "BatchGetAccessBindingsResponse", - "BatchGetUserLinksRequest", - "BatchGetUserLinksResponse", "BatchUpdateAccessBindingsRequest", "BatchUpdateAccessBindingsResponse", - "BatchUpdateUserLinksRequest", - "BatchUpdateUserLinksResponse", "BigQueryLink", "CancelDisplayVideo360AdvertiserLinkProposalRequest", "ChangeHistoryChange", @@ -382,11 +381,17 @@ "CreateGoogleAdsLinkRequest", "CreateMeasurementProtocolSecretRequest", "CreatePropertyRequest", + "CreateRollupPropertyRequest", + "CreateRollupPropertyResponse", + "CreateRollupPropertySourceLinkRequest", "CreateSKAdNetworkConversionValueSchemaRequest", "CreateSearchAds360LinkRequest", - "CreateUserLinkRequest", + "CreateSubpropertyEventFilterRequest", + "CreateSubpropertyRequest", + "CreateSubpropertyResponse", "CustomDimension", "CustomMetric", + "DataRedactionSettings", "DataRetentionSettings", "DataSharingSettings", "DataStream", @@ -405,9 +410,10 @@ "DeleteGoogleAdsLinkRequest", "DeleteMeasurementProtocolSecretRequest", "DeletePropertyRequest", + "DeleteRollupPropertySourceLinkRequest", "DeleteSKAdNetworkConversionValueSchemaRequest", "DeleteSearchAds360LinkRequest", - "DeleteUserLinkRequest", + "DeleteSubpropertyEventFilterRequest", "DisplayVideo360AdvertiserLink", "DisplayVideo360AdvertiserLinkProposal", "EnhancedMeasurementSettings", @@ -432,6 +438,7 @@ "GetConversionEventRequest", "GetCustomDimensionRequest", "GetCustomMetricRequest", + "GetDataRedactionSettingsRequest", "GetDataRetentionSettingsRequest", "GetDataSharingSettingsRequest", "GetDataStreamRequest", @@ -444,9 +451,10 @@ "GetGoogleSignalsSettingsRequest", "GetMeasurementProtocolSecretRequest", "GetPropertyRequest", + "GetRollupPropertySourceLinkRequest", "GetSKAdNetworkConversionValueSchemaRequest", "GetSearchAds360LinkRequest", - "GetUserLinkRequest", + "GetSubpropertyEventFilterRequest", "GlobalSiteTag", "GoogleAdsLink", "GoogleSignalsConsent", @@ -497,12 +505,14 @@ "ListMeasurementProtocolSecretsResponse", "ListPropertiesRequest", "ListPropertiesResponse", + "ListRollupPropertySourceLinksRequest", + "ListRollupPropertySourceLinksResponse", "ListSKAdNetworkConversionValueSchemasRequest", "ListSKAdNetworkConversionValueSchemasResponse", "ListSearchAds360LinksRequest", "ListSearchAds360LinksResponse", - "ListUserLinksRequest", - "ListUserLinksResponse", + "ListSubpropertyEventFiltersRequest", + "ListSubpropertyEventFiltersResponse", "MatchingCondition", "MeasurementProtocolSecret", "NumericValue", @@ -513,6 +523,7 @@ "PropertyType", "ProvisionAccountTicketRequest", "ProvisionAccountTicketResponse", + "RollupPropertySourceLink", "RunAccessReportRequest", "RunAccessReportResponse", "SKAdNetworkConversionValueSchema", @@ -522,6 +533,11 @@ "ServiceLevel", "SetAutomatedGa4ConfigurationOptOutRequest", "SetAutomatedGa4ConfigurationOptOutResponse", + "SubpropertyEventFilter", + "SubpropertyEventFilterClause", + "SubpropertyEventFilterCondition", + "SubpropertyEventFilterExpression", + "SubpropertyEventFilterExpressionList", "UpdateAccessBindingRequest", "UpdateAccountRequest", "UpdateAttributionSettingsRequest", @@ -530,6 +546,7 @@ "UpdateConversionEventRequest", "UpdateCustomDimensionRequest", "UpdateCustomMetricRequest", + "UpdateDataRedactionSettingsRequest", "UpdateDataRetentionSettingsRequest", "UpdateDataStreamRequest", "UpdateDisplayVideo360AdvertiserLinkRequest", @@ -542,6 +559,5 @@ "UpdatePropertyRequest", "UpdateSKAdNetworkConversionValueSchemaRequest", "UpdateSearchAds360LinkRequest", - "UpdateUserLinkRequest", - "UserLink", + "UpdateSubpropertyEventFilterRequest", ) diff --git a/google/analytics/admin_v1alpha/gapic_metadata.json b/google/analytics/admin_v1alpha/gapic_metadata.json index 05bb89ee..abe5b8e2 100644 --- a/google/analytics/admin_v1alpha/gapic_metadata.json +++ b/google/analytics/admin_v1alpha/gapic_metadata.json @@ -35,51 +35,26 @@ "archive_custom_metric" ] }, - "AuditUserLinks": { - "methods": [ - "audit_user_links" - ] - }, "BatchCreateAccessBindings": { "methods": [ "batch_create_access_bindings" ] }, - "BatchCreateUserLinks": { - "methods": [ - "batch_create_user_links" - ] - }, "BatchDeleteAccessBindings": { "methods": [ "batch_delete_access_bindings" ] }, - "BatchDeleteUserLinks": { - "methods": [ - "batch_delete_user_links" - ] - }, "BatchGetAccessBindings": { "methods": [ "batch_get_access_bindings" ] }, - "BatchGetUserLinks": { - "methods": [ - "batch_get_user_links" - ] - }, "BatchUpdateAccessBindings": { "methods": [ "batch_update_access_bindings" ] }, - "BatchUpdateUserLinks": { - "methods": [ - "batch_update_user_links" - ] - }, "CancelDisplayVideo360AdvertiserLinkProposal": { "methods": [ "cancel_display_video360_advertiser_link_proposal" @@ -170,6 +145,16 @@ "create_property" ] }, + "CreateRollupProperty": { + "methods": [ + "create_rollup_property" + ] + }, + "CreateRollupPropertySourceLink": { + "methods": [ + "create_rollup_property_source_link" + ] + }, "CreateSKAdNetworkConversionValueSchema": { "methods": [ "create_sk_ad_network_conversion_value_schema" @@ -180,9 +165,14 @@ "create_search_ads360_link" ] }, - "CreateUserLink": { + "CreateSubproperty": { "methods": [ - "create_user_link" + "create_subproperty" + ] + }, + "CreateSubpropertyEventFilter": { + "methods": [ + "create_subproperty_event_filter" ] }, "DeleteAccessBinding": { @@ -260,6 +250,11 @@ "delete_property" ] }, + "DeleteRollupPropertySourceLink": { + "methods": [ + "delete_rollup_property_source_link" + ] + }, "DeleteSKAdNetworkConversionValueSchema": { "methods": [ "delete_sk_ad_network_conversion_value_schema" @@ -270,9 +265,9 @@ "delete_search_ads360_link" ] }, - "DeleteUserLink": { + "DeleteSubpropertyEventFilter": { "methods": [ - "delete_user_link" + "delete_subproperty_event_filter" ] }, "FetchAutomatedGa4ConfigurationOptOut": { @@ -335,6 +330,11 @@ "get_custom_metric" ] }, + "GetDataRedactionSettings": { + "methods": [ + "get_data_redaction_settings" + ] + }, "GetDataRetentionSettings": { "methods": [ "get_data_retention_settings" @@ -395,6 +395,11 @@ "get_property" ] }, + "GetRollupPropertySourceLink": { + "methods": [ + "get_rollup_property_source_link" + ] + }, "GetSKAdNetworkConversionValueSchema": { "methods": [ "get_sk_ad_network_conversion_value_schema" @@ -405,11 +410,6 @@ "get_search_ads360_link" ] }, - "GetUserLink": { - "methods": [ - "get_user_link" - ] - }, "ListAccessBindings": { "methods": [ "list_access_bindings" @@ -510,6 +510,11 @@ "list_properties" ] }, + "ListRollupPropertySourceLinks": { + "methods": [ + "list_rollup_property_source_links" + ] + }, "ListSKAdNetworkConversionValueSchemas": { "methods": [ "list_sk_ad_network_conversion_value_schemas" @@ -520,11 +525,6 @@ "list_search_ads360_links" ] }, - "ListUserLinks": { - "methods": [ - "list_user_links" - ] - }, "ProvisionAccountTicket": { "methods": [ "provision_account_ticket" @@ -585,6 +585,11 @@ "update_custom_metric" ] }, + "UpdateDataRedactionSettings": { + "methods": [ + "update_data_redaction_settings" + ] + }, "UpdateDataRetentionSettings": { "methods": [ "update_data_retention_settings" @@ -644,11 +649,6 @@ "methods": [ "update_search_ads360_link" ] - }, - "UpdateUserLink": { - "methods": [ - "update_user_link" - ] } } }, @@ -680,51 +680,26 @@ "archive_custom_metric" ] }, - "AuditUserLinks": { - "methods": [ - "audit_user_links" - ] - }, "BatchCreateAccessBindings": { "methods": [ "batch_create_access_bindings" ] }, - "BatchCreateUserLinks": { - "methods": [ - "batch_create_user_links" - ] - }, "BatchDeleteAccessBindings": { "methods": [ "batch_delete_access_bindings" ] }, - "BatchDeleteUserLinks": { - "methods": [ - "batch_delete_user_links" - ] - }, "BatchGetAccessBindings": { "methods": [ "batch_get_access_bindings" ] }, - "BatchGetUserLinks": { - "methods": [ - "batch_get_user_links" - ] - }, "BatchUpdateAccessBindings": { "methods": [ "batch_update_access_bindings" ] }, - "BatchUpdateUserLinks": { - "methods": [ - "batch_update_user_links" - ] - }, "CancelDisplayVideo360AdvertiserLinkProposal": { "methods": [ "cancel_display_video360_advertiser_link_proposal" @@ -815,6 +790,16 @@ "create_property" ] }, + "CreateRollupProperty": { + "methods": [ + "create_rollup_property" + ] + }, + "CreateRollupPropertySourceLink": { + "methods": [ + "create_rollup_property_source_link" + ] + }, "CreateSKAdNetworkConversionValueSchema": { "methods": [ "create_sk_ad_network_conversion_value_schema" @@ -825,9 +810,14 @@ "create_search_ads360_link" ] }, - "CreateUserLink": { + "CreateSubproperty": { + "methods": [ + "create_subproperty" + ] + }, + "CreateSubpropertyEventFilter": { "methods": [ - "create_user_link" + "create_subproperty_event_filter" ] }, "DeleteAccessBinding": { @@ -905,6 +895,11 @@ "delete_property" ] }, + "DeleteRollupPropertySourceLink": { + "methods": [ + "delete_rollup_property_source_link" + ] + }, "DeleteSKAdNetworkConversionValueSchema": { "methods": [ "delete_sk_ad_network_conversion_value_schema" @@ -915,9 +910,9 @@ "delete_search_ads360_link" ] }, - "DeleteUserLink": { + "DeleteSubpropertyEventFilter": { "methods": [ - "delete_user_link" + "delete_subproperty_event_filter" ] }, "FetchAutomatedGa4ConfigurationOptOut": { @@ -980,6 +975,11 @@ "get_custom_metric" ] }, + "GetDataRedactionSettings": { + "methods": [ + "get_data_redaction_settings" + ] + }, "GetDataRetentionSettings": { "methods": [ "get_data_retention_settings" @@ -1040,6 +1040,11 @@ "get_property" ] }, + "GetRollupPropertySourceLink": { + "methods": [ + "get_rollup_property_source_link" + ] + }, "GetSKAdNetworkConversionValueSchema": { "methods": [ "get_sk_ad_network_conversion_value_schema" @@ -1050,11 +1055,6 @@ "get_search_ads360_link" ] }, - "GetUserLink": { - "methods": [ - "get_user_link" - ] - }, "ListAccessBindings": { "methods": [ "list_access_bindings" @@ -1155,6 +1155,11 @@ "list_properties" ] }, + "ListRollupPropertySourceLinks": { + "methods": [ + "list_rollup_property_source_links" + ] + }, "ListSKAdNetworkConversionValueSchemas": { "methods": [ "list_sk_ad_network_conversion_value_schemas" @@ -1165,11 +1170,6 @@ "list_search_ads360_links" ] }, - "ListUserLinks": { - "methods": [ - "list_user_links" - ] - }, "ProvisionAccountTicket": { "methods": [ "provision_account_ticket" @@ -1230,6 +1230,11 @@ "update_custom_metric" ] }, + "UpdateDataRedactionSettings": { + "methods": [ + "update_data_redaction_settings" + ] + }, "UpdateDataRetentionSettings": { "methods": [ "update_data_retention_settings" @@ -1289,11 +1294,6 @@ "methods": [ "update_search_ads360_link" ] - }, - "UpdateUserLink": { - "methods": [ - "update_user_link" - ] } } }, @@ -1325,51 +1325,26 @@ "archive_custom_metric" ] }, - "AuditUserLinks": { - "methods": [ - "audit_user_links" - ] - }, "BatchCreateAccessBindings": { "methods": [ "batch_create_access_bindings" ] }, - "BatchCreateUserLinks": { - "methods": [ - "batch_create_user_links" - ] - }, "BatchDeleteAccessBindings": { "methods": [ "batch_delete_access_bindings" ] }, - "BatchDeleteUserLinks": { - "methods": [ - "batch_delete_user_links" - ] - }, "BatchGetAccessBindings": { "methods": [ "batch_get_access_bindings" ] }, - "BatchGetUserLinks": { - "methods": [ - "batch_get_user_links" - ] - }, "BatchUpdateAccessBindings": { "methods": [ "batch_update_access_bindings" ] }, - "BatchUpdateUserLinks": { - "methods": [ - "batch_update_user_links" - ] - }, "CancelDisplayVideo360AdvertiserLinkProposal": { "methods": [ "cancel_display_video360_advertiser_link_proposal" @@ -1460,6 +1435,16 @@ "create_property" ] }, + "CreateRollupProperty": { + "methods": [ + "create_rollup_property" + ] + }, + "CreateRollupPropertySourceLink": { + "methods": [ + "create_rollup_property_source_link" + ] + }, "CreateSKAdNetworkConversionValueSchema": { "methods": [ "create_sk_ad_network_conversion_value_schema" @@ -1470,9 +1455,14 @@ "create_search_ads360_link" ] }, - "CreateUserLink": { + "CreateSubproperty": { "methods": [ - "create_user_link" + "create_subproperty" + ] + }, + "CreateSubpropertyEventFilter": { + "methods": [ + "create_subproperty_event_filter" ] }, "DeleteAccessBinding": { @@ -1550,6 +1540,11 @@ "delete_property" ] }, + "DeleteRollupPropertySourceLink": { + "methods": [ + "delete_rollup_property_source_link" + ] + }, "DeleteSKAdNetworkConversionValueSchema": { "methods": [ "delete_sk_ad_network_conversion_value_schema" @@ -1560,9 +1555,9 @@ "delete_search_ads360_link" ] }, - "DeleteUserLink": { + "DeleteSubpropertyEventFilter": { "methods": [ - "delete_user_link" + "delete_subproperty_event_filter" ] }, "FetchAutomatedGa4ConfigurationOptOut": { @@ -1625,6 +1620,11 @@ "get_custom_metric" ] }, + "GetDataRedactionSettings": { + "methods": [ + "get_data_redaction_settings" + ] + }, "GetDataRetentionSettings": { "methods": [ "get_data_retention_settings" @@ -1685,6 +1685,11 @@ "get_property" ] }, + "GetRollupPropertySourceLink": { + "methods": [ + "get_rollup_property_source_link" + ] + }, "GetSKAdNetworkConversionValueSchema": { "methods": [ "get_sk_ad_network_conversion_value_schema" @@ -1695,11 +1700,6 @@ "get_search_ads360_link" ] }, - "GetUserLink": { - "methods": [ - "get_user_link" - ] - }, "ListAccessBindings": { "methods": [ "list_access_bindings" @@ -1800,6 +1800,11 @@ "list_properties" ] }, + "ListRollupPropertySourceLinks": { + "methods": [ + "list_rollup_property_source_links" + ] + }, "ListSKAdNetworkConversionValueSchemas": { "methods": [ "list_sk_ad_network_conversion_value_schemas" @@ -1810,11 +1815,6 @@ "list_search_ads360_links" ] }, - "ListUserLinks": { - "methods": [ - "list_user_links" - ] - }, "ProvisionAccountTicket": { "methods": [ "provision_account_ticket" @@ -1875,6 +1875,11 @@ "update_custom_metric" ] }, + "UpdateDataRedactionSettings": { + "methods": [ + "update_data_redaction_settings" + ] + }, "UpdateDataRetentionSettings": { "methods": [ "update_data_retention_settings" @@ -1934,11 +1939,6 @@ "methods": [ "update_search_ads360_link" ] - }, - "UpdateUserLink": { - "methods": [ - "update_user_link" - ] } } } diff --git a/google/analytics/admin_v1alpha/gapic_version.py b/google/analytics/admin_v1alpha/gapic_version.py index 2fe35b14..5552ce40 100644 --- a/google/analytics/admin_v1alpha/gapic_version.py +++ b/google/analytics/admin_v1alpha/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.21.0" # {x-release-please-version} +__version__ = "0.22.0" # {x-release-please-version} diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py index a19d1c4b..5684739e 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py @@ -51,6 +51,9 @@ from google.analytics.admin_v1alpha.types import ( expanded_data_set as gaa_expanded_data_set, ) +from google.analytics.admin_v1alpha.types import ( + subproperty_event_filter as gaa_subproperty_event_filter, +) from google.analytics.admin_v1alpha.types import access_report, analytics_admin from google.analytics.admin_v1alpha.types import audience from google.analytics.admin_v1alpha.types import audience as gaa_audience @@ -58,6 +61,7 @@ from google.analytics.admin_v1alpha.types import event_create_and_edit from google.analytics.admin_v1alpha.types import expanded_data_set from google.analytics.admin_v1alpha.types import resources +from google.analytics.admin_v1alpha.types import subproperty_event_filter from .client import AnalyticsAdminServiceClient from .transports.base import DEFAULT_CLIENT_INFO, AnalyticsAdminServiceTransport @@ -120,6 +124,12 @@ class AnalyticsAdminServiceAsyncClient: parse_custom_metric_path = staticmethod( AnalyticsAdminServiceClient.parse_custom_metric_path ) + data_redaction_settings_path = staticmethod( + AnalyticsAdminServiceClient.data_redaction_settings_path + ) + parse_data_redaction_settings_path = staticmethod( + AnalyticsAdminServiceClient.parse_data_redaction_settings_path + ) data_retention_settings_path = staticmethod( AnalyticsAdminServiceClient.data_retention_settings_path ) @@ -196,6 +206,12 @@ class AnalyticsAdminServiceAsyncClient: ) property_path = staticmethod(AnalyticsAdminServiceClient.property_path) parse_property_path = staticmethod(AnalyticsAdminServiceClient.parse_property_path) + rollup_property_source_link_path = staticmethod( + AnalyticsAdminServiceClient.rollup_property_source_link_path + ) + parse_rollup_property_source_link_path = staticmethod( + AnalyticsAdminServiceClient.parse_rollup_property_source_link_path + ) search_ads360_link_path = staticmethod( AnalyticsAdminServiceClient.search_ads360_link_path ) @@ -208,9 +224,11 @@ class AnalyticsAdminServiceAsyncClient: parse_sk_ad_network_conversion_value_schema_path = staticmethod( AnalyticsAdminServiceClient.parse_sk_ad_network_conversion_value_schema_path ) - user_link_path = staticmethod(AnalyticsAdminServiceClient.user_link_path) - parse_user_link_path = staticmethod( - AnalyticsAdminServiceClient.parse_user_link_path + subproperty_event_filter_path = staticmethod( + AnalyticsAdminServiceClient.subproperty_event_filter_path + ) + parse_subproperty_event_filter_path = staticmethod( + AnalyticsAdminServiceClient.parse_subproperty_event_filter_path ) common_billing_account_path = staticmethod( AnalyticsAdminServiceClient.common_billing_account_path @@ -380,32 +398,6 @@ async def get_account( ) -> resources.Account: r"""Lookup for a single Account. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_account(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAccountRequest( - name="name_value", - ) - - # Make the request - response = await client.get_account(request=request) - - # Handle the response - print(response) - Args: request (Optional[Union[google.analytics.admin_v1alpha.types.GetAccountRequest, dict]]): The request object. Request message for GetAccount RPC. @@ -486,32 +478,6 @@ async def list_accounts( excluded by default. Returns an empty list if no relevant accounts are found. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_accounts(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAccountsRequest( - ) - - # Make the request - page_result = client.list_accounts(request=request) - - # Handle the response - async for response in page_result: - print(response) - Args: request (Optional[Union[google.analytics.admin_v1alpha.types.ListAccountsRequest, dict]]): The request object. Request message for ListAccounts RPC. @@ -578,35 +544,12 @@ async def delete_account( If the accounts are not restored before the expiration time, the account and all child resources (eg: - Properties, GoogleAdsLinks, Streams, UserLinks) will be - permanently purged. + Properties, GoogleAdsLinks, Streams, AccessBindings) + will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_account(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteAccountRequest( - name="name_value", - ) - - # Make the request - await client.delete_account(request=request) - Args: request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteAccountRequest, dict]]): The request object. Request message for DeleteAccount @@ -676,35 +619,6 @@ async def update_account( ) -> resources.Account: r"""Updates an account. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_account(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - account = admin_v1alpha.Account() - account.display_name = "display_name_value" - - request = admin_v1alpha.UpdateAccountRequest( - account=account, - ) - - # Make the request - response = await client.update_account(request=request) - - # Handle the response - print(response) - Args: request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateAccountRequest, dict]]): The request object. Request message for UpdateAccount @@ -796,31 +710,6 @@ async def provision_account_ticket( ) -> analytics_admin.ProvisionAccountTicketResponse: r"""Requests a ticket for creating an account. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_provision_account_ticket(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ProvisionAccountTicketRequest( - ) - - # Make the request - response = await client.provision_account_ticket(request=request) - - # Handle the response - print(response) - Args: request (Optional[Union[google.analytics.admin_v1alpha.types.ProvisionAccountTicketRequest, dict]]): The request object. Request message for @@ -872,32 +761,6 @@ async def list_account_summaries( r"""Returns summaries of all accounts accessible by the caller. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_account_summaries(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAccountSummariesRequest( - ) - - # Make the request - page_result = client.list_account_summaries(request=request) - - # Handle the response - async for response in page_result: - print(response) - Args: request (Optional[Union[google.analytics.admin_v1alpha.types.ListAccountSummariesRequest, dict]]): The request object. Request message for @@ -959,32 +822,6 @@ async def get_property( ) -> resources.Property: r"""Lookup for a single "GA4" Property. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetPropertyRequest( - name="name_value", - ) - - # Make the request - response = await client.get_property(request=request) - - # Handle the response - print(response) - Args: request (Optional[Union[google.analytics.admin_v1alpha.types.GetPropertyRequest, dict]]): The request object. Request message for GetProperty RPC. @@ -1065,33 +902,6 @@ async def list_properties( excluded by default. Returns an empty list if no relevant properties are found. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_properties(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListPropertiesRequest( - filter="filter_value", - ) - - # Make the request - page_result = client.list_properties(request=request) - - # Handle the response - async for response in page_result: - print(response) - Args: request (Optional[Union[google.analytics.admin_v1alpha.types.ListPropertiesRequest, dict]]): The request object. Request message for ListProperties @@ -1154,36 +964,6 @@ async def create_property( r"""Creates an "GA4" property with the specified location and attributes. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - property = admin_v1alpha.Property() - property.display_name = "display_name_value" - property.time_zone = "time_zone_value" - - request = admin_v1alpha.CreatePropertyRequest( - property=property, - ) - - # Make the request - response = await client.create_property(request=request) - - # Handle the response - print(response) - Args: request (Optional[Union[google.analytics.admin_v1alpha.types.CreatePropertyRequest, dict]]): The request object. Request message for CreateProperty @@ -1261,39 +1041,13 @@ async def delete_property( If the properties are not restored before the expiration time, the Property and all child resources (eg: - GoogleAdsLinks, Streams, UserLinks) will be permanently - purged. + GoogleAdsLinks, Streams, AccessBindings) will be + permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found, or is not a GA4 Property. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeletePropertyRequest( - name="name_value", - ) - - # Make the request - response = await client.delete_property(request=request) - - # Handle the response - print(response) - Args: request (Optional[Union[google.analytics.admin_v1alpha.types.DeletePropertyRequest, dict]]): The request object. Request message for DeleteProperty @@ -1372,36 +1126,6 @@ async def update_property( ) -> resources.Property: r"""Updates a property. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - property = admin_v1alpha.Property() - property.display_name = "display_name_value" - property.time_zone = "time_zone_value" - - request = admin_v1alpha.UpdatePropertyRequest( - property=property, - ) - - # Make the request - response = await client.update_property(request=request) - - # Handle the response - print(response) - Args: request (Optional[Union[google.analytics.admin_v1alpha.types.UpdatePropertyRequest, dict]]): The request object. Request message for UpdateProperty @@ -1482,52 +1206,38 @@ async def sample_update_property(): # Done; return the response. return response - async def get_user_link( + async def create_firebase_link( self, - request: Optional[Union[analytics_admin.GetUserLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.CreateFirebaseLinkRequest, dict] + ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, + firebase_link: Optional[resources.FirebaseLink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.UserLink: - r"""Gets information about a user's link to an account or - property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetUserLinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_user_link(request=request) + ) -> resources.FirebaseLink: + r"""Creates a FirebaseLink. - # Handle the response - print(response) + Properties can have at most one FirebaseLink. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetUserLinkRequest, dict]]): - The request object. Request message for GetUserLink RPC. - name (:class:`str`): - Required. Example format: - accounts/1234/userLinks/5678 + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateFirebaseLinkRequest, dict]]): + The request object. Request message for + CreateFirebaseLink RPC + parent (:class:`str`): + Required. Format: properties/{property_id} Example: + properties/1234 - This corresponds to the ``name`` field + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firebase_link (:class:`google.analytics.admin_v1alpha.types.FirebaseLink`): + Required. The Firebase link to + create. + + This corresponds to the ``firebase_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, @@ -1537,33 +1247,34 @@ async def sample_get_user_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.UserLink: - A resource message representing a - user's permissions on an Account or - Property resource. + google.analytics.admin_v1alpha.types.FirebaseLink: + A link between a GA4 property and a + Firebase project. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent, firebase_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetUserLinkRequest(request) + request = analytics_admin.CreateFirebaseLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent + if firebase_link is not None: + request.firebase_link = firebase_link # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_user_link, + self._client._transport.create_firebase_link, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) @@ -1571,7 +1282,7 @@ async def sample_get_user_link(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -1585,67 +1296,58 @@ async def sample_get_user_link(): # Done; return the response. return response - async def batch_get_user_links( + async def delete_firebase_link( self, - request: Optional[Union[analytics_admin.BatchGetUserLinksRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.DeleteFirebaseLinkRequest, dict] + ] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchGetUserLinksResponse: - r"""Gets information about multiple users' links to an - account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_batch_get_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.BatchGetUserLinksRequest( - parent="parent_value", - names=['names_value1', 'names_value2'], - ) - - # Make the request - response = await client.batch_get_user_links(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a FirebaseLink on a property Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.BatchGetUserLinksRequest, dict]]): - The request object. Request message for BatchGetUserLinks - RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteFirebaseLinkRequest, dict]]): + The request object. Request message for + DeleteFirebaseLink RPC + name (:class:`str`): + Required. Format: + properties/{property_id}/firebaseLinks/{firebase_link_id} + Example: properties/1234/firebaseLinks/5678 + + This corresponds to the ``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.analytics.admin_v1alpha.types.BatchGetUserLinksResponse: - Response message for - BatchGetUserLinks RPC. - """ # Create or coerce a protobuf request object. - request = analytics_admin.BatchGetUserLinksRequest(request) + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.DeleteFirebaseLinkRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.batch_get_user_links, + self._client._transport.delete_firebase_link, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) @@ -1653,65 +1355,36 @@ async def sample_batch_get_user_links(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - async def list_user_links( + async def list_firebase_links( self, - request: Optional[Union[analytics_admin.ListUserLinksRequest, dict]] = None, + request: Optional[Union[analytics_admin.ListFirebaseLinksRequest, dict]] = None, *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListUserLinksAsyncPager: - r"""Lists all user links on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListUserLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_user_links(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> pagers.ListFirebaseLinksAsyncPager: + r"""Lists FirebaseLinks on a property. + Properties can have at most one FirebaseLink. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListUserLinksRequest, dict]]): - The request object. Request message for ListUserLinks - RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.ListFirebaseLinksRequest, dict]]): + The request object. Request message for ListFirebaseLinks + RPC parent (:class:`str`): - Required. Example format: - accounts/1234 + Required. Format: properties/{property_id} Example: + properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -1723,9 +1396,9 @@ async def sample_list_user_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListUserLinksAsyncPager: - Response message for ListUserLinks - RPC. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListFirebaseLinksAsyncPager: + Response message for + ListFirebaseLinks RPC Iterating over this object will yield results and resolve additional pages automatically. @@ -1741,7 +1414,7 @@ async def sample_list_user_links(): "the individual field arguments should be set." ) - request = analytics_admin.ListUserLinksRequest(request) + request = analytics_admin.ListFirebaseLinksRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -1751,7 +1424,7 @@ async def sample_list_user_links(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_user_links, + self._client._transport.list_firebase_links, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) @@ -1772,7 +1445,7 @@ async def sample_list_user_links(): # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. - response = pagers.ListUserLinksAsyncPager( + response = pagers.ListFirebaseLinksAsyncPager( method=rpc, request=request, response=response, @@ -1782,57 +1455,32 @@ async def sample_list_user_links(): # Done; return the response. return response - async def audit_user_links( + async def get_global_site_tag( self, - request: Optional[Union[analytics_admin.AuditUserLinksRequest, dict]] = None, + request: Optional[Union[analytics_admin.GetGlobalSiteTagRequest, dict]] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.AuditUserLinksAsyncPager: - r"""Lists all user links on an account or property, - including implicit ones that come from effective - permissions granted by groups or organization admin - roles. - - If a returned user link does not have direct - permissions, they cannot be removed from the account or - property directly with the DeleteUserLink command. They - have to be removed from the group/etc that gives them - permissions, which is currently only usable/discoverable - in the GA or GMP UIs. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_audit_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.AuditUserLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.audit_user_links(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> resources.GlobalSiteTag: + r"""Returns the Site Tag for the specified web stream. + Site Tags are immutable singletons. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.AuditUserLinksRequest, dict]]): - The request object. Request message for AuditUserLinks + request (Optional[Union[google.analytics.admin_v1alpha.types.GetGlobalSiteTagRequest, dict]]): + The request object. Request message for GetGlobalSiteTag RPC. + name (:class:`str`): + Required. The name of the site tag to lookup. Note that + site tags are singletons and do not have unique IDs. + Format: + properties/{property_id}/dataStreams/{stream_id}/globalSiteTag + Example: "properties/123/dataStreams/456/globalSiteTag" + + This corresponds to the ``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. @@ -1840,29 +1488,42 @@ async def sample_audit_user_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.AuditUserLinksAsyncPager: - Response message for AuditUserLinks - RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.GlobalSiteTag: + Read-only resource with the tag for + sending data from a website to a + DataStream. Only present for web + DataStream resources. """ # Create or coerce a protobuf request object. - request = analytics_admin.AuditUserLinksRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.audit_user_links, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.GetGlobalSiteTagRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_global_site_tag, + default_timeout=60.0, + client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -1873,85 +1534,39 @@ async def sample_audit_user_links(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.AuditUserLinksAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - async def create_user_link( + async def create_google_ads_link( self, - request: Optional[Union[analytics_admin.CreateUserLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.CreateGoogleAdsLinkRequest, dict] + ] = None, *, parent: Optional[str] = None, - user_link: Optional[resources.UserLink] = None, + google_ads_link: Optional[resources.GoogleAdsLink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.UserLink: - r"""Creates a user link on an account or property. - - If the user with the specified email already has - permissions on the account or property, then the user's - existing permissions will be unioned with the - permissions specified in the new UserLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateUserLinkRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_user_link(request=request) - - # Handle the response - print(response) + ) -> resources.GoogleAdsLink: + r"""Creates a GoogleAdsLink. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateUserLinkRequest, dict]]): - The request object. Request message for CreateUserLink - RPC. - Users can have multiple email addresses - associated with their Google account, - and one of these email addresses is the - "primary" email address. Any of the - email addresses associated with a Google - account may be used for a new UserLink, - but the returned UserLink will always - contain the "primary" email address. As - a result, the input and output email - address for this request may differ. + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateGoogleAdsLinkRequest, dict]]): + The request object. Request message for + CreateGoogleAdsLink RPC parent (:class:`str`): Required. Example format: - accounts/1234 + properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - user_link (:class:`google.analytics.admin_v1alpha.types.UserLink`): - Required. The user link to create. - This corresponds to the ``user_link`` field + google_ads_link (:class:`google.analytics.admin_v1alpha.types.GoogleAdsLink`): + Required. The GoogleAdsLink to + create. + + This corresponds to the ``google_ads_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, @@ -1961,35 +1576,34 @@ async def sample_create_user_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.UserLink: - A resource message representing a - user's permissions on an Account or - Property resource. + google.analytics.admin_v1alpha.types.GoogleAdsLink: + A link between a GA4 property and a + Google Ads account. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, user_link]) + has_flattened_params = any([parent, google_ads_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateUserLinkRequest(request) + request = analytics_admin.CreateGoogleAdsLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if user_link is not None: - request.user_link = user_link + if google_ads_link is not None: + request.google_ads_link = google_ads_link # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_user_link, + self._client._transport.create_google_ads_link, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) @@ -2011,55 +1625,39 @@ async def sample_create_user_link(): # Done; return the response. return response - async def batch_create_user_links( + async def update_google_ads_link( self, request: Optional[ - Union[analytics_admin.BatchCreateUserLinksRequest, dict] + Union[analytics_admin.UpdateGoogleAdsLinkRequest, dict] ] = None, *, + google_ads_link: Optional[resources.GoogleAdsLink] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchCreateUserLinksResponse: - r"""Creates information about multiple users' links to an - account or property. - This method is transactional. If any UserLink cannot be - created, none of the UserLinks will be created. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_batch_create_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - requests = admin_v1alpha.CreateUserLinkRequest() - requests.parent = "parent_value" - - request = admin_v1alpha.BatchCreateUserLinksRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - response = await client.batch_create_user_links(request=request) - - # Handle the response - print(response) + ) -> resources.GoogleAdsLink: + r"""Updates a GoogleAdsLink on a property Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.BatchCreateUserLinksRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateGoogleAdsLinkRequest, dict]]): The request object. Request message for - BatchCreateUserLinks RPC. + UpdateGoogleAdsLink RPC + google_ads_link (:class:`google.analytics.admin_v1alpha.types.GoogleAdsLink`): + The GoogleAdsLink to update + This corresponds to the ``google_ads_link`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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. @@ -2067,18 +1665,34 @@ async def sample_batch_create_user_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.BatchCreateUserLinksResponse: - Response message for - BatchCreateUserLinks RPC. + google.analytics.admin_v1alpha.types.GoogleAdsLink: + A link between a GA4 property and a + Google Ads account. """ # Create or coerce a protobuf request object. - request = analytics_admin.BatchCreateUserLinksRequest(request) + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([google_ads_link, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.UpdateGoogleAdsLinkRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if google_ads_link is not None: + request.google_ads_link = google_ads_link + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.batch_create_user_links, + self._client._transport.update_google_ads_link, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) @@ -2086,7 +1700,9 @@ async def sample_batch_create_user_links(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata( + (("google_ads_link.name", request.google_ads_link.name),) + ), ) # Send the request. @@ -2100,49 +1716,28 @@ async def sample_batch_create_user_links(): # Done; return the response. return response - async def update_user_link( + async def delete_google_ads_link( self, - request: Optional[Union[analytics_admin.UpdateUserLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.DeleteGoogleAdsLinkRequest, dict] + ] = None, *, - user_link: Optional[resources.UserLink] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.UserLink: - r"""Updates a user link on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateUserLinkRequest( - ) - - # Make the request - response = await client.update_user_link(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a GoogleAdsLink on a property Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateUserLinkRequest, dict]]): - The request object. Request message for UpdateUserLink - RPC. - user_link (:class:`google.analytics.admin_v1alpha.types.UserLink`): - Required. The user link to update. - This corresponds to the ``user_link`` field + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteGoogleAdsLinkRequest, dict]]): + The request object. Request message for + DeleteGoogleAdsLink RPC. + name (:class:`str`): + Required. Example format: + properties/1234/googleAdsLinks/5678 + + This corresponds to the ``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, @@ -2150,35 +1745,28 @@ async def sample_update_user_link(): 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.analytics.admin_v1alpha.types.UserLink: - A resource message representing a - user's permissions on an Account or - Property resource. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([user_link]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateUserLinkRequest(request) + request = analytics_admin.DeleteGoogleAdsLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if user_link is not None: - request.user_link = user_link + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_user_link, + self._client._transport.delete_google_ads_link, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) @@ -2186,65 +1774,41 @@ async def sample_update_user_link(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("user_link.name", request.user_link.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - async def batch_update_user_links( + async def list_google_ads_links( self, request: Optional[ - Union[analytics_admin.BatchUpdateUserLinksRequest, dict] + Union[analytics_admin.ListGoogleAdsLinksRequest, dict] ] = None, *, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchUpdateUserLinksResponse: - r"""Updates information about multiple users' links to an - account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_batch_update_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.BatchUpdateUserLinksRequest( - parent="parent_value", - ) - - # Make the request - response = await client.batch_update_user_links(request=request) - - # Handle the response - print(response) + ) -> pagers.ListGoogleAdsLinksAsyncPager: + r"""Lists GoogleAdsLinks on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.BatchUpdateUserLinksRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ListGoogleAdsLinksRequest, dict]]): The request object. Request message for - BatchUpdateUserLinks RPC. + ListGoogleAdsLinks RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 + + This corresponds to the ``parent`` 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. @@ -2252,18 +1816,35 @@ async def sample_batch_update_user_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.BatchUpdateUserLinksResponse: + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListGoogleAdsLinksAsyncPager: Response message for - BatchUpdateUserLinks RPC. + ListGoogleAdsLinks RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. - request = analytics_admin.BatchUpdateUserLinksRequest(request) + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.ListGoogleAdsLinksRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.batch_update_user_links, + self._client._transport.list_google_ads_links, default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) @@ -2282,50 +1863,42 @@ async def sample_batch_update_user_links(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListGoogleAdsLinksAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - async def delete_user_link( + async def get_data_sharing_settings( self, - request: Optional[Union[analytics_admin.DeleteUserLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.GetDataSharingSettingsRequest, dict] + ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a user link on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteUserLinkRequest( - name="name_value", - ) - - # Make the request - await client.delete_user_link(request=request) + ) -> resources.DataSharingSettings: + r"""Get data sharing settings on an account. + Data sharing settings are singletons. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteUserLinkRequest, dict]]): - The request object. Request message for DeleteUserLink - RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.GetDataSharingSettingsRequest, dict]]): + The request object. Request message for + GetDataSharingSettings RPC. name (:class:`str`): - Required. Example format: - accounts/1234/userLinks/5678 + Required. The name of the settings to + lookup. Format: + accounts/{account}/dataSharingSettings + Example: + "accounts/1000/dataSharingSettings" This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -2335,6 +1908,13 @@ async def sample_delete_user_link(): 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.analytics.admin_v1alpha.types.DataSharingSettings: + A resource message representing data + sharing settings of a Google Analytics + account. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -2346,7 +1926,7 @@ async def sample_delete_user_link(): "the individual field arguments should be set." ) - request = analytics_admin.DeleteUserLinkRequest(request) + request = analytics_admin.GetDataSharingSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -2356,8 +1936,8 @@ async def sample_delete_user_link(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_user_link, - default_timeout=60.0, + self._client._transport.get_data_sharing_settings, + default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -2368,146 +1948,121 @@ async def sample_delete_user_link(): ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def batch_delete_user_links( + # Done; return the response. + return response + + async def get_measurement_protocol_secret( self, request: Optional[ - Union[analytics_admin.BatchDeleteUserLinksRequest, dict] + Union[analytics_admin.GetMeasurementProtocolSecretRequest, dict] ] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes information about multiple users' links to an - account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_batch_delete_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - requests = admin_v1alpha.DeleteUserLinkRequest() - requests.name = "name_value" - - request = admin_v1alpha.BatchDeleteUserLinksRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - await client.batch_delete_user_links(request=request) + ) -> resources.MeasurementProtocolSecret: + r"""Lookup for a single "GA4" MeasurementProtocolSecret. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.BatchDeleteUserLinksRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.GetMeasurementProtocolSecretRequest, dict]]): The request object. Request message for - BatchDeleteUserLinks RPC. + GetMeasurementProtocolSecret RPC. + name (:class:`str`): + Required. The name of the measurement + protocol secret to lookup. Format: + + properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret} + + This corresponds to the ``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.analytics.admin_v1alpha.types.MeasurementProtocolSecret: + A secret value used for sending hits + to Measurement Protocol. + """ # Create or coerce a protobuf request object. - request = analytics_admin.BatchDeleteUserLinksRequest(request) + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.GetMeasurementProtocolSecretRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.batch_delete_user_links, - default_timeout=60.0, + self._client._transport.get_measurement_protocol_secret, + default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def create_firebase_link( + # Done; return the response. + return response + + async def list_measurement_protocol_secrets( self, request: Optional[ - Union[analytics_admin.CreateFirebaseLinkRequest, dict] + Union[analytics_admin.ListMeasurementProtocolSecretsRequest, dict] ] = None, *, parent: Optional[str] = None, - firebase_link: Optional[resources.FirebaseLink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.FirebaseLink: - r"""Creates a FirebaseLink. - - Properties can have at most one FirebaseLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_firebase_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateFirebaseLinkRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_firebase_link(request=request) - - # Handle the response - print(response) + ) -> pagers.ListMeasurementProtocolSecretsAsyncPager: + r"""Returns child MeasurementProtocolSecrets under the + specified parent Property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateFirebaseLinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ListMeasurementProtocolSecretsRequest, dict]]): The request object. Request message for - CreateFirebaseLink RPC + ListMeasurementProtocolSecret RPC parent (:class:`str`): - Required. Format: properties/{property_id} Example: - properties/1234 + Required. The resource name of the + parent stream. Format: - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - firebase_link (:class:`google.analytics.admin_v1alpha.types.FirebaseLink`): - Required. The Firebase link to - create. + properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets - This corresponds to the ``firebase_link`` field + This corresponds to the ``parent`` 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, @@ -2517,35 +2072,36 @@ async def sample_create_firebase_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.FirebaseLink: - A link between a GA4 property and a - Firebase project. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListMeasurementProtocolSecretsAsyncPager: + Response message for + ListMeasurementProtocolSecret RPC + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, firebase_link]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateFirebaseLinkRequest(request) + request = analytics_admin.ListMeasurementProtocolSecretsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if firebase_link is not None: - request.firebase_link = firebase_link # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_firebase_link, - default_timeout=60.0, + self._client._transport.list_measurement_protocol_secrets, + default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -2563,55 +2119,51 @@ async def sample_create_firebase_link(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListMeasurementProtocolSecretsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - async def delete_firebase_link( + async def create_measurement_protocol_secret( self, request: Optional[ - Union[analytics_admin.DeleteFirebaseLinkRequest, dict] + Union[analytics_admin.CreateMeasurementProtocolSecretRequest, dict] ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, + measurement_protocol_secret: Optional[ + resources.MeasurementProtocolSecret + ] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a FirebaseLink on a property - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_firebase_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteFirebaseLinkRequest( - name="name_value", - ) - - # Make the request - await client.delete_firebase_link(request=request) + ) -> resources.MeasurementProtocolSecret: + r"""Creates a measurement protocol secret. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteFirebaseLinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateMeasurementProtocolSecretRequest, dict]]): The request object. Request message for - DeleteFirebaseLink RPC - name (:class:`str`): - Required. Format: - properties/{property_id}/firebaseLinks/{firebase_link_id} - Example: properties/1234/firebaseLinks/5678 + CreateMeasurementProtocolSecret RPC + parent (:class:`str`): + Required. The parent resource where + this secret will be created. Format: + properties/{property}/dataStreams/{dataStream} - This corresponds to the ``name`` field + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + measurement_protocol_secret (:class:`google.analytics.admin_v1alpha.types.MeasurementProtocolSecret`): + Required. The measurement protocol + secret to create. + + This corresponds to the ``measurement_protocol_secret`` 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, @@ -2619,94 +2171,82 @@ async def sample_delete_firebase_link(): 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.analytics.admin_v1alpha.types.MeasurementProtocolSecret: + A secret value used for sending hits + to Measurement Protocol. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent, measurement_protocol_secret]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.DeleteFirebaseLinkRequest(request) + request = analytics_admin.CreateMeasurementProtocolSecretRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent + if measurement_protocol_secret is not None: + request.measurement_protocol_secret = measurement_protocol_secret # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_firebase_link, - default_timeout=60.0, + self._client._transport.create_measurement_protocol_secret, + default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def list_firebase_links( + # Done; return the response. + return response + + async def delete_measurement_protocol_secret( self, - request: Optional[Union[analytics_admin.ListFirebaseLinksRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.DeleteMeasurementProtocolSecretRequest, dict] + ] = None, *, - parent: Optional[str] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListFirebaseLinksAsyncPager: - r"""Lists FirebaseLinks on a property. - Properties can have at most one FirebaseLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_firebase_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListFirebaseLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_firebase_links(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> None: + r"""Deletes target MeasurementProtocolSecret. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListFirebaseLinksRequest, dict]]): - The request object. Request message for ListFirebaseLinks - RPC - parent (:class:`str`): - Required. Format: properties/{property_id} Example: - properties/1234 + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteMeasurementProtocolSecretRequest, dict]]): + The request object. Request message for + DeleteMeasurementProtocolSecret RPC + name (:class:`str`): + Required. The name of the + MeasurementProtocolSecret to delete. + Format: - This corresponds to the ``parent`` field + properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret} + + This corresponds to the ``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, @@ -2714,117 +2254,79 @@ async def sample_list_firebase_links(): 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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListFirebaseLinksAsyncPager: - Response message for - ListFirebaseLinks RPC - Iterating over this object will yield - results and resolve additional pages - automatically. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.ListFirebaseLinksRequest(request) + request = analytics_admin.DeleteMeasurementProtocolSecretRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_firebase_links, - default_timeout=60.0, + self._client._transport.delete_measurement_protocol_secret, + default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListFirebaseLinksAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_global_site_tag( + async def update_measurement_protocol_secret( self, - request: Optional[Union[analytics_admin.GetGlobalSiteTagRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.UpdateMeasurementProtocolSecretRequest, dict] + ] = None, *, - name: Optional[str] = None, + measurement_protocol_secret: Optional[ + resources.MeasurementProtocolSecret + ] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.GlobalSiteTag: - r"""Returns the Site Tag for the specified web stream. - Site Tags are immutable singletons. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_global_site_tag(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetGlobalSiteTagRequest( - name="name_value", - ) - - # Make the request - response = await client.get_global_site_tag(request=request) - - # Handle the response - print(response) + ) -> resources.MeasurementProtocolSecret: + r"""Updates a measurement protocol secret. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetGlobalSiteTagRequest, dict]]): - The request object. Request message for GetGlobalSiteTag - RPC. - name (:class:`str`): - Required. The name of the site tag to lookup. Note that - site tags are singletons and do not have unique IDs. - Format: - properties/{property_id}/dataStreams/{stream_id}/globalSiteTag - Example: "properties/123/dataStreams/456/globalSiteTag" + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateMeasurementProtocolSecretRequest, dict]]): + The request object. Request message for + UpdateMeasurementProtocolSecret RPC + measurement_protocol_secret (:class:`google.analytics.admin_v1alpha.types.MeasurementProtocolSecret`): + Required. The measurement protocol + secret to update. - This corresponds to the ``name`` field + This corresponds to the ``measurement_protocol_secret`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be + updated. Omitted fields will not be + updated. + + This corresponds to the ``update_mask`` 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, @@ -2834,42 +2336,49 @@ async def sample_get_global_site_tag(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.GlobalSiteTag: - Read-only resource with the tag for - sending data from a website to a - DataStream. Only present for web - DataStream resources. + google.analytics.admin_v1alpha.types.MeasurementProtocolSecret: + A secret value used for sending hits + to Measurement Protocol. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([measurement_protocol_secret, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetGlobalSiteTagRequest(request) + request = analytics_admin.UpdateMeasurementProtocolSecretRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if measurement_protocol_secret is not None: + request.measurement_protocol_secret = measurement_protocol_secret + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_global_site_tag, - default_timeout=60.0, + self._client._transport.update_measurement_protocol_secret, + default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "measurement_protocol_secret.name", + request.measurement_protocol_secret.name, + ), + ) + ), ) # Send the request. @@ -2883,64 +2392,26 @@ async def sample_get_global_site_tag(): # Done; return the response. return response - async def create_google_ads_link( + async def acknowledge_user_data_collection( self, request: Optional[ - Union[analytics_admin.CreateGoogleAdsLinkRequest, dict] + Union[analytics_admin.AcknowledgeUserDataCollectionRequest, dict] ] = None, *, - parent: Optional[str] = None, - google_ads_link: Optional[resources.GoogleAdsLink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.GoogleAdsLink: - r"""Creates a GoogleAdsLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_google_ads_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateGoogleAdsLinkRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_google_ads_link(request=request) - - # Handle the response - print(response) + ) -> analytics_admin.AcknowledgeUserDataCollectionResponse: + r"""Acknowledges the terms of user data collection for + the specified property. + This acknowledgement must be completed (either in the + Google Analytics UI or through this API) before + MeasurementProtocolSecret resources may be created. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateGoogleAdsLinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionRequest, dict]]): The request object. Request message for - CreateGoogleAdsLink RPC - parent (:class:`str`): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - google_ads_link (:class:`google.analytics.admin_v1alpha.types.GoogleAdsLink`): - Required. The GoogleAdsLink to - create. - - This corresponds to the ``google_ads_link`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + AcknowledgeUserDataCollection RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -2948,42 +2419,26 @@ async def sample_create_google_ads_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.GoogleAdsLink: - A link between a GA4 property and a - Google Ads account. + google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionResponse: + Response message for + AcknowledgeUserDataCollection RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, google_ads_link]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.CreateGoogleAdsLinkRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if google_ads_link is not None: - request.google_ads_link = google_ads_link + request = analytics_admin.AcknowledgeUserDataCollectionRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_google_ads_link, - default_timeout=60.0, + self._client._transport.acknowledge_user_data_collection, + default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("property", request.property),)), ) # Send the request. @@ -2997,62 +2452,29 @@ async def sample_create_google_ads_link(): # Done; return the response. return response - async def update_google_ads_link( + async def get_sk_ad_network_conversion_value_schema( self, request: Optional[ - Union[analytics_admin.UpdateGoogleAdsLinkRequest, dict] + Union[analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, dict] ] = None, *, - google_ads_link: Optional[resources.GoogleAdsLink] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.GoogleAdsLink: - r"""Updates a GoogleAdsLink on a property - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_google_ads_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateGoogleAdsLinkRequest( - ) - - # Make the request - response = await client.update_google_ads_link(request=request) - - # Handle the response - print(response) + ) -> resources.SKAdNetworkConversionValueSchema: + r"""Looks up a single SKAdNetworkConversionValueSchema. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateGoogleAdsLinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.GetSKAdNetworkConversionValueSchemaRequest, dict]]): The request object. Request message for - UpdateGoogleAdsLink RPC - google_ads_link (:class:`google.analytics.admin_v1alpha.types.GoogleAdsLink`): - The GoogleAdsLink to update - This corresponds to the ``google_ads_link`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + GetSKAdNetworkConversionValueSchema RPC. + name (:class:`str`): + Required. The resource name of SKAdNetwork conversion + value schema to look up. Format: + properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema} - This corresponds to the ``update_mask`` field + This corresponds to the ``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, @@ -3062,44 +2484,40 @@ async def sample_update_google_ads_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.GoogleAdsLink: - A link between a GA4 property and a - Google Ads account. + google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema: + SKAdNetwork conversion value schema + of an iOS stream. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([google_ads_link, update_mask]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateGoogleAdsLinkRequest(request) + request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if google_ads_link is not None: - request.google_ads_link = google_ads_link - if update_mask is not None: - request.update_mask = update_mask + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_google_ads_link, - default_timeout=60.0, + self._client._transport.get_sk_ad_network_conversion_value_schema, + default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("google_ads_link.name", request.google_ads_link.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -3113,51 +2531,40 @@ async def sample_update_google_ads_link(): # Done; return the response. return response - async def delete_google_ads_link( + async def create_sk_ad_network_conversion_value_schema( self, request: Optional[ - Union[analytics_admin.DeleteGoogleAdsLinkRequest, dict] + Union[analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, dict] ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, + skadnetwork_conversion_value_schema: Optional[ + resources.SKAdNetworkConversionValueSchema + ] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a GoogleAdsLink on a property - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_google_ads_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteGoogleAdsLinkRequest( - name="name_value", - ) - - # Make the request - await client.delete_google_ads_link(request=request) + ) -> resources.SKAdNetworkConversionValueSchema: + r"""Creates a SKAdNetworkConversionValueSchema. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteGoogleAdsLinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateSKAdNetworkConversionValueSchemaRequest, dict]]): The request object. Request message for - DeleteGoogleAdsLink RPC. - name (:class:`str`): - Required. Example format: - properties/1234/googleAdsLinks/5678 + CreateSKAdNetworkConversionValueSchema + RPC. + parent (:class:`str`): + Required. The parent resource where + this schema will be created. Format: + properties/{property}/dataStreams/{dataStream} - This corresponds to the ``name`` field + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + skadnetwork_conversion_value_schema (:class:`google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema`): + Required. SKAdNetwork conversion + value schema to create. + + This corresponds to the ``skadnetwork_conversion_value_schema`` 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, @@ -3165,95 +2572,83 @@ async def sample_delete_google_ads_link(): 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.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema: + SKAdNetwork conversion value schema + of an iOS stream. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent, skadnetwork_conversion_value_schema]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.DeleteGoogleAdsLinkRequest(request) + request = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent + if skadnetwork_conversion_value_schema is not None: + request.skadnetwork_conversion_value_schema = ( + skadnetwork_conversion_value_schema + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_google_ads_link, - default_timeout=60.0, + self._client._transport.create_sk_ad_network_conversion_value_schema, + default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def list_google_ads_links( + # Done; return the response. + return response + + async def delete_sk_ad_network_conversion_value_schema( self, request: Optional[ - Union[analytics_admin.ListGoogleAdsLinksRequest, dict] + Union[analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, dict] ] = None, *, - parent: Optional[str] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListGoogleAdsLinksAsyncPager: - r"""Lists GoogleAdsLinks on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_google_ads_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListGoogleAdsLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_google_ads_links(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> None: + r"""Deletes target SKAdNetworkConversionValueSchema. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListGoogleAdsLinksRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteSKAdNetworkConversionValueSchemaRequest, dict]]): The request object. Request message for - ListGoogleAdsLinks RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 + DeleteSKAdNetworkConversionValueSchema + RPC. + name (:class:`str`): + Required. The name of the + SKAdNetworkConversionValueSchema to delete. Format: + properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema} - This corresponds to the ``parent`` field + This corresponds to the ``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, @@ -3261,119 +2656,80 @@ async def sample_list_google_ads_links(): 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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListGoogleAdsLinksAsyncPager: - Response message for - ListGoogleAdsLinks RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.ListGoogleAdsLinksRequest(request) + request = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_google_ads_links, - default_timeout=60.0, + self._client._transport.delete_sk_ad_network_conversion_value_schema, + default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListGoogleAdsLinksAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_data_sharing_settings( + async def update_sk_ad_network_conversion_value_schema( self, request: Optional[ - Union[analytics_admin.GetDataSharingSettingsRequest, dict] + Union[analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, dict] ] = None, *, - name: Optional[str] = None, + skadnetwork_conversion_value_schema: Optional[ + resources.SKAdNetworkConversionValueSchema + ] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DataSharingSettings: - r"""Get data sharing settings on an account. - Data sharing settings are singletons. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_data_sharing_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDataSharingSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_data_sharing_settings(request=request) - - # Handle the response - print(response) + ) -> resources.SKAdNetworkConversionValueSchema: + r"""Updates a SKAdNetworkConversionValueSchema. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetDataSharingSettingsRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateSKAdNetworkConversionValueSchemaRequest, dict]]): The request object. Request message for - GetDataSharingSettings RPC. - name (:class:`str`): - Required. The name of the settings to - lookup. Format: - accounts/{account}/dataSharingSettings - Example: - "accounts/1000/dataSharingSettings" + UpdateSKAdNetworkConversionValueSchema + RPC. + skadnetwork_conversion_value_schema (:class:`google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema`): + Required. SKAdNetwork conversion + value schema to update. - This corresponds to the ``name`` field + This corresponds to the ``skadnetwork_conversion_value_schema`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be + updated. Omitted fields will not be + updated. + + This corresponds to the ``update_mask`` 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, @@ -3383,33 +2739,36 @@ async def sample_get_data_sharing_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DataSharingSettings: - A resource message representing data - sharing settings of a Google Analytics - account. + google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema: + SKAdNetwork conversion value schema + of an iOS stream. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([skadnetwork_conversion_value_schema, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetDataSharingSettingsRequest(request) + request = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if skadnetwork_conversion_value_schema is not None: + request.skadnetwork_conversion_value_schema = ( + skadnetwork_conversion_value_schema + ) + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_data_sharing_settings, + self._client._transport.update_sk_ad_network_conversion_value_schema, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -3417,7 +2776,14 @@ async def sample_get_data_sharing_settings(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "skadnetwork_conversion_value_schema.name", + request.skadnetwork_conversion_value_schema.name, + ), + ) + ), ) # Send the request. @@ -3431,56 +2797,33 @@ async def sample_get_data_sharing_settings(): # Done; return the response. return response - async def get_measurement_protocol_secret( + async def list_sk_ad_network_conversion_value_schemas( self, request: Optional[ - Union[analytics_admin.GetMeasurementProtocolSecretRequest, dict] + Union[analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, dict] ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.MeasurementProtocolSecret: - r"""Lookup for a single "GA4" MeasurementProtocolSecret. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetMeasurementProtocolSecretRequest( - name="name_value", - ) - - # Make the request - response = await client.get_measurement_protocol_secret(request=request) - - # Handle the response - print(response) + ) -> pagers.ListSKAdNetworkConversionValueSchemasAsyncPager: + r"""Lists SKAdNetworkConversionValueSchema on a stream. + Properties can have at most one + SKAdNetworkConversionValueSchema. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetMeasurementProtocolSecretRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ListSKAdNetworkConversionValueSchemasRequest, dict]]): The request object. Request message for - GetMeasurementProtocolSecret RPC. - name (:class:`str`): - Required. The name of the measurement - protocol secret to lookup. Format: - - properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret} + ListSKAdNetworkConversionValueSchemas + RPC + parent (:class:`str`): + Required. The DataStream resource to list schemas for. + Format: + properties/{property_id}/dataStreams/{dataStream} + Example: properties/1234/dataStreams/5678 - This corresponds to the ``name`` field + This corresponds to the ``parent`` 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, @@ -3490,32 +2833,35 @@ async def sample_get_measurement_protocol_secret(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.MeasurementProtocolSecret: - A secret value used for sending hits - to Measurement Protocol. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSKAdNetworkConversionValueSchemasAsyncPager: + Response message for + ListSKAdNetworkConversionValueSchemas + RPC Iterating over this object will + yield results and resolve additional + pages automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetMeasurementProtocolSecretRequest(request) + request = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_measurement_protocol_secret, + self._client._transport.list_sk_ad_network_conversion_value_schemas, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -3523,7 +2869,7 @@ async def sample_get_measurement_protocol_secret(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -3534,63 +2880,35 @@ async def sample_get_measurement_protocol_secret(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListSKAdNetworkConversionValueSchemasAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - async def list_measurement_protocol_secrets( + async def search_change_history_events( self, request: Optional[ - Union[analytics_admin.ListMeasurementProtocolSecretsRequest, dict] + Union[analytics_admin.SearchChangeHistoryEventsRequest, dict] ] = None, *, - parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListMeasurementProtocolSecretsAsyncPager: - r"""Returns child MeasurementProtocolSecrets under the - specified parent Property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_measurement_protocol_secrets(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListMeasurementProtocolSecretsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_measurement_protocol_secrets(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> pagers.SearchChangeHistoryEventsAsyncPager: + r"""Searches through all changes to an account or its + children given the specified set of filters. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListMeasurementProtocolSecretsRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.SearchChangeHistoryEventsRequest, dict]]): The request object. Request message for - ListMeasurementProtocolSecret RPC - parent (:class:`str`): - Required. The resource name of the - parent stream. Format: - - properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + SearchChangeHistoryEvents RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -3598,35 +2916,21 @@ async def sample_list_measurement_protocol_secrets(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListMeasurementProtocolSecretsAsyncPager: - Response message for - ListMeasurementProtocolSecret RPC + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.SearchChangeHistoryEventsAsyncPager: + Response message for SearchAccounts + RPC. Iterating over this object will yield results and resolve additional pages automatically. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.ListMeasurementProtocolSecretsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent + request = analytics_admin.SearchChangeHistoryEventsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_measurement_protocol_secrets, + self._client._transport.search_change_history_events, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -3634,7 +2938,7 @@ async def sample_list_measurement_protocol_secrets(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("account", request.account),)), ) # Send the request. @@ -3647,7 +2951,7 @@ async def sample_list_measurement_protocol_secrets(): # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. - response = pagers.ListMeasurementProtocolSecretsAsyncPager( + response = pagers.SearchChangeHistoryEventsAsyncPager( method=rpc, request=request, response=response, @@ -3657,69 +2961,29 @@ async def sample_list_measurement_protocol_secrets(): # Done; return the response. return response - async def create_measurement_protocol_secret( + async def get_google_signals_settings( self, request: Optional[ - Union[analytics_admin.CreateMeasurementProtocolSecretRequest, dict] + Union[analytics_admin.GetGoogleSignalsSettingsRequest, dict] ] = None, *, - parent: Optional[str] = None, - measurement_protocol_secret: Optional[ - resources.MeasurementProtocolSecret - ] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.MeasurementProtocolSecret: - r"""Creates a measurement protocol secret. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - measurement_protocol_secret = admin_v1alpha.MeasurementProtocolSecret() - measurement_protocol_secret.display_name = "display_name_value" - - request = admin_v1alpha.CreateMeasurementProtocolSecretRequest( - parent="parent_value", - measurement_protocol_secret=measurement_protocol_secret, - ) - - # Make the request - response = await client.create_measurement_protocol_secret(request=request) - - # Handle the response - print(response) + ) -> resources.GoogleSignalsSettings: + r"""Lookup for Google Signals settings for a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateMeasurementProtocolSecretRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.GetGoogleSignalsSettingsRequest, dict]]): The request object. Request message for - CreateMeasurementProtocolSecret RPC - parent (:class:`str`): - Required. The parent resource where - this secret will be created. Format: - properties/{property}/dataStreams/{dataStream} - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - measurement_protocol_secret (:class:`google.analytics.admin_v1alpha.types.MeasurementProtocolSecret`): - Required. The measurement protocol - secret to create. + GetGoogleSignalsSettings RPC + name (:class:`str`): + Required. The name of the google + signals settings to retrieve. Format: + properties/{property}/googleSignalsSettings - This corresponds to the ``measurement_protocol_secret`` field + This corresponds to the ``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, @@ -3729,34 +2993,32 @@ async def sample_create_measurement_protocol_secret(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.MeasurementProtocolSecret: - A secret value used for sending hits - to Measurement Protocol. + google.analytics.admin_v1alpha.types.GoogleSignalsSettings: + Settings values for Google Signals. + This is a singleton resource. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, measurement_protocol_secret]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateMeasurementProtocolSecretRequest(request) + request = analytics_admin.GetGoogleSignalsSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if measurement_protocol_secret is not None: - request.measurement_protocol_secret = measurement_protocol_secret + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_measurement_protocol_secret, + self._client._transport.get_google_signals_settings, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -3764,7 +3026,7 @@ async def sample_create_measurement_protocol_secret(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -3778,54 +3040,39 @@ async def sample_create_measurement_protocol_secret(): # Done; return the response. return response - async def delete_measurement_protocol_secret( + async def update_google_signals_settings( self, request: Optional[ - Union[analytics_admin.DeleteMeasurementProtocolSecretRequest, dict] + Union[analytics_admin.UpdateGoogleSignalsSettingsRequest, dict] ] = None, *, - name: Optional[str] = None, + google_signals_settings: Optional[resources.GoogleSignalsSettings] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes target MeasurementProtocolSecret. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteMeasurementProtocolSecretRequest( - name="name_value", - ) - - # Make the request - await client.delete_measurement_protocol_secret(request=request) + ) -> resources.GoogleSignalsSettings: + r"""Updates Google Signals settings for a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteMeasurementProtocolSecretRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateGoogleSignalsSettingsRequest, dict]]): The request object. Request message for - DeleteMeasurementProtocolSecret RPC - name (:class:`str`): - Required. The name of the - MeasurementProtocolSecret to delete. - Format: + UpdateGoogleSignalsSettings RPC + google_signals_settings (:class:`google.analytics.admin_v1alpha.types.GoogleSignalsSettings`): + Required. The settings to update. The ``name`` field is + used to identify the settings to be updated. - properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret} + This corresponds to the ``google_signals_settings`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. - This corresponds to the ``name`` field + This corresponds to the ``update_mask`` 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, @@ -3833,28 +3080,36 @@ async def sample_delete_measurement_protocol_secret(): 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.analytics.admin_v1alpha.types.GoogleSignalsSettings: + Settings values for Google Signals. + This is a singleton resource. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([google_signals_settings, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.DeleteMeasurementProtocolSecretRequest(request) + request = analytics_admin.UpdateGoogleSignalsSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if google_signals_settings is not None: + request.google_signals_settings = google_signals_settings + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_measurement_protocol_secret, + self._client._transport.update_google_signals_settings, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -3862,79 +3117,60 @@ async def sample_delete_measurement_protocol_secret(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "google_signals_settings.name", + request.google_signals_settings.name, + ), + ) + ), ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def update_measurement_protocol_secret( + # Done; return the response. + return response + + async def create_conversion_event( self, request: Optional[ - Union[analytics_admin.UpdateMeasurementProtocolSecretRequest, dict] + Union[analytics_admin.CreateConversionEventRequest, dict] ] = None, *, - measurement_protocol_secret: Optional[ - resources.MeasurementProtocolSecret - ] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, + conversion_event: Optional[resources.ConversionEvent] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.MeasurementProtocolSecret: - r"""Updates a measurement protocol secret. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - measurement_protocol_secret = admin_v1alpha.MeasurementProtocolSecret() - measurement_protocol_secret.display_name = "display_name_value" - - request = admin_v1alpha.UpdateMeasurementProtocolSecretRequest( - measurement_protocol_secret=measurement_protocol_secret, - ) - - # Make the request - response = await client.update_measurement_protocol_secret(request=request) - - # Handle the response - print(response) + ) -> resources.ConversionEvent: + r"""Creates a conversion event with the specified + attributes. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateMeasurementProtocolSecretRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateConversionEventRequest, dict]]): The request object. Request message for - UpdateMeasurementProtocolSecret RPC - measurement_protocol_secret (:class:`google.analytics.admin_v1alpha.types.MeasurementProtocolSecret`): - Required. The measurement protocol - secret to update. + CreateConversionEvent RPC + parent (:class:`str`): + Required. The resource name of the + parent property where this conversion + event will be created. Format: + properties/123 - This corresponds to the ``measurement_protocol_secret`` field + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be - updated. Omitted fields will not be - updated. + conversion_event (:class:`google.analytics.admin_v1alpha.types.ConversionEvent`): + Required. The conversion event to + create. - This corresponds to the ``update_mask`` field + This corresponds to the ``conversion_event`` 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, @@ -3944,34 +3180,34 @@ async def sample_update_measurement_protocol_secret(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.MeasurementProtocolSecret: - A secret value used for sending hits - to Measurement Protocol. + google.analytics.admin_v1alpha.types.ConversionEvent: + A conversion event in a Google + Analytics property. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([measurement_protocol_secret, update_mask]) + has_flattened_params = any([parent, conversion_event]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateMeasurementProtocolSecretRequest(request) + request = analytics_admin.CreateConversionEventRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if measurement_protocol_secret is not None: - request.measurement_protocol_secret = measurement_protocol_secret - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent + if conversion_event is not None: + request.conversion_event = conversion_event # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_measurement_protocol_secret, + self._client._transport.create_conversion_event, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -3979,14 +3215,7 @@ async def sample_update_measurement_protocol_secret(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "measurement_protocol_secret.name", - request.measurement_protocol_secret.name, - ), - ) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -4000,53 +3229,42 @@ async def sample_update_measurement_protocol_secret(): # Done; return the response. return response - async def acknowledge_user_data_collection( + async def update_conversion_event( self, request: Optional[ - Union[analytics_admin.AcknowledgeUserDataCollectionRequest, dict] + Union[analytics_admin.UpdateConversionEventRequest, dict] ] = None, *, + conversion_event: Optional[resources.ConversionEvent] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.AcknowledgeUserDataCollectionResponse: - r"""Acknowledges the terms of user data collection for - the specified property. - This acknowledgement must be completed (either in the - Google Analytics UI or through this API) before - MeasurementProtocolSecret resources may be created. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_acknowledge_user_data_collection(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.AcknowledgeUserDataCollectionRequest( - property="property_value", - acknowledgement="acknowledgement_value", - ) - - # Make the request - response = await client.acknowledge_user_data_collection(request=request) - - # Handle the response - print(response) + ) -> resources.ConversionEvent: + r"""Updates a conversion event with the specified + attributes. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateConversionEventRequest, dict]]): The request object. Request message for - AcknowledgeUserDataCollection RPC. + UpdateConversionEvent RPC + conversion_event (:class:`google.analytics.admin_v1alpha.types.ConversionEvent`): + Required. The conversion event to update. The ``name`` + field is used to identify the settings to be updated. + + This corresponds to the ``conversion_event`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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. @@ -4054,18 +3272,34 @@ async def sample_acknowledge_user_data_collection(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionResponse: - Response message for - AcknowledgeUserDataCollection RPC. + google.analytics.admin_v1alpha.types.ConversionEvent: + A conversion event in a Google + Analytics property. """ # Create or coerce a protobuf request object. - request = analytics_admin.AcknowledgeUserDataCollectionRequest(request) + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([conversion_event, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.UpdateConversionEventRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if conversion_event is not None: + request.conversion_event = conversion_event + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.acknowledge_user_data_collection, + self._client._transport.update_conversion_event, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4073,7 +3307,9 @@ async def sample_acknowledge_user_data_collection(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("property", request.property),)), + gapic_v1.routing_header.to_grpc_metadata( + (("conversion_event.name", request.conversion_event.name),) + ), ) # Send the request. @@ -4087,53 +3323,28 @@ async def sample_acknowledge_user_data_collection(): # Done; return the response. return response - async def get_sk_ad_network_conversion_value_schema( + async def get_conversion_event( self, request: Optional[ - Union[analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, dict] + Union[analytics_admin.GetConversionEventRequest, dict] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SKAdNetworkConversionValueSchema: - r"""Looks up a single SKAdNetworkConversionValueSchema. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetSKAdNetworkConversionValueSchemaRequest( - name="name_value", - ) - - # Make the request - response = await client.get_sk_ad_network_conversion_value_schema(request=request) - - # Handle the response - print(response) + ) -> resources.ConversionEvent: + r"""Retrieve a single conversion event. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetSKAdNetworkConversionValueSchemaRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.GetConversionEventRequest, dict]]): The request object. Request message for - GetSKAdNetworkConversionValueSchema RPC. + GetConversionEvent RPC name (:class:`str`): - Required. The resource name of SKAdNetwork conversion - value schema to look up. Format: - properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema} + Required. The resource name of the conversion event to + retrieve. Format: + properties/{property}/conversionEvents/{conversion_event} + Example: "properties/123/conversionEvents/456" This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -4145,9 +3356,9 @@ async def sample_get_sk_ad_network_conversion_value_schema(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema: - SKAdNetwork conversion value schema - of an iOS stream. + google.analytics.admin_v1alpha.types.ConversionEvent: + A conversion event in a Google + Analytics property. """ # Create or coerce a protobuf request object. @@ -4160,7 +3371,7 @@ async def sample_get_sk_ad_network_conversion_value_schema(): "the individual field arguments should be set." ) - request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest(request) + request = analytics_admin.GetConversionEventRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -4170,7 +3381,7 @@ async def sample_get_sk_ad_network_conversion_value_schema(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_sk_ad_network_conversion_value_schema, + self._client._transport.get_conversion_event, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4192,68 +3403,104 @@ async def sample_get_sk_ad_network_conversion_value_schema(): # Done; return the response. return response - async def create_sk_ad_network_conversion_value_schema( + async def delete_conversion_event( self, request: Optional[ - Union[analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, dict] + Union[analytics_admin.DeleteConversionEventRequest, dict] ] = None, *, - parent: Optional[str] = None, - skadnetwork_conversion_value_schema: Optional[ - resources.SKAdNetworkConversionValueSchema - ] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SKAdNetworkConversionValueSchema: - r"""Creates a SKAdNetworkConversionValueSchema. + ) -> None: + r"""Deletes a conversion event in a property. + + Args: + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteConversionEventRequest, dict]]): + The request object. Request message for + DeleteConversionEvent RPC + name (:class:`str`): + Required. The resource name of the conversion event to + delete. Format: + properties/{property}/conversionEvents/{conversion_event} + Example: "properties/123/conversionEvents/456" + + This corresponds to the ``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. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) - .. code-block:: python + request = analytics_admin.DeleteConversionEventRequest(request) - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name - async def sample_create_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_conversion_event, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) - # Initialize request argument(s) - request = admin_v1alpha.CreateSKAdNetworkConversionValueSchemaRequest( - parent="parent_value", - ) + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) - # Make the request - response = await client.create_sk_ad_network_conversion_value_schema(request=request) + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) - # Handle the response - print(response) + async def list_conversion_events( + self, + request: Optional[ + Union[analytics_admin.ListConversionEventsRequest, dict] + ] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListConversionEventsAsyncPager: + r"""Returns a list of conversion events in the specified + parent property. + Returns an empty list if no conversion events are found. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateSKAdNetworkConversionValueSchemaRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ListConversionEventsRequest, dict]]): The request object. Request message for - CreateSKAdNetworkConversionValueSchema - RPC. + ListConversionEvents RPC parent (:class:`str`): - Required. The parent resource where - this schema will be created. Format: - properties/{property}/dataStreams/{dataStream} + Required. The resource name of the + parent property. Example: + 'properties/123' This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - skadnetwork_conversion_value_schema (:class:`google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema`): - Required. SKAdNetwork conversion - value schema to create. - - This corresponds to the ``skadnetwork_conversion_value_schema`` 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. @@ -4261,36 +3508,35 @@ async def sample_create_sk_ad_network_conversion_value_schema(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema: - SKAdNetwork conversion value schema - of an iOS stream. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListConversionEventsAsyncPager: + Response message for + ListConversionEvents RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, skadnetwork_conversion_value_schema]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest(request) + request = analytics_admin.ListConversionEventsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if skadnetwork_conversion_value_schema is not None: - request.skadnetwork_conversion_value_schema = ( - skadnetwork_conversion_value_schema - ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_sk_ad_network_conversion_value_schema, + self._client._transport.list_conversion_events, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4309,54 +3555,40 @@ async def sample_create_sk_ad_network_conversion_value_schema(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListConversionEventsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - async def delete_sk_ad_network_conversion_value_schema( + async def get_display_video360_advertiser_link( self, request: Optional[ - Union[analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, dict] + Union[analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, dict] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes target SKAdNetworkConversionValueSchema. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteSKAdNetworkConversionValueSchemaRequest( - name="name_value", - ) - - # Make the request - await client.delete_sk_ad_network_conversion_value_schema(request=request) + ) -> resources.DisplayVideo360AdvertiserLink: + r"""Look up a single DisplayVideo360AdvertiserLink Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteSKAdNetworkConversionValueSchemaRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkRequest, dict]]): The request object. Request message for - DeleteSKAdNetworkConversionValueSchema - RPC. + GetDisplayVideo360AdvertiserLink RPC. name (:class:`str`): Required. The name of the - SKAdNetworkConversionValueSchema to delete. Format: - properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema} + DisplayVideo360AdvertiserLink to get. + Example format: + properties/1234/displayVideo360AdvertiserLink/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -4366,6 +3598,12 @@ async def sample_delete_sk_ad_network_conversion_value_schema(): 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.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: + A link between a GA4 property and a + Display & Video 360 advertiser. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -4377,7 +3615,7 @@ async def sample_delete_sk_ad_network_conversion_value_schema(): "the individual field arguments should be set." ) - request = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest(request) + request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -4387,7 +3625,7 @@ async def sample_delete_sk_ad_network_conversion_value_schema(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_sk_ad_network_conversion_value_schema, + self._client._transport.get_display_video360_advertiser_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4399,72 +3637,39 @@ async def sample_delete_sk_ad_network_conversion_value_schema(): ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def update_sk_ad_network_conversion_value_schema( - self, - request: Optional[ - Union[analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, dict] + # Done; return the response. + return response + + async def list_display_video360_advertiser_links( + self, + request: Optional[ + Union[analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, dict] ] = None, *, - skadnetwork_conversion_value_schema: Optional[ - resources.SKAdNetworkConversionValueSchema - ] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SKAdNetworkConversionValueSchema: - r"""Updates a SKAdNetworkConversionValueSchema. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateSKAdNetworkConversionValueSchemaRequest( - ) - - # Make the request - response = await client.update_sk_ad_network_conversion_value_schema(request=request) - - # Handle the response - print(response) + ) -> pagers.ListDisplayVideo360AdvertiserLinksAsyncPager: + r"""Lists all DisplayVideo360AdvertiserLinks on a + property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateSKAdNetworkConversionValueSchemaRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksRequest, dict]]): The request object. Request message for - UpdateSKAdNetworkConversionValueSchema - RPC. - skadnetwork_conversion_value_schema (:class:`google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema`): - Required. SKAdNetwork conversion - value schema to update. - - This corresponds to the ``skadnetwork_conversion_value_schema`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be - updated. Omitted fields will not be - updated. + ListDisplayVideo360AdvertiserLinks RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 - This corresponds to the ``update_mask`` field + This corresponds to the ``parent`` 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, @@ -4474,36 +3679,35 @@ async def sample_update_sk_ad_network_conversion_value_schema(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema: - SKAdNetwork conversion value schema - of an iOS stream. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinksAsyncPager: + Response message for + ListDisplayVideo360AdvertiserLinks RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([skadnetwork_conversion_value_schema, update_mask]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest(request) + request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if skadnetwork_conversion_value_schema is not None: - request.skadnetwork_conversion_value_schema = ( - skadnetwork_conversion_value_schema - ) - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_sk_ad_network_conversion_value_schema, + self._client._transport.list_display_video360_advertiser_links, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4511,14 +3715,7 @@ async def sample_update_sk_ad_network_conversion_value_schema(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "skadnetwork_conversion_value_schema.name", - request.skadnetwork_conversion_value_schema.name, - ), - ) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -4529,65 +3726,57 @@ async def sample_update_sk_ad_network_conversion_value_schema(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListDisplayVideo360AdvertiserLinksAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - async def list_sk_ad_network_conversion_value_schemas( + async def create_display_video360_advertiser_link( self, request: Optional[ - Union[analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, dict] + Union[analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, dict] ] = None, *, parent: Optional[str] = None, + display_video_360_advertiser_link: Optional[ + resources.DisplayVideo360AdvertiserLink + ] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListSKAdNetworkConversionValueSchemasAsyncPager: - r"""Lists SKAdNetworkConversionValueSchema on a stream. - Properties can have at most one - SKAdNetworkConversionValueSchema. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_sk_ad_network_conversion_value_schemas(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListSKAdNetworkConversionValueSchemasRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_sk_ad_network_conversion_value_schemas(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> resources.DisplayVideo360AdvertiserLink: + r"""Creates a DisplayVideo360AdvertiserLink. + This can only be utilized by users who have proper + authorization both on the Google Analytics property and + on the Display & Video 360 advertiser. Users who do not + have access to the Display & Video 360 advertiser should + instead seek to create a DisplayVideo360LinkProposal. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListSKAdNetworkConversionValueSchemasRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkRequest, dict]]): The request object. Request message for - ListSKAdNetworkConversionValueSchemas - RPC + CreateDisplayVideo360AdvertiserLink RPC. parent (:class:`str`): - Required. Format: - properties/{property_id}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema - Example: - properties/1234/dataStreams/5678/sKAdNetworkConversionValueSchema + Required. Example format: + properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. + display_video_360_advertiser_link (:class:`google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink`): + Required. The + DisplayVideo360AdvertiserLink to create. + + This corresponds to the ``display_video_360_advertiser_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. @@ -4595,35 +3784,36 @@ async def sample_list_sk_ad_network_conversion_value_schemas(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSKAdNetworkConversionValueSchemasAsyncPager: - Response message for - ListSKAdNetworkConversionValueSchemas - RPC Iterating over this object will - yield results and resolve additional - pages automatically. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: + A link between a GA4 property and a + Display & Video 360 advertiser. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([parent, display_video_360_advertiser_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest(request) + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent + if display_video_360_advertiser_link is not None: + request.display_video_360_advertiser_link = ( + display_video_360_advertiser_link + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_sk_ad_network_conversion_value_schemas, + self._client._transport.create_display_video360_advertiser_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4642,84 +3832,63 @@ async def sample_list_sk_ad_network_conversion_value_schemas(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListSKAdNetworkConversionValueSchemasAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - async def search_change_history_events( + async def delete_display_video360_advertiser_link( self, request: Optional[ - Union[analytics_admin.SearchChangeHistoryEventsRequest, dict] + Union[analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, dict] ] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.SearchChangeHistoryEventsAsyncPager: - r"""Searches through all changes to an account or its - children given the specified set of filters. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_search_change_history_events(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.SearchChangeHistoryEventsRequest( - account="account_value", - ) - - # Make the request - page_result = client.search_change_history_events(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> None: + r"""Deletes a DisplayVideo360AdvertiserLink on a + property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.SearchChangeHistoryEventsRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkRequest, dict]]): The request object. Request message for - SearchChangeHistoryEvents RPC. + DeleteDisplayVideo360AdvertiserLink RPC. + name (:class:`str`): + Required. The name of the + DisplayVideo360AdvertiserLink to delete. + Example format: + properties/1234/displayVideo360AdvertiserLinks/5678 + + This corresponds to the ``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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.SearchChangeHistoryEventsAsyncPager: - Response message for SearchAccounts - RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. - """ # Create or coerce a protobuf request object. - request = analytics_admin.SearchChangeHistoryEventsRequest(request) + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.search_change_history_events, + self._client._transport.delete_display_video360_advertiser_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4727,78 +3896,52 @@ async def sample_search_change_history_events(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("account", request.account),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.SearchChangeHistoryEventsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_google_signals_settings( + async def update_display_video360_advertiser_link( self, request: Optional[ - Union[analytics_admin.GetGoogleSignalsSettingsRequest, dict] + Union[analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, dict] ] = None, *, - name: Optional[str] = None, + display_video_360_advertiser_link: Optional[ + resources.DisplayVideo360AdvertiserLink + ] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.GoogleSignalsSettings: - r"""Lookup for Google Signals settings for a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_google_signals_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetGoogleSignalsSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_google_signals_settings(request=request) - - # Handle the response - print(response) + ) -> resources.DisplayVideo360AdvertiserLink: + r"""Updates a DisplayVideo360AdvertiserLink on a + property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetGoogleSignalsSettingsRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateDisplayVideo360AdvertiserLinkRequest, dict]]): The request object. Request message for - GetGoogleSignalsSettings RPC - name (:class:`str`): - Required. The name of the google - signals settings to retrieve. Format: - properties/{property}/googleSignalsSettings + UpdateDisplayVideo360AdvertiserLink RPC. + display_video_360_advertiser_link (:class:`google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink`): + The DisplayVideo360AdvertiserLink to + update - This corresponds to the ``name`` field + This corresponds to the ``display_video_360_advertiser_link`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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, @@ -4808,32 +3951,36 @@ async def sample_get_google_signals_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.GoogleSignalsSettings: - Settings values for Google Signals. - This is a singleton resource. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: + A link between a GA4 property and a + Display & Video 360 advertiser. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([display_video_360_advertiser_link, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetGoogleSignalsSettingsRequest(request) + request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if display_video_360_advertiser_link is not None: + request.display_video_360_advertiser_link = ( + display_video_360_advertiser_link + ) + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_google_signals_settings, + self._client._transport.update_display_video360_advertiser_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4841,7 +3988,14 @@ async def sample_get_google_signals_settings(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "display_video_360_advertiser_link.name", + request.display_video_360_advertiser_link.name, + ), + ) + ), ) # Send the request. @@ -4855,64 +4009,32 @@ async def sample_get_google_signals_settings(): # Done; return the response. return response - async def update_google_signals_settings( + async def get_display_video360_advertiser_link_proposal( self, request: Optional[ - Union[analytics_admin.UpdateGoogleSignalsSettingsRequest, dict] + Union[analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, dict] ] = None, *, - google_signals_settings: Optional[resources.GoogleSignalsSettings] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.GoogleSignalsSettings: - r"""Updates Google Signals settings for a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_google_signals_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateGoogleSignalsSettingsRequest( - ) - - # Make the request - response = await client.update_google_signals_settings(request=request) - - # Handle the response - print(response) + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Lookup for a single + DisplayVideo360AdvertiserLinkProposal. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateGoogleSignalsSettingsRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkProposalRequest, dict]]): The request object. Request message for - UpdateGoogleSignalsSettings RPC - google_signals_settings (:class:`google.analytics.admin_v1alpha.types.GoogleSignalsSettings`): - Required. The settings to update. The ``name`` field is - used to identify the settings to be updated. - - This corresponds to the ``google_signals_settings`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + GetDisplayVideo360AdvertiserLinkProposal + RPC. + name (:class:`str`): + Required. The name of the + DisplayVideo360AdvertiserLinkProposal to + get. Example format: + properties/1234/displayVideo360AdvertiserLinkProposals/5678 - This corresponds to the ``update_mask`` field + This corresponds to the ``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, @@ -4922,34 +4044,42 @@ async def sample_update_google_signals_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.GoogleSignalsSettings: - Settings values for Google Signals. - This is a singleton resource. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: + A proposal for a link between a GA4 + property and a Display & Video 360 + advertiser. + + A proposal is converted to a + DisplayVideo360AdvertiserLink once + approved. Google Analytics admins + approve inbound proposals while Display + & Video 360 admins approve outbound + proposals. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([google_signals_settings, update_mask]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateGoogleSignalsSettingsRequest(request) + request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. - if google_signals_settings is not None: - request.google_signals_settings = google_signals_settings - if update_mask is not None: - request.update_mask = update_mask + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_google_signals_settings, + self._client._transport.get_display_video360_advertiser_link_proposal, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4957,14 +4087,7 @@ async def sample_update_google_signals_settings(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "google_signals_settings.name", - request.google_signals_settings.name, - ), - ) - ), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -4978,67 +4101,34 @@ async def sample_update_google_signals_settings(): # Done; return the response. return response - async def create_conversion_event( + async def list_display_video360_advertiser_link_proposals( self, request: Optional[ - Union[analytics_admin.CreateConversionEventRequest, dict] + Union[ + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, dict + ] ] = None, *, parent: Optional[str] = None, - conversion_event: Optional[resources.ConversionEvent] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.ConversionEvent: - r"""Creates a conversion event with the specified - attributes. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateConversionEventRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_conversion_event(request=request) - - # Handle the response - print(response) + ) -> pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager: + r"""Lists DisplayVideo360AdvertiserLinkProposals on a + property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateConversionEventRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsRequest, dict]]): The request object. Request message for - CreateConversionEvent RPC + ListDisplayVideo360AdvertiserLinkProposals + RPC. parent (:class:`str`): - Required. The resource name of the - parent property where this conversion - event will be created. Format: - properties/123 + Required. Example format: + properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - conversion_event (:class:`google.analytics.admin_v1alpha.types.ConversionEvent`): - Required. The conversion event to - create. - - This corresponds to the ``conversion_event`` 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. @@ -5046,34 +4136,37 @@ async def sample_create_conversion_event(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ConversionEvent: - A conversion event in a Google - Analytics property. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager: + Response message for + ListDisplayVideo360AdvertiserLinkProposals + RPC. Iterating over this object will + yield results and resolve additional + pages automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, conversion_event]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateConversionEventRequest(request) + request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if conversion_event is not None: - request.conversion_event = conversion_event # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_conversion_event, + self._client._transport.list_display_video360_advertiser_link_proposals, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -5092,68 +4185,54 @@ async def sample_create_conversion_event(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - async def update_conversion_event( + async def create_display_video360_advertiser_link_proposal( self, request: Optional[ - Union[analytics_admin.UpdateConversionEventRequest, dict] + Union[ + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, dict + ] ] = None, *, - conversion_event: Optional[resources.ConversionEvent] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, + display_video_360_advertiser_link_proposal: Optional[ + resources.DisplayVideo360AdvertiserLinkProposal + ] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.ConversionEvent: - r"""Updates a conversion event with the specified - attributes. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateConversionEventRequest( - ) - - # Make the request - response = await client.update_conversion_event(request=request) - - # Handle the response - print(response) + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Creates a DisplayVideo360AdvertiserLinkProposal. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateConversionEventRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkProposalRequest, dict]]): The request object. Request message for - UpdateConversionEvent RPC - conversion_event (:class:`google.analytics.admin_v1alpha.types.ConversionEvent`): - Required. The conversion event to update. The ``name`` - field is used to identify the settings to be updated. + CreateDisplayVideo360AdvertiserLinkProposal + RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 - This corresponds to the ``conversion_event`` field + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + display_video_360_advertiser_link_proposal (:class:`google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal`): + Required. The + DisplayVideo360AdvertiserLinkProposal to + create. - This corresponds to the ``update_mask`` field + This corresponds to the ``display_video_360_advertiser_link_proposal`` 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, @@ -5163,34 +4242,46 @@ async def sample_update_conversion_event(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ConversionEvent: - A conversion event in a Google - Analytics property. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: + A proposal for a link between a GA4 + property and a Display & Video 360 + advertiser. + + A proposal is converted to a + DisplayVideo360AdvertiserLink once + approved. Google Analytics admins + approve inbound proposals while Display + & Video 360 admins approve outbound + proposals. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([conversion_event, update_mask]) + has_flattened_params = any([parent, display_video_360_advertiser_link_proposal]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateConversionEventRequest(request) + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. - if conversion_event is not None: - request.conversion_event = conversion_event - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent + if display_video_360_advertiser_link_proposal is not None: + request.display_video_360_advertiser_link_proposal = ( + display_video_360_advertiser_link_proposal + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_conversion_event, + self._client._transport.create_display_video360_advertiser_link_proposal, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -5198,9 +4289,7 @@ async def sample_update_conversion_event(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("conversion_event.name", request.conversion_event.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -5214,54 +4303,32 @@ async def sample_update_conversion_event(): # Done; return the response. return response - async def get_conversion_event( + async def delete_display_video360_advertiser_link_proposal( self, request: Optional[ - Union[analytics_admin.GetConversionEventRequest, dict] + Union[ + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, dict + ] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.ConversionEvent: - r"""Retrieve a single conversion event. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetConversionEventRequest( - name="name_value", - ) - - # Make the request - response = await client.get_conversion_event(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a DisplayVideo360AdvertiserLinkProposal on a + property. This can only be used on cancelled proposals. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetConversionEventRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkProposalRequest, dict]]): The request object. Request message for - GetConversionEvent RPC + DeleteDisplayVideo360AdvertiserLinkProposal + RPC. name (:class:`str`): - Required. The resource name of the conversion event to - retrieve. Format: - properties/{property}/conversionEvents/{conversion_event} - Example: "properties/123/conversionEvents/456" + Required. The name of the + DisplayVideo360AdvertiserLinkProposal to + delete. Example format: + properties/1234/displayVideo360AdvertiserLinkProposals/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -5271,12 +4338,6 @@ async def sample_get_conversion_event(): 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.analytics.admin_v1alpha.types.ConversionEvent: - A conversion event in a Google - Analytics property. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -5288,7 +4349,9 @@ async def sample_get_conversion_event(): "the individual field arguments should be set." ) - request = analytics_admin.GetConversionEventRequest(request) + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -5298,7 +4361,7 @@ async def sample_get_conversion_event(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_conversion_event, + self._client._transport.delete_display_video360_advertiser_link_proposal, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -5310,92 +4373,58 @@ async def sample_get_conversion_event(): ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - async def delete_conversion_event( + async def approve_display_video360_advertiser_link_proposal( self, request: Optional[ - Union[analytics_admin.DeleteConversionEventRequest, dict] + Union[ + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, + dict, + ] ] = None, *, - name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a conversion event in a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteConversionEventRequest( - name="name_value", - ) - - # Make the request - await client.delete_conversion_event(request=request) + ) -> analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse: + r"""Approves a DisplayVideo360AdvertiserLinkProposal. + The DisplayVideo360AdvertiserLinkProposal will be + deleted and a new DisplayVideo360AdvertiserLink will be + created. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteConversionEventRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalRequest, dict]]): The request object. Request message for - DeleteConversionEvent RPC - name (:class:`str`): - Required. The resource name of the conversion event to - delete. Format: - properties/{property}/conversionEvents/{conversion_event} - Example: "properties/123/conversionEvents/456" - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + ApproveDisplayVideo360AdvertiserLinkProposal + RPC. 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. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - request = analytics_admin.DeleteConversionEventRequest(request) + Returns: + google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalResponse: + Response message for + ApproveDisplayVideo360AdvertiserLinkProposal + RPC. - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name + """ + # Create or coerce a protobuf request object. + request = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest( + request + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_conversion_event, + self._client._transport.approve_display_video360_advertiser_link_proposal, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -5407,67 +4436,124 @@ async def sample_delete_conversion_event(): ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def list_conversion_events( + # Done; return the response. + return response + + async def cancel_display_video360_advertiser_link_proposal( self, request: Optional[ - Union[analytics_admin.ListConversionEventsRequest, dict] + Union[ + analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, dict + ] ] = None, *, - parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListConversionEventsAsyncPager: - r"""Returns a list of conversion events in the specified - parent property. - Returns an empty list if no conversion events are found. + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Cancels a DisplayVideo360AdvertiserLinkProposal. + Cancelling can mean either: + + - Declining a proposal initiated from Display & Video + 360 + - Withdrawing a proposal initiated from Google Analytics + After being cancelled, a proposal will eventually be + deleted automatically. + + Args: + request (Optional[Union[google.analytics.admin_v1alpha.types.CancelDisplayVideo360AdvertiserLinkProposalRequest, dict]]): + The request object. Request message for + CancelDisplayVideo360AdvertiserLinkProposal + RPC. + 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.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: + A proposal for a link between a GA4 + property and a Display & Video 360 + advertiser. - .. code-block:: python + A proposal is converted to a + DisplayVideo360AdvertiserLink once + approved. Google Analytics admins + approve inbound proposals while Display + & Video 360 admins approve outbound + proposals. - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha + """ + # Create or coerce a protobuf request object. + request = analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest( + request + ) - async def sample_list_conversion_events(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.cancel_display_video360_advertiser_link_proposal, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) - # Initialize request argument(s) - request = admin_v1alpha.ListConversionEventsRequest( - parent="parent_value", - ) + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) - # Make the request - page_result = client.list_conversion_events(request=request) + # Done; return the response. + return response - # Handle the response - async for response in page_result: - print(response) + async def create_custom_dimension( + self, + request: Optional[ + Union[analytics_admin.CreateCustomDimensionRequest, dict] + ] = None, + *, + parent: Optional[str] = None, + custom_dimension: Optional[resources.CustomDimension] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CustomDimension: + r"""Creates a CustomDimension. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListConversionEventsRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateCustomDimensionRequest, dict]]): The request object. Request message for - ListConversionEvents RPC + CreateCustomDimension RPC. parent (:class:`str`): - Required. The resource name of the - parent property. Example: - 'properties/123' + Required. Example format: + properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. + custom_dimension (:class:`google.analytics.admin_v1alpha.types.CustomDimension`): + Required. The CustomDimension to + create. + + This corresponds to the ``custom_dimension`` 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. @@ -5475,35 +4561,32 @@ async def sample_list_conversion_events(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListConversionEventsAsyncPager: - Response message for - ListConversionEvents RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. - + google.analytics.admin_v1alpha.types.CustomDimension: + A definition for a CustomDimension. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([parent, custom_dimension]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.ListConversionEventsRequest(request) + request = analytics_admin.CreateCustomDimensionRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent + if custom_dimension is not None: + request.custom_dimension = custom_dimension # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_conversion_events, + self._client._transport.create_custom_dimension, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -5522,68 +4605,39 @@ async def sample_list_conversion_events(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListConversionEventsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - async def get_display_video360_advertiser_link( + async def update_custom_dimension( self, request: Optional[ - Union[analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, dict] + Union[analytics_admin.UpdateCustomDimensionRequest, dict] ] = None, *, - name: Optional[str] = None, + custom_dimension: Optional[resources.CustomDimension] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLink: - r"""Look up a single DisplayVideo360AdvertiserLink - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDisplayVideo360AdvertiserLinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_display_video360_advertiser_link(request=request) - - # Handle the response - print(response) + ) -> resources.CustomDimension: + r"""Updates a CustomDimension on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateCustomDimensionRequest, dict]]): The request object. Request message for - GetDisplayVideo360AdvertiserLink RPC. - name (:class:`str`): - Required. The name of the - DisplayVideo360AdvertiserLink to get. - Example format: - properties/1234/displayVideo360AdvertiserLink/5678 + UpdateCustomDimension RPC. + custom_dimension (:class:`google.analytics.admin_v1alpha.types.CustomDimension`): + The CustomDimension to update + This corresponds to the ``custom_dimension`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. - This corresponds to the ``name`` field + This corresponds to the ``update_mask`` 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, @@ -5593,32 +4647,32 @@ async def sample_get_display_video360_advertiser_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: - A link between a GA4 property and a - Display & Video 360 advertiser. - + google.analytics.admin_v1alpha.types.CustomDimension: + A definition for a CustomDimension. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([custom_dimension, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(request) + request = analytics_admin.UpdateCustomDimensionRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if custom_dimension is not None: + request.custom_dimension = custom_dimension + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_display_video360_advertiser_link, + self._client._transport.update_custom_dimension, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -5626,7 +4680,9 @@ async def sample_get_display_video360_advertiser_link(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + (("custom_dimension.name", request.custom_dimension.name),) + ), ) # Send the request. @@ -5640,51 +4696,23 @@ async def sample_get_display_video360_advertiser_link(): # Done; return the response. return response - async def list_display_video360_advertiser_links( + async def list_custom_dimensions( self, request: Optional[ - Union[analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, dict] + Union[analytics_admin.ListCustomDimensionsRequest, dict] ] = None, *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListDisplayVideo360AdvertiserLinksAsyncPager: - r"""Lists all DisplayVideo360AdvertiserLinks on a - property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_display_video360_advertiser_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListDisplayVideo360AdvertiserLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_display_video360_advertiser_links(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> pagers.ListCustomDimensionsAsyncPager: + r"""Lists CustomDimensions on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ListCustomDimensionsRequest, dict]]): The request object. Request message for - ListDisplayVideo360AdvertiserLinks RPC. + ListCustomDimensions RPC. parent (:class:`str`): Required. Example format: properties/1234 @@ -5699,9 +4727,9 @@ async def sample_list_display_video360_advertiser_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinksAsyncPager: + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomDimensionsAsyncPager: Response message for - ListDisplayVideo360AdvertiserLinks RPC. + ListCustomDimensions RPC. Iterating over this object will yield results and resolve additional pages automatically. @@ -5717,7 +4745,7 @@ async def sample_list_display_video360_advertiser_links(): "the individual field arguments should be set." ) - request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(request) + request = analytics_admin.ListCustomDimensionsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -5727,7 +4755,7 @@ async def sample_list_display_video360_advertiser_links(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_display_video360_advertiser_links, + self._client._transport.list_custom_dimensions, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -5748,7 +4776,7 @@ async def sample_list_display_video360_advertiser_links(): # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. - response = pagers.ListDisplayVideo360AdvertiserLinksAsyncPager( + response = pagers.ListCustomDimensionsAsyncPager( method=rpc, request=request, response=response, @@ -5758,69 +4786,30 @@ async def sample_list_display_video360_advertiser_links(): # Done; return the response. return response - async def create_display_video360_advertiser_link( + async def archive_custom_dimension( self, request: Optional[ - Union[analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, dict] + Union[analytics_admin.ArchiveCustomDimensionRequest, dict] ] = None, *, - parent: Optional[str] = None, - display_video_360_advertiser_link: Optional[ - resources.DisplayVideo360AdvertiserLink - ] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLink: - r"""Creates a DisplayVideo360AdvertiserLink. - This can only be utilized by users who have proper - authorization both on the Google Analytics property and - on the Display & Video 360 advertiser. Users who do not - have access to the Display & Video 360 advertiser should - instead seek to create a DisplayVideo360LinkProposal. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateDisplayVideo360AdvertiserLinkRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_display_video360_advertiser_link(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Archives a CustomDimension on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ArchiveCustomDimensionRequest, dict]]): The request object. Request message for - CreateDisplayVideo360AdvertiserLink RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - display_video_360_advertiser_link (:class:`google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink`): - Required. The - DisplayVideo360AdvertiserLink to create. + ArchiveCustomDimension RPC. + name (:class:`str`): + Required. The name of the + CustomDimension to archive. Example + format: + properties/1234/customDimensions/5678 - This corresponds to the ``display_video_360_advertiser_link`` field + This corresponds to the ``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, @@ -5828,38 +4817,28 @@ async def sample_create_display_video360_advertiser_link(): 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.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: - A link between a GA4 property and a - Display & Video 360 advertiser. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, display_video_360_advertiser_link]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(request) + request = analytics_admin.ArchiveCustomDimensionRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if display_video_360_advertiser_link is not None: - request.display_video_360_advertiser_link = ( - display_video_360_advertiser_link - ) + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_display_video360_advertiser_link, + self._client._transport.archive_custom_dimension, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -5867,66 +4846,38 @@ async def sample_create_display_video360_advertiser_link(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - async def delete_display_video360_advertiser_link( + async def get_custom_dimension( self, request: Optional[ - Union[analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, dict] + Union[analytics_admin.GetCustomDimensionRequest, dict] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a DisplayVideo360AdvertiserLink on a - property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteDisplayVideo360AdvertiserLinkRequest( - name="name_value", - ) - - # Make the request - await client.delete_display_video360_advertiser_link(request=request) + ) -> resources.CustomDimension: + r"""Lookup for a single CustomDimension. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.GetCustomDimensionRequest, dict]]): The request object. Request message for - DeleteDisplayVideo360AdvertiserLink RPC. + GetCustomDimension RPC. name (:class:`str`): Required. The name of the - DisplayVideo360AdvertiserLink to delete. - Example format: - properties/1234/displayVideo360AdvertiserLinks/5678 + CustomDimension to get. Example format: + properties/1234/customDimensions/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -5936,6 +4887,10 @@ async def sample_delete_display_video360_advertiser_link(): 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.analytics.admin_v1alpha.types.CustomDimension: + A definition for a CustomDimension. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -5947,7 +4902,7 @@ async def sample_delete_display_video360_advertiser_link(): "the individual field arguments should be set." ) - request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(request) + request = analytics_admin.GetCustomDimensionRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -5957,7 +4912,7 @@ async def sample_delete_display_video360_advertiser_link(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_display_video360_advertiser_link, + self._client._transport.get_custom_dimension, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -5969,73 +4924,44 @@ async def sample_delete_display_video360_advertiser_link(): ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def update_display_video360_advertiser_link( + # Done; return the response. + return response + + async def create_custom_metric( self, request: Optional[ - Union[analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, dict] + Union[analytics_admin.CreateCustomMetricRequest, dict] ] = None, *, - display_video_360_advertiser_link: Optional[ - resources.DisplayVideo360AdvertiserLink - ] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, + custom_metric: Optional[resources.CustomMetric] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLink: - r"""Updates a DisplayVideo360AdvertiserLink on a - property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateDisplayVideo360AdvertiserLinkRequest( - ) - - # Make the request - response = await client.update_display_video360_advertiser_link(request=request) - - # Handle the response - print(response) + ) -> resources.CustomMetric: + r"""Creates a CustomMetric. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateDisplayVideo360AdvertiserLinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateCustomMetricRequest, dict]]): The request object. Request message for - UpdateDisplayVideo360AdvertiserLink RPC. - display_video_360_advertiser_link (:class:`google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink`): - The DisplayVideo360AdvertiserLink to - update + CreateCustomMetric RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 - This corresponds to the ``display_video_360_advertiser_link`` field + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. - - This corresponds to the ``update_mask`` field + custom_metric (:class:`google.analytics.admin_v1alpha.types.CustomMetric`): + Required. The CustomMetric to create. + This corresponds to the ``custom_metric`` 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, @@ -6045,36 +4971,32 @@ async def sample_update_display_video360_advertiser_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: - A link between a GA4 property and a - Display & Video 360 advertiser. - - """ + google.analytics.admin_v1alpha.types.CustomMetric: + A definition for a custom metric. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([display_video_360_advertiser_link, update_mask]) + has_flattened_params = any([parent, custom_metric]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(request) + request = analytics_admin.CreateCustomMetricRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if display_video_360_advertiser_link is not None: - request.display_video_360_advertiser_link = ( - display_video_360_advertiser_link - ) - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent + if custom_metric is not None: + request.custom_metric = custom_metric # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_display_video360_advertiser_link, + self._client._transport.create_custom_metric, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -6082,14 +5004,7 @@ async def sample_update_display_video360_advertiser_link(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "display_video_360_advertiser_link.name", - request.display_video_360_advertiser_link.name, - ), - ) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -6103,58 +5018,36 @@ async def sample_update_display_video360_advertiser_link(): # Done; return the response. return response - async def get_display_video360_advertiser_link_proposal( + async def update_custom_metric( self, request: Optional[ - Union[analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, dict] + Union[analytics_admin.UpdateCustomMetricRequest, dict] ] = None, *, - name: Optional[str] = None, + custom_metric: Optional[resources.CustomMetric] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLinkProposal: - r"""Lookup for a single - DisplayVideo360AdvertiserLinkProposal. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - response = await client.get_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) + ) -> resources.CustomMetric: + r"""Updates a CustomMetric on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkProposalRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateCustomMetricRequest, dict]]): The request object. Request message for - GetDisplayVideo360AdvertiserLinkProposal - RPC. - name (:class:`str`): - Required. The name of the - DisplayVideo360AdvertiserLinkProposal to - get. Example format: - properties/1234/displayVideo360AdvertiserLinkProposals/5678 + UpdateCustomMetric RPC. + custom_metric (:class:`google.analytics.admin_v1alpha.types.CustomMetric`): + The CustomMetric to update + This corresponds to the ``custom_metric`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. - This corresponds to the ``name`` field + This corresponds to the ``update_mask`` 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, @@ -6164,42 +5057,32 @@ async def sample_get_display_video360_advertiser_link_proposal(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: - A proposal for a link between a GA4 - property and a Display & Video 360 - advertiser. - - A proposal is converted to a - DisplayVideo360AdvertiserLink once - approved. Google Analytics admins - approve inbound proposals while Display - & Video 360 admins approve outbound - proposals. - + google.analytics.admin_v1alpha.types.CustomMetric: + A definition for a custom metric. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([custom_metric, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest( - request - ) + request = analytics_admin.UpdateCustomMetricRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if custom_metric is not None: + request.custom_metric = custom_metric + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_display_video360_advertiser_link_proposal, + self._client._transport.update_custom_metric, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -6207,7 +5090,9 @@ async def sample_get_display_video360_advertiser_link_proposal(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + (("custom_metric.name", request.custom_metric.name),) + ), ) # Send the request. @@ -6221,53 +5106,20 @@ async def sample_get_display_video360_advertiser_link_proposal(): # Done; return the response. return response - async def list_display_video360_advertiser_link_proposals( + async def list_custom_metrics( self, - request: Optional[ - Union[ - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, dict - ] - ] = None, + request: Optional[Union[analytics_admin.ListCustomMetricsRequest, dict]] = None, *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager: - r"""Lists DisplayVideo360AdvertiserLinkProposals on a - property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_display_video360_advertiser_link_proposals(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListDisplayVideo360AdvertiserLinkProposalsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_display_video360_advertiser_link_proposals(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> pagers.ListCustomMetricsAsyncPager: + r"""Lists CustomMetrics on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsRequest, dict]]): - The request object. Request message for - ListDisplayVideo360AdvertiserLinkProposals + request (Optional[Union[google.analytics.admin_v1alpha.types.ListCustomMetricsRequest, dict]]): + The request object. Request message for ListCustomMetrics RPC. parent (:class:`str`): Required. Example format: @@ -6283,12 +5135,12 @@ async def sample_list_display_video360_advertiser_link_proposals(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager: + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomMetricsAsyncPager: Response message for - ListDisplayVideo360AdvertiserLinkProposals - RPC. Iterating over this object will - yield results and resolve additional - pages automatically. + ListCustomMetrics RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. @@ -6301,9 +5153,7 @@ async def sample_list_display_video360_advertiser_link_proposals(): "the individual field arguments should be set." ) - request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest( - request - ) + request = analytics_admin.ListCustomMetricsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -6313,7 +5163,7 @@ async def sample_list_display_video360_advertiser_link_proposals(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_display_video360_advertiser_link_proposals, + self._client._transport.list_custom_metrics, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -6334,7 +5184,7 @@ async def sample_list_display_video360_advertiser_link_proposals(): # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. - response = pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager( + response = pagers.ListCustomMetricsAsyncPager( method=rpc, request=request, response=response, @@ -6344,68 +5194,29 @@ async def sample_list_display_video360_advertiser_link_proposals(): # Done; return the response. return response - async def create_display_video360_advertiser_link_proposal( + async def archive_custom_metric( self, request: Optional[ - Union[ - analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, dict - ] + Union[analytics_admin.ArchiveCustomMetricRequest, dict] ] = None, *, - parent: Optional[str] = None, - display_video_360_advertiser_link_proposal: Optional[ - resources.DisplayVideo360AdvertiserLinkProposal - ] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLinkProposal: - r"""Creates a DisplayVideo360AdvertiserLinkProposal. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateDisplayVideo360AdvertiserLinkProposalRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Archives a CustomMetric on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkProposalRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ArchiveCustomMetricRequest, dict]]): The request object. Request message for - CreateDisplayVideo360AdvertiserLinkProposal - RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - display_video_360_advertiser_link_proposal (:class:`google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal`): - Required. The - DisplayVideo360AdvertiserLinkProposal to - create. + ArchiveCustomMetric RPC. + name (:class:`str`): + Required. The name of the + CustomMetric to archive. Example format: + properties/1234/customMetrics/5678 - This corresponds to the ``display_video_360_advertiser_link_proposal`` field + This corresponds to the ``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, @@ -6413,48 +5224,28 @@ async def sample_create_display_video360_advertiser_link_proposal(): 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.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: - A proposal for a link between a GA4 - property and a Display & Video 360 - advertiser. - - A proposal is converted to a - DisplayVideo360AdvertiserLink once - approved. Google Analytics admins - approve inbound proposals while Display - & Video 360 admins approve outbound - proposals. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, display_video_360_advertiser_link_proposal]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest( - request - ) + request = analytics_admin.ArchiveCustomMetricRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if display_video_360_advertiser_link_proposal is not None: - request.display_video_360_advertiser_link_proposal = ( - display_video_360_advertiser_link_proposal - ) + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_display_video360_advertiser_link_proposal, + self._client._transport.archive_custom_metric, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -6462,69 +5253,36 @@ async def sample_create_display_video360_advertiser_link_proposal(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - async def delete_display_video360_advertiser_link_proposal( + async def get_custom_metric( self, - request: Optional[ - Union[ - analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, dict - ] - ] = None, + request: Optional[Union[analytics_admin.GetCustomMetricRequest, dict]] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a DisplayVideo360AdvertiserLinkProposal on a - property. This can only be used on cancelled proposals. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - await client.delete_display_video360_advertiser_link_proposal(request=request) + ) -> resources.CustomMetric: + r"""Lookup for a single CustomMetric. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkProposalRequest, dict]]): - The request object. Request message for - DeleteDisplayVideo360AdvertiserLinkProposal + request (Optional[Union[google.analytics.admin_v1alpha.types.GetCustomMetricRequest, dict]]): + The request object. Request message for GetCustomMetric RPC. name (:class:`str`): Required. The name of the - DisplayVideo360AdvertiserLinkProposal to - delete. Example format: - properties/1234/displayVideo360AdvertiserLinkProposals/5678 + CustomMetric to get. Example format: + properties/1234/customMetrics/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -6534,8 +5292,12 @@ async def sample_delete_display_video360_advertiser_link_proposal(): 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. + + Returns: + google.analytics.admin_v1alpha.types.CustomMetric: + A definition for a custom metric. + """ + # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. has_flattened_params = any([name]) @@ -6545,9 +5307,7 @@ async def sample_delete_display_video360_advertiser_link_proposal(): "the individual field arguments should be set." ) - request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest( - request - ) + request = analytics_admin.GetCustomMetricRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -6557,7 +5317,7 @@ async def sample_delete_display_video360_advertiser_link_proposal(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_display_video360_advertiser_link_proposal, + self._client._transport.get_custom_metric, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -6569,62 +5329,45 @@ async def sample_delete_display_video360_advertiser_link_proposal(): ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def approve_display_video360_advertiser_link_proposal( + # Done; return the response. + return response + + async def get_data_retention_settings( self, request: Optional[ - Union[ - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, - dict, - ] + Union[analytics_admin.GetDataRetentionSettingsRequest, dict] ] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse: - r"""Approves a DisplayVideo360AdvertiserLinkProposal. - The DisplayVideo360AdvertiserLinkProposal will be - deleted and a new DisplayVideo360AdvertiserLink will be - created. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_approve_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ApproveDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - response = await client.approve_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) + ) -> resources.DataRetentionSettings: + r"""Returns the singleton data retention settings for + this property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.GetDataRetentionSettingsRequest, dict]]): The request object. Request message for - ApproveDisplayVideo360AdvertiserLinkProposal - RPC. + GetDataRetentionSettings RPC. + name (:class:`str`): + Required. The name of the settings to + lookup. Format: + + properties/{property}/dataRetentionSettings + Example: + "properties/1000/dataRetentionSettings" + + This corresponds to the ``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. @@ -6632,21 +5375,32 @@ async def sample_approve_display_video360_advertiser_link_proposal(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalResponse: - Response message for - ApproveDisplayVideo360AdvertiserLinkProposal - RPC. + google.analytics.admin_v1alpha.types.DataRetentionSettings: + Settings values for data retention. + This is a singleton resource. """ # Create or coerce a protobuf request object. - request = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest( - request - ) + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.GetDataRetentionSettingsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.approve_display_video360_advertiser_link_proposal, + self._client._transport.get_data_retention_settings, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -6668,58 +5422,42 @@ async def sample_approve_display_video360_advertiser_link_proposal(): # Done; return the response. return response - async def cancel_display_video360_advertiser_link_proposal( + async def update_data_retention_settings( self, request: Optional[ - Union[ - analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, dict - ] + Union[analytics_admin.UpdateDataRetentionSettingsRequest, dict] ] = None, *, + data_retention_settings: Optional[resources.DataRetentionSettings] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLinkProposal: - r"""Cancels a DisplayVideo360AdvertiserLinkProposal. - Cancelling can mean either: - - - Declining a proposal initiated from Display & Video - 360 - - Withdrawing a proposal initiated from Google Analytics - After being cancelled, a proposal will eventually be - deleted automatically. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_cancel_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CancelDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - response = await client.cancel_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) + ) -> resources.DataRetentionSettings: + r"""Updates the singleton data retention settings for + this property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CancelDisplayVideo360AdvertiserLinkProposalRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateDataRetentionSettingsRequest, dict]]): The request object. Request message for - CancelDisplayVideo360AdvertiserLinkProposal - RPC. + UpdateDataRetentionSettings RPC. + data_retention_settings (:class:`google.analytics.admin_v1alpha.types.DataRetentionSettings`): + Required. The settings to update. The ``name`` field is + used to identify the settings to be updated. + + This corresponds to the ``data_retention_settings`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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. @@ -6727,28 +5465,34 @@ async def sample_cancel_display_video360_advertiser_link_proposal(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: - A proposal for a link between a GA4 - property and a Display & Video 360 - advertiser. - - A proposal is converted to a - DisplayVideo360AdvertiserLink once - approved. Google Analytics admins - approve inbound proposals while Display - & Video 360 admins approve outbound - proposals. + google.analytics.admin_v1alpha.types.DataRetentionSettings: + Settings values for data retention. + This is a singleton resource. """ # Create or coerce a protobuf request object. - request = analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest( - request - ) + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([data_retention_settings, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.UpdateDataRetentionSettingsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if data_retention_settings is not None: + request.data_retention_settings = data_retention_settings + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.cancel_display_video360_advertiser_link_proposal, + self._client._transport.update_data_retention_settings, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -6756,7 +5500,14 @@ async def sample_cancel_display_video360_advertiser_link_proposal(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "data_retention_settings.name", + request.data_retention_settings.name, + ), + ) + ), ) # Send the request. @@ -6770,56 +5521,22 @@ async def sample_cancel_display_video360_advertiser_link_proposal(): # Done; return the response. return response - async def create_custom_dimension( + async def create_data_stream( self, - request: Optional[ - Union[analytics_admin.CreateCustomDimensionRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.CreateDataStreamRequest, dict]] = None, *, parent: Optional[str] = None, - custom_dimension: Optional[resources.CustomDimension] = None, + data_stream: Optional[resources.DataStream] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomDimension: - r"""Creates a CustomDimension. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - custom_dimension = admin_v1alpha.CustomDimension() - custom_dimension.parameter_name = "parameter_name_value" - custom_dimension.display_name = "display_name_value" - custom_dimension.scope = "ITEM" - - request = admin_v1alpha.CreateCustomDimensionRequest( - parent="parent_value", - custom_dimension=custom_dimension, - ) - - # Make the request - response = await client.create_custom_dimension(request=request) - - # Handle the response - print(response) + ) -> resources.DataStream: + r"""Creates a DataStream. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateCustomDimensionRequest, dict]]): - The request object. Request message for - CreateCustomDimension RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateDataStreamRequest, dict]]): + The request object. Request message for CreateDataStream + RPC. parent (:class:`str`): Required. Example format: properties/1234 @@ -6827,11 +5544,9 @@ async def sample_create_custom_dimension(): This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - custom_dimension (:class:`google.analytics.admin_v1alpha.types.CustomDimension`): - Required. The CustomDimension to - create. - - This corresponds to the ``custom_dimension`` field + data_stream (:class:`google.analytics.admin_v1alpha.types.DataStream`): + Required. The DataStream to create. + This corresponds to the ``data_stream`` 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, @@ -6841,32 +5556,34 @@ async def sample_create_custom_dimension(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomDimension: - A definition for a CustomDimension. + google.analytics.admin_v1alpha.types.DataStream: + A resource message representing a + data stream. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, custom_dimension]) + has_flattened_params = any([parent, data_stream]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateCustomDimensionRequest(request) + request = analytics_admin.CreateDataStreamRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if custom_dimension is not None: - request.custom_dimension = custom_dimension + if data_stream is not None: + request.data_stream = data_stream # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_custom_dimension, + self._client._transport.create_data_stream, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -6888,59 +5605,100 @@ async def sample_create_custom_dimension(): # Done; return the response. return response - async def update_custom_dimension( + async def delete_data_stream( self, - request: Optional[ - Union[analytics_admin.UpdateCustomDimensionRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.DeleteDataStreamRequest, dict]] = None, *, - custom_dimension: Optional[resources.CustomDimension] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomDimension: - r"""Updates a CustomDimension on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateCustomDimensionRequest( - ) - - # Make the request - response = await client.update_custom_dimension(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a DataStream on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateCustomDimensionRequest, dict]]): - The request object. Request message for - UpdateCustomDimension RPC. - custom_dimension (:class:`google.analytics.admin_v1alpha.types.CustomDimension`): - The CustomDimension to update - This corresponds to the ``custom_dimension`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteDataStreamRequest, dict]]): + The request object. Request message for DeleteDataStream + RPC. + name (:class:`str`): + Required. The name of the DataStream + to delete. Example format: + properties/1234/dataStreams/5678 + + This corresponds to the ``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. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.DeleteDataStreamRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_data_stream, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def update_data_stream( + self, + request: Optional[Union[analytics_admin.UpdateDataStreamRequest, dict]] = None, + *, + data_stream: Optional[resources.DataStream] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DataStream: + r"""Updates a DataStream on a property. + + Args: + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateDataStreamRequest, dict]]): + The request object. Request message for UpdateDataStream + RPC. + data_stream (:class:`google.analytics.admin_v1alpha.types.DataStream`): + The DataStream to update + This corresponds to the ``data_stream`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this @@ -6952,32 +5710,34 @@ async def sample_update_custom_dimension(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomDimension: - A definition for a CustomDimension. + google.analytics.admin_v1alpha.types.DataStream: + A resource message representing a + data stream. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([custom_dimension, update_mask]) + has_flattened_params = any([data_stream, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateCustomDimensionRequest(request) + request = analytics_admin.UpdateDataStreamRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if custom_dimension is not None: - request.custom_dimension = custom_dimension + if data_stream is not None: + request.data_stream = data_stream if update_mask is not None: request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_custom_dimension, + self._client._transport.update_data_stream, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -6986,7 +5746,7 @@ async def sample_update_custom_dimension(): # add these here. metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata( - (("custom_dimension.name", request.custom_dimension.name),) + (("data_stream.name", request.data_stream.name),) ), ) @@ -7001,50 +5761,21 @@ async def sample_update_custom_dimension(): # Done; return the response. return response - async def list_custom_dimensions( + async def list_data_streams( self, - request: Optional[ - Union[analytics_admin.ListCustomDimensionsRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.ListDataStreamsRequest, dict]] = None, *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCustomDimensionsAsyncPager: - r"""Lists CustomDimensions on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_custom_dimensions(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListCustomDimensionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_custom_dimensions(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> pagers.ListDataStreamsAsyncPager: + r"""Lists DataStreams on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListCustomDimensionsRequest, dict]]): - The request object. Request message for - ListCustomDimensions RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.ListDataStreamsRequest, dict]]): + The request object. Request message for ListDataStreams + RPC. parent (:class:`str`): Required. Example format: properties/1234 @@ -7059,9 +5790,9 @@ async def sample_list_custom_dimensions(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomDimensionsAsyncPager: - Response message for - ListCustomDimensions RPC. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDataStreamsAsyncPager: + Response message for ListDataStreams + RPC. Iterating over this object will yield results and resolve additional pages automatically. @@ -7077,7 +5808,7 @@ async def sample_list_custom_dimensions(): "the individual field arguments should be set." ) - request = analytics_admin.ListCustomDimensionsRequest(request) + request = analytics_admin.ListDataStreamsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -7087,7 +5818,7 @@ async def sample_list_custom_dimensions(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_custom_dimensions, + self._client._transport.list_data_streams, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -7108,7 +5839,7 @@ async def sample_list_custom_dimensions(): # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. - response = pagers.ListCustomDimensionsAsyncPager( + response = pagers.ListDataStreamsAsyncPager( method=rpc, request=request, response=response, @@ -7118,51 +5849,25 @@ async def sample_list_custom_dimensions(): # Done; return the response. return response - async def archive_custom_dimension( + async def get_data_stream( self, - request: Optional[ - Union[analytics_admin.ArchiveCustomDimensionRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.GetDataStreamRequest, dict]] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Archives a CustomDimension on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_archive_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ArchiveCustomDimensionRequest( - name="name_value", - ) - - # Make the request - await client.archive_custom_dimension(request=request) + ) -> resources.DataStream: + r"""Lookup for a single DataStream. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ArchiveCustomDimensionRequest, dict]]): - The request object. Request message for - ArchiveCustomDimension RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.GetDataStreamRequest, dict]]): + The request object. Request message for GetDataStream + RPC. name (:class:`str`): - Required. The name of the - CustomDimension to archive. Example - format: - properties/1234/customDimensions/5678 + Required. The name of the DataStream + to get. Example format: + properties/1234/dataStreams/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -7172,6 +5877,12 @@ async def sample_archive_custom_dimension(): 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.analytics.admin_v1alpha.types.DataStream: + A resource message representing a + data stream. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -7183,7 +5894,7 @@ async def sample_archive_custom_dimension(): "the individual field arguments should be set." ) - request = analytics_admin.ArchiveCustomDimensionRequest(request) + request = analytics_admin.GetDataStreamRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -7193,7 +5904,7 @@ async def sample_archive_custom_dimension(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.archive_custom_dimension, + self._client._transport.get_data_stream, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -7205,60 +5916,36 @@ async def sample_archive_custom_dimension(): ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def get_custom_dimension( + # Done; return the response. + return response + + async def get_audience( self, - request: Optional[ - Union[analytics_admin.GetCustomDimensionRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.GetAudienceRequest, dict]] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomDimension: - r"""Lookup for a single CustomDimension. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetCustomDimensionRequest( - name="name_value", - ) - - # Make the request - response = await client.get_custom_dimension(request=request) - - # Handle the response - print(response) + ) -> audience.Audience: + r"""Lookup for a single Audience. + Audiences created before 2020 may not be supported. + Default audiences will not show filter definitions. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetCustomDimensionRequest, dict]]): - The request object. Request message for - GetCustomDimension RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.GetAudienceRequest, dict]]): + The request object. Request message for GetAudience RPC. name (:class:`str`): - Required. The name of the - CustomDimension to get. Example format: - properties/1234/customDimensions/5678 + Required. The name of the Audience to + get. Example format: + properties/1234/audiences/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -7270,8 +5957,10 @@ async def sample_get_custom_dimension(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomDimension: - A definition for a CustomDimension. + google.analytics.admin_v1alpha.types.Audience: + A resource message representing a GA4 + Audience. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -7283,7 +5972,7 @@ async def sample_get_custom_dimension(): "the individual field arguments should be set." ) - request = analytics_admin.GetCustomDimensionRequest(request) + request = analytics_admin.GetAudienceRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -7293,7 +5982,7 @@ async def sample_get_custom_dimension(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_custom_dimension, + self._client._transport.get_audience, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -7315,57 +6004,23 @@ async def sample_get_custom_dimension(): # Done; return the response. return response - async def create_custom_metric( + async def list_audiences( self, - request: Optional[ - Union[analytics_admin.CreateCustomMetricRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.ListAudiencesRequest, dict]] = None, *, parent: Optional[str] = None, - custom_metric: Optional[resources.CustomMetric] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomMetric: - r"""Creates a CustomMetric. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - custom_metric = admin_v1alpha.CustomMetric() - custom_metric.parameter_name = "parameter_name_value" - custom_metric.display_name = "display_name_value" - custom_metric.measurement_unit = "HOURS" - custom_metric.scope = "EVENT" - - request = admin_v1alpha.CreateCustomMetricRequest( - parent="parent_value", - custom_metric=custom_metric, - ) - - # Make the request - response = await client.create_custom_metric(request=request) - - # Handle the response - print(response) + ) -> pagers.ListAudiencesAsyncPager: + r"""Lists Audiences on a property. + Audiences created before 2020 may not be supported. + Default audiences will not show filter definitions. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateCustomMetricRequest, dict]]): - The request object. Request message for - CreateCustomMetric RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.ListAudiencesRequest, dict]]): + The request object. Request message for ListAudiences + RPC. parent (:class:`str`): Required. Example format: properties/1234 @@ -7373,11 +6028,6 @@ async def sample_create_custom_metric(): This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - custom_metric (:class:`google.analytics.admin_v1alpha.types.CustomMetric`): - Required. The CustomMetric to create. - This corresponds to the ``custom_metric`` 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. @@ -7385,32 +6035,35 @@ async def sample_create_custom_metric(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomMetric: - A definition for a custom metric. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAudiencesAsyncPager: + Response message for ListAudiences + RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, custom_metric]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateCustomMetricRequest(request) + request = analytics_admin.ListAudiencesRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if custom_metric is not None: - request.custom_metric = custom_metric # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_custom_metric, + self._client._transport.list_audiences, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -7429,64 +6082,44 @@ async def sample_create_custom_metric(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListAudiencesAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - async def update_custom_metric( + async def create_audience( self, - request: Optional[ - Union[analytics_admin.UpdateCustomMetricRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.CreateAudienceRequest, dict]] = None, *, - custom_metric: Optional[resources.CustomMetric] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, + audience: Optional[gaa_audience.Audience] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomMetric: - r"""Updates a CustomMetric on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateCustomMetricRequest( - ) - - # Make the request - response = await client.update_custom_metric(request=request) - - # Handle the response - print(response) + ) -> gaa_audience.Audience: + r"""Creates an Audience. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateCustomMetricRequest, dict]]): - The request object. Request message for - UpdateCustomMetric RPC. - custom_metric (:class:`google.analytics.admin_v1alpha.types.CustomMetric`): - The CustomMetric to update - This corresponds to the ``custom_metric`` field + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateAudienceRequest, dict]]): + The request object. Request message for CreateAudience + RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 + + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. - - This corresponds to the ``update_mask`` field + audience (:class:`google.analytics.admin_v1alpha.types.Audience`): + Required. The audience to create. + This corresponds to the ``audience`` 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, @@ -7496,32 +6129,34 @@ async def sample_update_custom_metric(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomMetric: - A definition for a custom metric. + google.analytics.admin_v1alpha.types.Audience: + A resource message representing a GA4 + Audience. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([custom_metric, update_mask]) + has_flattened_params = any([parent, audience]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateCustomMetricRequest(request) + request = analytics_admin.CreateAudienceRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if custom_metric is not None: - request.custom_metric = custom_metric - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent + if audience is not None: + request.audience = audience # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_custom_metric, + self._client._transport.create_audience, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -7529,9 +6164,7 @@ async def sample_update_custom_metric(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("custom_metric.name", request.custom_metric.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -7545,53 +6178,38 @@ async def sample_update_custom_metric(): # Done; return the response. return response - async def list_custom_metrics( + async def update_audience( self, - request: Optional[Union[analytics_admin.ListCustomMetricsRequest, dict]] = None, + request: Optional[Union[analytics_admin.UpdateAudienceRequest, dict]] = None, *, - parent: Optional[str] = None, + audience: Optional[gaa_audience.Audience] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCustomMetricsAsyncPager: - r"""Lists CustomMetrics on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_custom_metrics(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListCustomMetricsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_custom_metrics(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> gaa_audience.Audience: + r"""Updates an Audience on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListCustomMetricsRequest, dict]]): - The request object. Request message for ListCustomMetrics + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateAudienceRequest, dict]]): + The request object. Request message for UpdateAudience RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 + audience (:class:`google.analytics.admin_v1alpha.types.Audience`): + Required. The audience to update. The audience's + ``name`` field is used to identify the audience to be + updated. - This corresponds to the ``parent`` field + This corresponds to the ``audience`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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, @@ -7601,35 +6219,34 @@ async def sample_list_custom_metrics(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomMetricsAsyncPager: - Response message for - ListCustomMetrics RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.Audience: + A resource message representing a GA4 + Audience. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([audience, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.ListCustomMetricsRequest(request) + request = analytics_admin.UpdateAudienceRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if audience is not None: + request.audience = audience + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_custom_metrics, + self._client._transport.update_audience, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -7637,7 +6254,9 @@ async def sample_list_custom_metrics(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata( + (("audience.name", request.audience.name),) + ), ) # Send the request. @@ -7648,66 +6267,23 @@ async def sample_list_custom_metrics(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListCustomMetricsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - async def archive_custom_metric( + async def archive_audience( self, - request: Optional[ - Union[analytics_admin.ArchiveCustomMetricRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.ArchiveAudienceRequest, dict]] = None, *, - name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: - r"""Archives a CustomMetric on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_archive_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ArchiveCustomMetricRequest( - name="name_value", - ) - - # Make the request - await client.archive_custom_metric(request=request) + r"""Archives an Audience on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ArchiveCustomMetricRequest, dict]]): - The request object. Request message for - ArchiveCustomMetric RPC. - name (:class:`str`): - Required. The name of the - CustomMetric to archive. Example format: - properties/1234/customMetrics/5678 - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + request (Optional[Union[google.analytics.admin_v1alpha.types.ArchiveAudienceRequest, dict]]): + The request object. Request message for ArchiveAudience + RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -7715,26 +6291,12 @@ async def sample_archive_custom_metric(): sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.ArchiveCustomMetricRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name + request = analytics_admin.ArchiveAudienceRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.archive_custom_metric, + self._client._transport.archive_audience, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -7753,51 +6315,27 @@ async def sample_archive_custom_metric(): metadata=metadata, ) - async def get_custom_metric( + async def get_search_ads360_link( self, - request: Optional[Union[analytics_admin.GetCustomMetricRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.GetSearchAds360LinkRequest, dict] + ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomMetric: - r"""Lookup for a single CustomMetric. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetCustomMetricRequest( - name="name_value", - ) - - # Make the request - response = await client.get_custom_metric(request=request) - - # Handle the response - print(response) + ) -> resources.SearchAds360Link: + r"""Look up a single SearchAds360Link Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetCustomMetricRequest, dict]]): - The request object. Request message for GetCustomMetric - RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.GetSearchAds360LinkRequest, dict]]): + The request object. Request message for + GetSearchAds360Link RPC. name (:class:`str`): Required. The name of the - CustomMetric to get. Example format: - properties/1234/customMetrics/5678 + SearchAds360Link to get. Example format: + properties/1234/SearchAds360Link/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -7809,8 +6347,10 @@ async def sample_get_custom_metric(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomMetric: - A definition for a custom metric. + google.analytics.admin_v1alpha.types.SearchAds360Link: + A link between a GA4 property and a + Search Ads 360 entity. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -7822,7 +6362,7 @@ async def sample_get_custom_metric(): "the individual field arguments should be set." ) - request = analytics_admin.GetCustomMetricRequest(request) + request = analytics_admin.GetSearchAds360LinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -7832,7 +6372,7 @@ async def sample_get_custom_metric(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_custom_metric, + self._client._transport.get_search_ads360_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -7854,59 +6394,28 @@ async def sample_get_custom_metric(): # Done; return the response. return response - async def get_data_retention_settings( + async def list_search_ads360_links( self, request: Optional[ - Union[analytics_admin.GetDataRetentionSettingsRequest, dict] + Union[analytics_admin.ListSearchAds360LinksRequest, dict] ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DataRetentionSettings: - r"""Returns the singleton data retention settings for - this property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_data_retention_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDataRetentionSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_data_retention_settings(request=request) - - # Handle the response - print(response) + ) -> pagers.ListSearchAds360LinksAsyncPager: + r"""Lists all SearchAds360Links on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetDataRetentionSettingsRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ListSearchAds360LinksRequest, dict]]): The request object. Request message for - GetDataRetentionSettings RPC. - name (:class:`str`): - Required. The name of the settings to - lookup. Format: - - properties/{property}/dataRetentionSettings - Example: - "properties/1000/dataRetentionSettings" + ListSearchAds360Links RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 - This corresponds to the ``name`` field + This corresponds to the ``parent`` 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, @@ -7916,32 +6425,35 @@ async def sample_get_data_retention_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DataRetentionSettings: - Settings values for data retention. - This is a singleton resource. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSearchAds360LinksAsyncPager: + Response message for + ListSearchAds360Links RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetDataRetentionSettingsRequest(request) + request = analytics_admin.ListSearchAds360LinksRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_data_retention_settings, + self._client._transport.list_search_ads360_links, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -7949,7 +6461,7 @@ async def sample_get_data_retention_settings(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -7960,68 +6472,48 @@ async def sample_get_data_retention_settings(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListSearchAds360LinksAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - async def update_data_retention_settings( + async def create_search_ads360_link( self, request: Optional[ - Union[analytics_admin.UpdateDataRetentionSettingsRequest, dict] + Union[analytics_admin.CreateSearchAds360LinkRequest, dict] ] = None, *, - data_retention_settings: Optional[resources.DataRetentionSettings] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, + search_ads_360_link: Optional[resources.SearchAds360Link] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DataRetentionSettings: - r"""Updates the singleton data retention settings for - this property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_data_retention_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateDataRetentionSettingsRequest( - ) - - # Make the request - response = await client.update_data_retention_settings(request=request) - - # Handle the response - print(response) + ) -> resources.SearchAds360Link: + r"""Creates a SearchAds360Link. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateDataRetentionSettingsRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateSearchAds360LinkRequest, dict]]): The request object. Request message for - UpdateDataRetentionSettings RPC. - data_retention_settings (:class:`google.analytics.admin_v1alpha.types.DataRetentionSettings`): - Required. The settings to update. The ``name`` field is - used to identify the settings to be updated. + CreateSearchAds360Link RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 - This corresponds to the ``data_retention_settings`` field + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + search_ads_360_link (:class:`google.analytics.admin_v1alpha.types.SearchAds360Link`): + Required. The SearchAds360Link to + create. - This corresponds to the ``update_mask`` field + This corresponds to the ``search_ads_360_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, @@ -8031,34 +6523,34 @@ async def sample_update_data_retention_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DataRetentionSettings: - Settings values for data retention. - This is a singleton resource. + google.analytics.admin_v1alpha.types.SearchAds360Link: + A link between a GA4 property and a + Search Ads 360 entity. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([data_retention_settings, update_mask]) + has_flattened_params = any([parent, search_ads_360_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateDataRetentionSettingsRequest(request) + request = analytics_admin.CreateSearchAds360LinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if data_retention_settings is not None: - request.data_retention_settings = data_retention_settings - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent + if search_ads_360_link is not None: + request.search_ads_360_link = search_ads_360_link # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_data_retention_settings, + self._client._transport.create_search_ads360_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -8066,14 +6558,7 @@ async def sample_update_data_retention_settings(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "data_retention_settings.name", - request.data_retention_settings.name, - ), - ) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -8087,62 +6572,30 @@ async def sample_update_data_retention_settings(): # Done; return the response. return response - async def create_data_stream( + async def delete_search_ads360_link( self, - request: Optional[Union[analytics_admin.CreateDataStreamRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.DeleteSearchAds360LinkRequest, dict] + ] = None, *, - parent: Optional[str] = None, - data_stream: Optional[resources.DataStream] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DataStream: - r"""Creates a DataStream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - data_stream = admin_v1alpha.DataStream() - data_stream.type_ = "IOS_APP_DATA_STREAM" - - request = admin_v1alpha.CreateDataStreamRequest( - parent="parent_value", - data_stream=data_stream, - ) - - # Make the request - response = await client.create_data_stream(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a SearchAds360Link on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateDataStreamRequest, dict]]): - The request object. Request message for CreateDataStream - RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteSearchAds360LinkRequest, dict]]): + The request object. Request message for + DeleteSearchAds360Link RPC. + name (:class:`str`): + Required. The name of the + SearchAds360Link to delete. Example + format: + properties/1234/SearchAds360Links/5678 - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - data_stream (:class:`google.analytics.admin_v1alpha.types.DataStream`): - Required. The DataStream to create. - This corresponds to the ``data_stream`` field + This corresponds to the ``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, @@ -8150,36 +6603,28 @@ async def sample_create_data_stream(): 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.analytics.admin_v1alpha.types.DataStream: - A resource message representing a - data stream. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, data_stream]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateDataStreamRequest(request) + request = analytics_admin.DeleteSearchAds360LinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if data_stream is not None: - request.data_stream = data_stream + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_data_stream, + self._client._transport.delete_search_ads360_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -8187,64 +6632,47 @@ async def sample_create_data_stream(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - async def delete_data_stream( + async def update_search_ads360_link( self, - request: Optional[Union[analytics_admin.DeleteDataStreamRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.UpdateSearchAds360LinkRequest, dict] + ] = None, *, - name: Optional[str] = None, + search_ads_360_link: Optional[resources.SearchAds360Link] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a DataStream on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteDataStreamRequest( - name="name_value", - ) - - # Make the request - await client.delete_data_stream(request=request) + ) -> resources.SearchAds360Link: + r"""Updates a SearchAds360Link on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteDataStreamRequest, dict]]): - The request object. Request message for DeleteDataStream - RPC. - name (:class:`str`): - Required. The name of the DataStream - to delete. Example format: - properties/1234/dataStreams/5678 + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateSearchAds360LinkRequest, dict]]): + The request object. Request message for + UpdateSearchAds360Link RPC. + search_ads_360_link (:class:`google.analytics.admin_v1alpha.types.SearchAds360Link`): + The SearchAds360Link to update + This corresponds to the ``search_ads_360_link`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. - This corresponds to the ``name`` field + This corresponds to the ``update_mask`` 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, @@ -8252,28 +6680,36 @@ async def sample_delete_data_stream(): 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.analytics.admin_v1alpha.types.SearchAds360Link: + A link between a GA4 property and a + Search Ads 360 entity. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([search_ads_360_link, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.DeleteDataStreamRequest(request) + request = analytics_admin.UpdateSearchAds360LinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if search_ads_360_link is not None: + request.search_ads_360_link = search_ads_360_link + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_data_stream, + self._client._transport.update_search_ads360_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -8281,70 +6717,45 @@ async def sample_delete_data_stream(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + (("search_ads_360_link.name", request.search_ads_360_link.name),) + ), ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def update_data_stream( + # Done; return the response. + return response + + async def get_attribution_settings( self, - request: Optional[Union[analytics_admin.UpdateDataStreamRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.GetAttributionSettingsRequest, dict] + ] = None, *, - data_stream: Optional[resources.DataStream] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DataStream: - r"""Updates a DataStream on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateDataStreamRequest( - ) - - # Make the request - response = await client.update_data_stream(request=request) - - # Handle the response - print(response) + ) -> resources.AttributionSettings: + r"""Lookup for a AttributionSettings singleton. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateDataStreamRequest, dict]]): - The request object. Request message for UpdateDataStream - RPC. - data_stream (:class:`google.analytics.admin_v1alpha.types.DataStream`): - The DataStream to update - This corresponds to the ``data_stream`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + request (Optional[Union[google.analytics.admin_v1alpha.types.GetAttributionSettingsRequest, dict]]): + The request object. Request message for + GetAttributionSettings RPC. + name (:class:`str`): + Required. The name of the attribution + settings to retrieve. Format: + properties/{property}/attributionSettings - This corresponds to the ``update_mask`` field + This corresponds to the ``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, @@ -8354,34 +6765,33 @@ async def sample_update_data_stream(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DataStream: - A resource message representing a - data stream. + google.analytics.admin_v1alpha.types.AttributionSettings: + The attribution settings used for a + given property. This is a singleton + resource. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([data_stream, update_mask]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateDataStreamRequest(request) + request = analytics_admin.GetAttributionSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if data_stream is not None: - request.data_stream = data_stream - if update_mask is not None: - request.update_mask = update_mask + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_data_stream, + self._client._transport.get_attribution_settings, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -8389,9 +6799,7 @@ async def sample_update_data_stream(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("data_stream.name", request.data_stream.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -8405,53 +6813,40 @@ async def sample_update_data_stream(): # Done; return the response. return response - async def list_data_streams( + async def update_attribution_settings( self, - request: Optional[Union[analytics_admin.ListDataStreamsRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.UpdateAttributionSettingsRequest, dict] + ] = None, *, - parent: Optional[str] = None, + attribution_settings: Optional[resources.AttributionSettings] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListDataStreamsAsyncPager: - r"""Lists DataStreams on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_data_streams(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListDataStreamsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_data_streams(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> resources.AttributionSettings: + r"""Updates attribution settings on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListDataStreamsRequest, dict]]): - The request object. Request message for ListDataStreams - RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateAttributionSettingsRequest, dict]]): + The request object. Request message for + UpdateAttributionSettings RPC + attribution_settings (:class:`google.analytics.admin_v1alpha.types.AttributionSettings`): + Required. The attribution settings to update. The + ``name`` field is used to identify the settings to be + updated. - This corresponds to the ``parent`` field + This corresponds to the ``attribution_settings`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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, @@ -8461,35 +6856,35 @@ async def sample_list_data_streams(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDataStreamsAsyncPager: - Response message for ListDataStreams - RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.AttributionSettings: + The attribution settings used for a + given property. This is a singleton + resource. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([attribution_settings, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.ListDataStreamsRequest(request) + request = analytics_admin.UpdateAttributionSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if attribution_settings is not None: + request.attribution_settings = attribution_settings + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_data_streams, + self._client._transport.update_attribution_settings, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -8497,7 +6892,9 @@ async def sample_list_data_streams(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata( + (("attribution_settings.name", request.attribution_settings.name),) + ), ) # Send the request. @@ -8508,67 +6905,37 @@ async def sample_list_data_streams(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListDataStreamsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - async def get_data_stream( + async def run_access_report( self, - request: Optional[Union[analytics_admin.GetDataStreamRequest, dict]] = None, + request: Optional[Union[analytics_admin.RunAccessReportRequest, dict]] = None, *, - name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DataStream: - r"""Lookup for a single DataStream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDataStreamRequest( - name="name_value", - ) + ) -> analytics_admin.RunAccessReportResponse: + r"""Returns a customized report of data access records. The report + provides records of each time a user reads Google Analytics + reporting data. Access records are retained for up to 2 years. - # Make the request - response = await client.get_data_stream(request=request) + Data Access Reports can be requested for a property. The + property must be in Google Analytics 360. This method is only + available to Administrators. - # Handle the response - print(response) + These data access records include GA4 UI Reporting, GA4 UI + Explorations, GA4 Data API, and other products like Firebase & + Admob that can retrieve data from Google Analytics through a + linkage. These records don't include property configuration + changes like adding a stream or changing a property's time zone. + For configuration change history, see + `searchChangeHistoryEvents `__. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetDataStreamRequest, dict]]): - The request object. Request message for GetDataStream - RPC. - name (:class:`str`): - Required. The name of the DataStream - to get. Example format: - properties/1234/dataStreams/5678 - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + request (Optional[Union[google.analytics.admin_v1alpha.types.RunAccessReportRequest, dict]]): + The request object. The request for a Data Access Record + Report. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -8576,32 +6943,18 @@ async def sample_get_data_stream(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DataStream: - A resource message representing a - data stream. + google.analytics.admin_v1alpha.types.RunAccessReportResponse: + The customized Data Access Record + Report response. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.GetDataStreamRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name + request = analytics_admin.RunAccessReportRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_data_stream, + self._client._transport.run_access_report, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -8609,7 +6962,7 @@ async def sample_get_data_stream(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("entity", request.entity),)), ) # Send the request. @@ -8623,89 +6976,75 @@ async def sample_get_data_stream(): # Done; return the response. return response - async def get_audience( + async def create_access_binding( self, - request: Optional[Union[analytics_admin.GetAudienceRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.CreateAccessBindingRequest, dict] + ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, + access_binding: Optional[resources.AccessBinding] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> audience.Audience: - r"""Lookup for a single Audience. - Audiences created before 2020 may not be supported. - Default audiences will not show filter definitions. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAudienceRequest( - name="name_value", - ) - - # Make the request - response = await client.get_audience(request=request) - - # Handle the response - print(response) + ) -> resources.AccessBinding: + r"""Creates an access binding on an account or property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetAudienceRequest, dict]]): - The request object. Request message for GetAudience RPC. - name (:class:`str`): - Required. The name of the Audience to - get. Example format: - properties/1234/audiences/5678 + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateAccessBindingRequest, dict]]): + The request object. Request message for + CreateAccessBinding RPC. + parent (:class:`str`): + Required. Formats: - This corresponds to the ``name`` field + - accounts/{account} + - properties/{property} + + This corresponds to the ``parent`` 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. + access_binding (:class:`google.analytics.admin_v1alpha.types.AccessBinding`): + Required. The access binding to + create. + + This corresponds to the ``access_binding`` 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.analytics.admin_v1alpha.types.Audience: - A resource message representing a GA4 - Audience. + google.analytics.admin_v1alpha.types.AccessBinding: + A binding of a user to a set of + roles. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent, access_binding]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetAudienceRequest(request) + request = analytics_admin.CreateAccessBindingRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent + if access_binding is not None: + request.access_binding = access_binding # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_audience, + self._client._transport.create_access_binding, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -8713,7 +7052,7 @@ async def sample_get_audience(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -8727,55 +7066,31 @@ async def sample_get_audience(): # Done; return the response. return response - async def list_audiences( + async def get_access_binding( self, - request: Optional[Union[analytics_admin.ListAudiencesRequest, dict]] = None, + request: Optional[Union[analytics_admin.GetAccessBindingRequest, dict]] = None, *, - parent: Optional[str] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListAudiencesAsyncPager: - r"""Lists Audiences on a property. - Audiences created before 2020 may not be supported. - Default audiences will not show filter definitions. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_audiences(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAudiencesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_audiences(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> resources.AccessBinding: + r"""Gets information about an access binding. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListAudiencesRequest, dict]]): - The request object. Request message for ListAudiences + request (Optional[Union[google.analytics.admin_v1alpha.types.GetAccessBindingRequest, dict]]): + The request object. Request message for GetAccessBinding RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 + name (:class:`str`): + Required. The name of the access + binding to retrieve. Formats: - This corresponds to the ``parent`` field + - + accounts/{account}/accessBindings/{accessBinding} + - + properties/{property}/accessBindings/{accessBinding} + + This corresponds to the ``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, @@ -8785,35 +7100,32 @@ async def sample_list_audiences(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAudiencesAsyncPager: - Response message for ListAudiences - RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.AccessBinding: + A binding of a user to a set of + roles. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.ListAudiencesRequest(request) + request = analytics_admin.GetAccessBindingRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_audiences, + self._client._transport.get_access_binding, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -8821,7 +7133,7 @@ async def sample_list_audiences(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -8832,78 +7144,31 @@ async def sample_list_audiences(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListAudiencesAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - async def create_audience( + async def update_access_binding( self, - request: Optional[Union[analytics_admin.CreateAudienceRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.UpdateAccessBindingRequest, dict] + ] = None, *, - parent: Optional[str] = None, - audience: Optional[gaa_audience.Audience] = None, + access_binding: Optional[resources.AccessBinding] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> gaa_audience.Audience: - r"""Creates an Audience. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - audience = admin_v1alpha.Audience() - audience.display_name = "display_name_value" - audience.description = "description_value" - audience.membership_duration_days = 2561 - audience.filter_clauses.simple_filter.scope = "AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS" - audience.filter_clauses.clause_type = "EXCLUDE" - - request = admin_v1alpha.CreateAudienceRequest( - parent="parent_value", - audience=audience, - ) - - # Make the request - response = await client.create_audience(request=request) - - # Handle the response - print(response) + ) -> resources.AccessBinding: + r"""Updates an access binding on an account or property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateAudienceRequest, dict]]): - The request object. Request message for CreateAudience - RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateAccessBindingRequest, dict]]): + The request object. Request message for + UpdateAccessBinding RPC. + access_binding (:class:`google.analytics.admin_v1alpha.types.AccessBinding`): + Required. The access binding to + update. - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - audience (:class:`google.analytics.admin_v1alpha.types.Audience`): - Required. The audience to create. - This corresponds to the ``audience`` field + This corresponds to the ``access_binding`` 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, @@ -8913,34 +7178,32 @@ async def sample_create_audience(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.Audience: - A resource message representing a GA4 - Audience. + google.analytics.admin_v1alpha.types.AccessBinding: + A binding of a user to a set of + roles. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, audience]) + has_flattened_params = any([access_binding]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateAudienceRequest(request) + request = analytics_admin.UpdateAccessBindingRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if audience is not None: - request.audience = audience + if access_binding is not None: + request.access_binding = access_binding # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_audience, + self._client._transport.update_access_binding, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -8948,7 +7211,9 @@ async def sample_create_audience(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata( + (("access_binding.name", request.access_binding.name),) + ), ) # Send the request. @@ -8962,71 +7227,32 @@ async def sample_create_audience(): # Done; return the response. return response - async def update_audience( + async def delete_access_binding( self, - request: Optional[Union[analytics_admin.UpdateAudienceRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.DeleteAccessBindingRequest, dict] + ] = None, *, - audience: Optional[gaa_audience.Audience] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> gaa_audience.Audience: - r"""Updates an Audience on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - audience = admin_v1alpha.Audience() - audience.display_name = "display_name_value" - audience.description = "description_value" - audience.membership_duration_days = 2561 - audience.filter_clauses.simple_filter.scope = "AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS" - audience.filter_clauses.clause_type = "EXCLUDE" - - request = admin_v1alpha.UpdateAudienceRequest( - audience=audience, - ) - - # Make the request - response = await client.update_audience(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes an access binding on an account or property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateAudienceRequest, dict]]): - The request object. Request message for UpdateAudience - RPC. - audience (:class:`google.analytics.admin_v1alpha.types.Audience`): - Required. The audience to update. The audience's - ``name`` field is used to identify the audience to be - updated. + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteAccessBindingRequest, dict]]): + The request object. Request message for + DeleteAccessBinding RPC. + name (:class:`str`): + Required. Formats: - This corresponds to the ``audience`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + - + accounts/{account}/accessBindings/{accessBinding} + - + properties/{property}/accessBindings/{accessBinding} - This corresponds to the ``update_mask`` field + This corresponds to the ``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, @@ -9034,36 +7260,28 @@ async def sample_update_audience(): 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.analytics.admin_v1alpha.types.Audience: - A resource message representing a GA4 - Audience. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([audience, update_mask]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateAudienceRequest(request) + request = analytics_admin.DeleteAccessBindingRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if audience is not None: - request.audience = audience - if update_mask is not None: - request.update_mask = update_mask + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_audience, + self._client._transport.delete_access_binding, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -9071,72 +7289,79 @@ async def sample_update_audience(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("audience.name", request.audience.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - async def archive_audience( + async def list_access_bindings( self, - request: Optional[Union[analytics_admin.ArchiveAudienceRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.ListAccessBindingsRequest, dict] + ] = None, *, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Archives an Audience on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_archive_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() + ) -> pagers.ListAccessBindingsAsyncPager: + r"""Lists all access bindings on an account or property. - # Initialize request argument(s) - request = admin_v1alpha.ArchiveAudienceRequest( - name="name_value", - ) + Args: + request (Optional[Union[google.analytics.admin_v1alpha.types.ListAccessBindingsRequest, dict]]): + The request object. Request message for + ListAccessBindings RPC. + parent (:class:`str`): + Required. Formats: - # Make the request - await client.archive_audience(request=request) + - accounts/{account} + - properties/{property} - Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ArchiveAudienceRequest, dict]]): - The request object. Request message for ArchiveAudience - RPC. + This corresponds to the ``parent`` 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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccessBindingsAsyncPager: + Response message for + ListAccessBindings RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ # Create or coerce a protobuf request object. - request = analytics_admin.ArchiveAudienceRequest(request) + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.ListAccessBindingsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.archive_audience, + self._client._transport.list_access_bindings, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -9144,68 +7369,50 @@ async def sample_archive_audience(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def get_search_ads360_link( + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListAccessBindingsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def batch_create_access_bindings( self, request: Optional[ - Union[analytics_admin.GetSearchAds360LinkRequest, dict] + Union[analytics_admin.BatchCreateAccessBindingsRequest, dict] ] = None, *, - name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SearchAds360Link: - r"""Look up a single SearchAds360Link - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetSearchAds360LinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_search_ads360_link(request=request) + ) -> analytics_admin.BatchCreateAccessBindingsResponse: + r"""Creates information about multiple access bindings to + an account or property. - # Handle the response - print(response) + This method is transactional. If any AccessBinding + cannot be created, none of the AccessBindings will be + created. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetSearchAds360LinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsRequest, dict]]): The request object. Request message for - GetSearchAds360Link RPC. - name (:class:`str`): - Required. The name of the - SearchAds360Link to get. Example format: - properties/1234/SearchAds360Link/5678 - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + BatchCreateAccessBindings RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -9213,32 +7420,18 @@ async def sample_get_search_ads360_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.SearchAds360Link: - A link between a GA4 property and a - Search Ads 360 entity. + google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsResponse: + Response message for + BatchCreateAccessBindings RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.GetSearchAds360LinkRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name + request = analytics_admin.BatchCreateAccessBindingsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_search_ads360_link, + self._client._transport.batch_create_access_bindings, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -9246,7 +7439,7 @@ async def sample_get_search_ads360_link(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -9260,57 +7453,23 @@ async def sample_get_search_ads360_link(): # Done; return the response. return response - async def list_search_ads360_links( + async def batch_get_access_bindings( self, request: Optional[ - Union[analytics_admin.ListSearchAds360LinksRequest, dict] + Union[analytics_admin.BatchGetAccessBindingsRequest, dict] ] = None, *, - parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListSearchAds360LinksAsyncPager: - r"""Lists all SearchAds360Links on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_search_ads360_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListSearchAds360LinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_search_ads360_links(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> analytics_admin.BatchGetAccessBindingsResponse: + r"""Gets information about multiple access bindings to an + account or property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListSearchAds360LinksRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.BatchGetAccessBindingsRequest, dict]]): The request object. Request message for - ListSearchAds360Links RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + BatchGetAccessBindings RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -9318,35 +7477,18 @@ async def sample_list_search_ads360_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSearchAds360LinksAsyncPager: + google.analytics.admin_v1alpha.types.BatchGetAccessBindingsResponse: Response message for - ListSearchAds360Links RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + BatchGetAccessBindings RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.ListSearchAds360LinksRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent + request = analytics_admin.BatchGetAccessBindingsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_search_ads360_links, + self._client._transport.batch_get_access_bindings, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -9365,76 +7507,26 @@ async def sample_list_search_ads360_links(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListSearchAds360LinksAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - async def create_search_ads360_link( + async def batch_update_access_bindings( self, request: Optional[ - Union[analytics_admin.CreateSearchAds360LinkRequest, dict] + Union[analytics_admin.BatchUpdateAccessBindingsRequest, dict] ] = None, *, - parent: Optional[str] = None, - search_ads_360_link: Optional[resources.SearchAds360Link] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SearchAds360Link: - r"""Creates a SearchAds360Link. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateSearchAds360LinkRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_search_ads360_link(request=request) - - # Handle the response - print(response) + ) -> analytics_admin.BatchUpdateAccessBindingsResponse: + r"""Updates information about multiple access bindings to + an account or property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateSearchAds360LinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsRequest, dict]]): The request object. Request message for - CreateSearchAds360Link RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - search_ads_360_link (:class:`google.analytics.admin_v1alpha.types.SearchAds360Link`): - Required. The SearchAds360Link to - create. - - This corresponds to the ``search_ads_360_link`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + BatchUpdateAccessBindings RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -9442,34 +7534,18 @@ async def sample_create_search_ads360_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.SearchAds360Link: - A link between a GA4 property and a - Search Ads 360 entity. + google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsResponse: + Response message for + BatchUpdateAccessBindings RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, search_ads_360_link]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.CreateSearchAds360LinkRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if search_ads_360_link is not None: - request.search_ads_360_link = search_ads_360_link + request = analytics_admin.BatchUpdateAccessBindingsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_search_ads360_link, + self._client._transport.batch_update_access_bindings, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -9491,55 +7567,23 @@ async def sample_create_search_ads360_link(): # Done; return the response. return response - async def delete_search_ads360_link( + async def batch_delete_access_bindings( self, request: Optional[ - Union[analytics_admin.DeleteSearchAds360LinkRequest, dict] + Union[analytics_admin.BatchDeleteAccessBindingsRequest, dict] ] = None, *, - name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: - r"""Deletes a SearchAds360Link on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteSearchAds360LinkRequest( - name="name_value", - ) - - # Make the request - await client.delete_search_ads360_link(request=request) + r"""Deletes information about multiple users' links to an + account or property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteSearchAds360LinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.BatchDeleteAccessBindingsRequest, dict]]): The request object. Request message for - DeleteSearchAds360Link RPC. - name (:class:`str`): - Required. The name of the - SearchAds360Link to delete. Example - format: - properties/1234/SearchAds360Links/5678 - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + BatchDeleteAccessBindings RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -9547,16 +7591,78 @@ async def sample_delete_search_ads360_link(): sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: + request = analytics_admin.BatchDeleteAccessBindingsRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.batch_delete_access_bindings, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def get_expanded_data_set( + self, + request: Optional[ + Union[analytics_admin.GetExpandedDataSetRequest, dict] + ] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> expanded_data_set.ExpandedDataSet: + r"""Lookup for a single ExpandedDataSet. + + Args: + request (Optional[Union[google.analytics.admin_v1alpha.types.GetExpandedDataSetRequest, dict]]): + The request object. Request message for + GetExpandedDataSet RPC. + name (:class:`str`): + Required. The name of the + ExpandedDataSet to get. Example format: + properties/1234/expandedDataSets/5678 + + This corresponds to the ``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.analytics.admin_v1alpha.types.ExpandedDataSet: + A resource message representing a GA4 + ExpandedDataSet. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.DeleteSearchAds360LinkRequest(request) + request = analytics_admin.GetExpandedDataSetRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -9566,7 +7672,7 @@ async def sample_delete_search_ads360_link(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_search_ads360_link, + self._client._transport.get_expanded_data_set, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -9578,68 +7684,38 @@ async def sample_delete_search_ads360_link(): ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def update_search_ads360_link( + # Done; return the response. + return response + + async def list_expanded_data_sets( self, request: Optional[ - Union[analytics_admin.UpdateSearchAds360LinkRequest, dict] + Union[analytics_admin.ListExpandedDataSetsRequest, dict] ] = None, *, - search_ads_360_link: Optional[resources.SearchAds360Link] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SearchAds360Link: - r"""Updates a SearchAds360Link on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateSearchAds360LinkRequest( - ) - - # Make the request - response = await client.update_search_ads360_link(request=request) - - # Handle the response - print(response) + ) -> pagers.ListExpandedDataSetsAsyncPager: + r"""Lists ExpandedDataSets on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateSearchAds360LinkRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ListExpandedDataSetsRequest, dict]]): The request object. Request message for - UpdateSearchAds360Link RPC. - search_ads_360_link (:class:`google.analytics.admin_v1alpha.types.SearchAds360Link`): - The SearchAds360Link to update - This corresponds to the ``search_ads_360_link`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + ListExpandedDataSets RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 - This corresponds to the ``update_mask`` field + This corresponds to the ``parent`` 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, @@ -9649,34 +7725,35 @@ async def sample_update_search_ads360_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.SearchAds360Link: - A link between a GA4 property and a - Search Ads 360 entity. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListExpandedDataSetsAsyncPager: + Response message for + ListExpandedDataSets RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([search_ads_360_link, update_mask]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateSearchAds360LinkRequest(request) + request = analytics_admin.ListExpandedDataSetsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if search_ads_360_link is not None: - request.search_ads_360_link = search_ads_360_link - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_search_ads360_link, + self._client._transport.list_expanded_data_sets, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -9684,9 +7761,7 @@ async def sample_update_search_ads360_link(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("search_ads_360_link.name", request.search_ads_360_link.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -9697,58 +7772,48 @@ async def sample_update_search_ads360_link(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListExpandedDataSetsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - async def get_attribution_settings( + async def create_expanded_data_set( self, request: Optional[ - Union[analytics_admin.GetAttributionSettingsRequest, dict] + Union[analytics_admin.CreateExpandedDataSetRequest, dict] ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, + expanded_data_set: Optional[gaa_expanded_data_set.ExpandedDataSet] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AttributionSettings: - r"""Lookup for a AttributionSettings singleton. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_attribution_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAttributionSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_attribution_settings(request=request) - - # Handle the response - print(response) + ) -> gaa_expanded_data_set.ExpandedDataSet: + r"""Creates a ExpandedDataSet. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetAttributionSettingsRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateExpandedDataSetRequest, dict]]): The request object. Request message for - GetAttributionSettings RPC. - name (:class:`str`): - Required. The name of the attribution - settings to retrieve. Format: - properties/{property}/attributionSettings + CreateExpandedDataSet RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 - This corresponds to the ``name`` field + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + expanded_data_set (:class:`google.analytics.admin_v1alpha.types.ExpandedDataSet`): + Required. The ExpandedDataSet to + create. + + This corresponds to the ``expanded_data_set`` 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, @@ -9758,33 +7823,34 @@ async def sample_get_attribution_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AttributionSettings: - The attribution settings used for a - given property. This is a singleton - resource. + google.analytics.admin_v1alpha.types.ExpandedDataSet: + A resource message representing a GA4 + ExpandedDataSet. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent, expanded_data_set]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetAttributionSettingsRequest(request) + request = analytics_admin.CreateExpandedDataSetRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent + if expanded_data_set is not None: + request.expanded_data_set = expanded_data_set # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_attribution_settings, + self._client._transport.create_expanded_data_set, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -9792,7 +7858,7 @@ async def sample_get_attribution_settings(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -9806,62 +7872,30 @@ async def sample_get_attribution_settings(): # Done; return the response. return response - async def update_attribution_settings( + async def update_expanded_data_set( self, request: Optional[ - Union[analytics_admin.UpdateAttributionSettingsRequest, dict] + Union[analytics_admin.UpdateExpandedDataSetRequest, dict] ] = None, *, - attribution_settings: Optional[resources.AttributionSettings] = None, + expanded_data_set: Optional[gaa_expanded_data_set.ExpandedDataSet] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AttributionSettings: - r"""Updates attribution settings on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_attribution_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - attribution_settings = admin_v1alpha.AttributionSettings() - attribution_settings.acquisition_conversion_event_lookback_window = "ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS" - attribution_settings.other_conversion_event_lookback_window = "OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_90_DAYS" - attribution_settings.reporting_attribution_model = "GOOGLE_PAID_CHANNELS_LAST_CLICK" - attribution_settings.ads_web_conversion_data_export_scope = "GOOGLE_PAID_CHANNELS" - - request = admin_v1alpha.UpdateAttributionSettingsRequest( - attribution_settings=attribution_settings, - ) - - # Make the request - response = await client.update_attribution_settings(request=request) - - # Handle the response - print(response) + ) -> gaa_expanded_data_set.ExpandedDataSet: + r"""Updates a ExpandedDataSet on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateAttributionSettingsRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateExpandedDataSetRequest, dict]]): The request object. Request message for - UpdateAttributionSettings RPC - attribution_settings (:class:`google.analytics.admin_v1alpha.types.AttributionSettings`): - Required. The attribution settings to update. The - ``name`` field is used to identify the settings to be - updated. + UpdateExpandedDataSet RPC. + expanded_data_set (:class:`google.analytics.admin_v1alpha.types.ExpandedDataSet`): + Required. The ExpandedDataSet to update. The resource's + ``name`` field is used to identify the ExpandedDataSet + to be updated. - This corresponds to the ``attribution_settings`` field + This corresponds to the ``expanded_data_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): @@ -9881,35 +7915,34 @@ async def sample_update_attribution_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AttributionSettings: - The attribution settings used for a - given property. This is a singleton - resource. + google.analytics.admin_v1alpha.types.ExpandedDataSet: + A resource message representing a GA4 + ExpandedDataSet. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([attribution_settings, update_mask]) + has_flattened_params = any([expanded_data_set, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateAttributionSettingsRequest(request) + request = analytics_admin.UpdateExpandedDataSetRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if attribution_settings is not None: - request.attribution_settings = attribution_settings + if expanded_data_set is not None: + request.expanded_data_set = expanded_data_set if update_mask is not None: request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_attribution_settings, + self._client._transport.update_expanded_data_set, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -9918,7 +7951,7 @@ async def sample_update_attribution_settings(): # add these here. metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata( - (("attribution_settings.name", request.attribution_settings.name),) + (("expanded_data_set.name", request.expanded_data_set.name),) ), ) @@ -9933,78 +7966,57 @@ async def sample_update_attribution_settings(): # Done; return the response. return response - async def run_access_report( + async def delete_expanded_data_set( self, - request: Optional[Union[analytics_admin.RunAccessReportRequest, dict]] = None, - *, + request: Optional[ + Union[analytics_admin.DeleteExpandedDataSetRequest, dict] + ] = None, + *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.RunAccessReportResponse: - r"""Returns a customized report of data access records. The report - provides records of each time a user reads Google Analytics - reporting data. Access records are retained for up to 2 years. - - Data Access Reports can be requested for a property. The - property must be in Google Analytics 360. This method is only - available to Administrators. - - These data access records include GA4 UI Reporting, GA4 UI - Explorations, GA4 Data API, and other products like Firebase & - Admob that can retrieve data from Google Analytics through a - linkage. These records don't include property configuration - changes like adding a stream or changing a property's time zone. - For configuration change history, see - `searchChangeHistoryEvents `__. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_run_access_report(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.RunAccessReportRequest( - ) - - # Make the request - response = await client.run_access_report(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a ExpandedDataSet on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.RunAccessReportRequest, dict]]): - The request object. The request for a Data Access Record - Report. + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteExpandedDataSetRequest, dict]]): + The request object. Request message for + DeleteExpandedDataSet RPC. + name (:class:`str`): + Required. Example format: + properties/1234/expandedDataSets/5678 + + This corresponds to the ``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.analytics.admin_v1alpha.types.RunAccessReportResponse: - The customized Data Access Record - Report response. - """ # Create or coerce a protobuf request object. - request = analytics_admin.RunAccessReportRequest(request) + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.DeleteExpandedDataSetRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.run_access_report, + self._client._transport.delete_expanded_data_set, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -10012,82 +8024,38 @@ async def sample_run_access_report(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("entity", request.entity),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - async def create_access_binding( + async def get_channel_group( self, - request: Optional[ - Union[analytics_admin.CreateAccessBindingRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.GetChannelGroupRequest, dict]] = None, *, - parent: Optional[str] = None, - access_binding: Optional[resources.AccessBinding] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AccessBinding: - r"""Creates an access binding on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - access_binding = admin_v1alpha.AccessBinding() - access_binding.user = "user_value" - - request = admin_v1alpha.CreateAccessBindingRequest( - parent="parent_value", - access_binding=access_binding, - ) - - # Make the request - response = await client.create_access_binding(request=request) - - # Handle the response - print(response) + ) -> channel_group.ChannelGroup: + r"""Lookup for a single ChannelGroup. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateAccessBindingRequest, dict]]): - The request object. Request message for - CreateAccessBinding RPC. - parent (:class:`str`): - Required. Formats: - - - accounts/{account} - - properties/{property} - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - access_binding (:class:`google.analytics.admin_v1alpha.types.AccessBinding`): - Required. The access binding to - create. + request (Optional[Union[google.analytics.admin_v1alpha.types.GetChannelGroupRequest, dict]]): + The request object. Request message for GetChannelGroup + RPC. + name (:class:`str`): + Required. The ChannelGroup to get. + Example format: + properties/1234/channelGroups/5678 - This corresponds to the ``access_binding`` field + This corresponds to the ``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, @@ -10097,34 +8065,32 @@ async def sample_create_access_binding(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AccessBinding: - A binding of a user to a set of - roles. + google.analytics.admin_v1alpha.types.ChannelGroup: + A resource message representing a + Channel Group. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, access_binding]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateAccessBindingRequest(request) + request = analytics_admin.GetChannelGroupRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if access_binding is not None: - request.access_binding = access_binding + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_access_binding, + self._client._transport.get_channel_group, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -10132,7 +8098,7 @@ async def sample_create_access_binding(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -10146,57 +8112,27 @@ async def sample_create_access_binding(): # Done; return the response. return response - async def get_access_binding( + async def list_channel_groups( self, - request: Optional[Union[analytics_admin.GetAccessBindingRequest, dict]] = None, + request: Optional[Union[analytics_admin.ListChannelGroupsRequest, dict]] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AccessBinding: - r"""Gets information about an access binding. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAccessBindingRequest( - name="name_value", - ) - - # Make the request - response = await client.get_access_binding(request=request) - - # Handle the response - print(response) + ) -> pagers.ListChannelGroupsAsyncPager: + r"""Lists ChannelGroups on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetAccessBindingRequest, dict]]): - The request object. Request message for GetAccessBinding + request (Optional[Union[google.analytics.admin_v1alpha.types.ListChannelGroupsRequest, dict]]): + The request object. Request message for ListChannelGroups RPC. - name (:class:`str`): - Required. The name of the access - binding to retrieve. Formats: - - - - accounts/{account}/accessBindings/{accessBinding} - - - properties/{property}/accessBindings/{accessBinding} + parent (:class:`str`): + Required. The property for which to + list ChannelGroups. Example format: + properties/1234 - This corresponds to the ``name`` field + This corresponds to the ``parent`` 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, @@ -10206,32 +8142,35 @@ async def sample_get_access_binding(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AccessBinding: - A binding of a user to a set of - roles. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListChannelGroupsAsyncPager: + Response message for + ListChannelGroups RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetAccessBindingRequest(request) + request = analytics_admin.ListChannelGroupsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_access_binding, + self._client._transport.list_channel_groups, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -10239,7 +8178,7 @@ async def sample_get_access_binding(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -10250,60 +8189,47 @@ async def sample_get_access_binding(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListChannelGroupsAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - async def update_access_binding( + async def create_channel_group( self, request: Optional[ - Union[analytics_admin.UpdateAccessBindingRequest, dict] + Union[analytics_admin.CreateChannelGroupRequest, dict] ] = None, *, - access_binding: Optional[resources.AccessBinding] = None, + parent: Optional[str] = None, + channel_group: Optional[gaa_channel_group.ChannelGroup] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AccessBinding: - r"""Updates an access binding on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - access_binding = admin_v1alpha.AccessBinding() - access_binding.user = "user_value" - - request = admin_v1alpha.UpdateAccessBindingRequest( - access_binding=access_binding, - ) - - # Make the request - response = await client.update_access_binding(request=request) - - # Handle the response - print(response) + ) -> gaa_channel_group.ChannelGroup: + r"""Creates a ChannelGroup. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateAccessBindingRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateChannelGroupRequest, dict]]): The request object. Request message for - UpdateAccessBinding RPC. - access_binding (:class:`google.analytics.admin_v1alpha.types.AccessBinding`): - Required. The access binding to - update. + CreateChannelGroup RPC. + parent (:class:`str`): + Required. The property for which to + create a ChannelGroup. Example format: + properties/1234 - This corresponds to the ``access_binding`` field + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + channel_group (:class:`google.analytics.admin_v1alpha.types.ChannelGroup`): + Required. The ChannelGroup to create. + This corresponds to the ``channel_group`` 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, @@ -10313,32 +8239,34 @@ async def sample_update_access_binding(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AccessBinding: - A binding of a user to a set of - roles. + google.analytics.admin_v1alpha.types.ChannelGroup: + A resource message representing a + Channel Group. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([access_binding]) + has_flattened_params = any([parent, channel_group]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateAccessBindingRequest(request) + request = analytics_admin.CreateChannelGroupRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if access_binding is not None: - request.access_binding = access_binding - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. + if parent is not None: + request.parent = parent + if channel_group is not None: + request.channel_group = channel_group + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_access_binding, + self._client._transport.create_channel_group, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -10346,9 +8274,7 @@ async def sample_update_access_binding(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("access_binding.name", request.access_binding.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -10362,55 +8288,40 @@ async def sample_update_access_binding(): # Done; return the response. return response - async def delete_access_binding( + async def update_channel_group( self, request: Optional[ - Union[analytics_admin.DeleteAccessBindingRequest, dict] + Union[analytics_admin.UpdateChannelGroupRequest, dict] ] = None, *, - name: Optional[str] = None, + channel_group: Optional[gaa_channel_group.ChannelGroup] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes an access binding on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteAccessBindingRequest( - name="name_value", - ) - - # Make the request - await client.delete_access_binding(request=request) + ) -> gaa_channel_group.ChannelGroup: + r"""Updates a ChannelGroup. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteAccessBindingRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateChannelGroupRequest, dict]]): The request object. Request message for - DeleteAccessBinding RPC. - name (:class:`str`): - Required. Formats: + UpdateChannelGroup RPC. + channel_group (:class:`google.analytics.admin_v1alpha.types.ChannelGroup`): + Required. The ChannelGroup to update. The resource's + ``name`` field is used to identify the ChannelGroup to + be updated. - - - accounts/{account}/accessBindings/{accessBinding} - - - properties/{property}/accessBindings/{accessBinding} + This corresponds to the ``channel_group`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. - This corresponds to the ``name`` field + This corresponds to the ``update_mask`` 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, @@ -10418,28 +8329,36 @@ async def sample_delete_access_binding(): 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.analytics.admin_v1alpha.types.ChannelGroup: + A resource message representing a + Channel Group. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([channel_group, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.DeleteAccessBindingRequest(request) + request = analytics_admin.UpdateChannelGroupRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if channel_group is not None: + request.channel_group = channel_group + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_access_binding, + self._client._transport.update_channel_group, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -10447,68 +8366,45 @@ async def sample_delete_access_binding(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + (("channel_group.name", request.channel_group.name),) + ), ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def list_access_bindings( + # Done; return the response. + return response + + async def delete_channel_group( self, request: Optional[ - Union[analytics_admin.ListAccessBindingsRequest, dict] + Union[analytics_admin.DeleteChannelGroupRequest, dict] ] = None, *, - parent: Optional[str] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListAccessBindingsAsyncPager: - r"""Lists all access bindings on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAccessBindingsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_access_bindings(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> None: + r"""Deletes a ChannelGroup on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListAccessBindingsRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteChannelGroupRequest, dict]]): The request object. Request message for - ListAccessBindings RPC. - parent (:class:`str`): - Required. Formats: - - - accounts/{account} - - properties/{property} + DeleteChannelGroup RPC. + name (:class:`str`): + Required. The ChannelGroup to delete. + Example format: + properties/1234/channelGroups/5678 - This corresponds to the ``parent`` field + This corresponds to the ``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, @@ -10516,37 +8412,28 @@ async def sample_list_access_bindings(): 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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccessBindingsAsyncPager: - Response message for - ListAccessBindings RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.ListAccessBindingsRequest(request) + request = analytics_admin.DeleteChannelGroupRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_access_bindings, + self._client._transport.delete_channel_group, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -10554,81 +8441,36 @@ async def sample_list_access_bindings(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListAccessBindingsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def batch_create_access_bindings( + async def set_automated_ga4_configuration_opt_out( self, request: Optional[ - Union[analytics_admin.BatchCreateAccessBindingsRequest, dict] + Union[analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, dict] ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchCreateAccessBindingsResponse: - r"""Creates information about multiple access bindings to - an account or property. - - This method is transactional. If any AccessBinding - cannot be created, none of the AccessBindings will be - created. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_batch_create_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - requests = admin_v1alpha.CreateAccessBindingRequest() - requests.parent = "parent_value" - requests.access_binding.user = "user_value" - - request = admin_v1alpha.BatchCreateAccessBindingsRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - response = await client.batch_create_access_bindings(request=request) - - # Handle the response - print(response) + ) -> analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse: + r"""Sets the opt out status for the automated GA4 setup + process for a UA property. + Note: this has no effect on GA4 property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsRequest, dict]]): - The request object. Request message for - BatchCreateAccessBindings RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutRequest, dict]]): + The request object. Request for setting the opt out + status for the automated GA4 setup + process. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -10636,28 +8478,23 @@ async def sample_batch_create_access_bindings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsResponse: - Response message for - BatchCreateAccessBindings RPC. + google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutResponse: + Response message for setting the opt + out status for the automated GA4 setup + process. """ # Create or coerce a protobuf request object. - request = analytics_admin.BatchCreateAccessBindingsRequest(request) + request = analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.batch_create_access_bindings, + self._client._transport.set_automated_ga4_configuration_opt_out, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - # Send the request. response = await rpc( request, @@ -10669,50 +8506,25 @@ async def sample_batch_create_access_bindings(): # Done; return the response. return response - async def batch_get_access_bindings( + async def fetch_automated_ga4_configuration_opt_out( self, request: Optional[ - Union[analytics_admin.BatchGetAccessBindingsRequest, dict] + Union[analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, dict] ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchGetAccessBindingsResponse: - r"""Gets information about multiple access bindings to an - account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_batch_get_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.BatchGetAccessBindingsRequest( - parent="parent_value", - names=['names_value1', 'names_value2'], - ) - - # Make the request - response = await client.batch_get_access_bindings(request=request) - - # Handle the response - print(response) + ) -> analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse: + r"""Fetches the opt out status for the automated GA4 + setup process for a UA property. + Note: this has no effect on GA4 property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.BatchGetAccessBindingsRequest, dict]]): - The request object. Request message for - BatchGetAccessBindings RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutRequest, dict]]): + The request object. Request for fetching the opt out + status for the automated GA4 setup + process. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -10720,28 +8532,23 @@ async def sample_batch_get_access_bindings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.BatchGetAccessBindingsResponse: - Response message for - BatchGetAccessBindings RPC. + google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutResponse: + Response message for fetching the opt + out status for the automated GA4 setup + process. """ # Create or coerce a protobuf request object. - request = analytics_admin.BatchGetAccessBindingsRequest(request) + request = analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.batch_get_access_bindings, + self._client._transport.fetch_automated_ga4_configuration_opt_out, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - # Send the request. response = await rpc( request, @@ -10753,72 +8560,63 @@ async def sample_batch_get_access_bindings(): # Done; return the response. return response - async def batch_update_access_bindings( + async def get_big_query_link( self, - request: Optional[ - Union[analytics_admin.BatchUpdateAccessBindingsRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.GetBigQueryLinkRequest, dict]] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchUpdateAccessBindingsResponse: - r"""Updates information about multiple access bindings to - an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_batch_update_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - requests = admin_v1alpha.UpdateAccessBindingRequest() - requests.access_binding.user = "user_value" - - request = admin_v1alpha.BatchUpdateAccessBindingsRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - response = await client.batch_update_access_bindings(request=request) - - # Handle the response - print(response) + ) -> resources.BigQueryLink: + r"""Lookup for a single BigQuery Link. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsRequest, dict]]): - The request object. Request message for - BatchUpdateAccessBindings RPC. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. + request (Optional[Union[google.analytics.admin_v1alpha.types.GetBigQueryLinkRequest, dict]]): + The request object. Request message for GetBigQueryLink + RPC. + name (:class:`str`): + Required. The name of the BigQuery link to lookup. + Format: + properties/{property_id}/bigQueryLinks/{bigquery_link_id} + Example: properties/123/bigQueryLinks/456 + + This corresponds to the ``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.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsResponse: - Response message for - BatchUpdateAccessBindings RPC. + google.analytics.admin_v1alpha.types.BigQueryLink: + A link between a GA4 Property and + BigQuery project. """ # Create or coerce a protobuf request object. - request = analytics_admin.BatchUpdateAccessBindingsRequest(request) + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.GetBigQueryLinkRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.batch_update_access_bindings, + self._client._transport.get_big_query_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -10826,7 +8624,7 @@ async def sample_batch_update_access_bindings(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -10840,63 +8638,65 @@ async def sample_batch_update_access_bindings(): # Done; return the response. return response - async def batch_delete_access_bindings( + async def list_big_query_links( self, - request: Optional[ - Union[analytics_admin.BatchDeleteAccessBindingsRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.ListBigQueryLinksRequest, dict]] = None, *, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes information about multiple users' links to an - account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_batch_delete_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - requests = admin_v1alpha.DeleteAccessBindingRequest() - requests.name = "name_value" - - request = admin_v1alpha.BatchDeleteAccessBindingsRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - await client.batch_delete_access_bindings(request=request) + ) -> pagers.ListBigQueryLinksAsyncPager: + r"""Lists BigQuery Links on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.BatchDeleteAccessBindingsRequest, dict]]): - The request object. Request message for - BatchDeleteAccessBindings RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.ListBigQueryLinksRequest, dict]]): + The request object. Request message for ListBigQueryLinks + RPC. + parent (:class:`str`): + Required. The name of the property to list BigQuery + links under. Format: properties/{property_id} Example: + properties/1234 + + This corresponds to the ``parent`` 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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListBigQueryLinksAsyncPager: + Response message for + ListBigQueryLinks RPC + Iterating over this object will yield + results and resolve additional pages + automatically. + """ # Create or coerce a protobuf request object. - request = analytics_admin.BatchDeleteAccessBindingsRequest(request) + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.ListBigQueryLinksRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.batch_delete_access_bindings, + self._client._transport.list_big_query_links, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -10908,60 +8708,49 @@ async def sample_batch_delete_access_bindings(): ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def get_expanded_data_set( + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListBigQueryLinksAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + async def get_enhanced_measurement_settings( self, request: Optional[ - Union[analytics_admin.GetExpandedDataSetRequest, dict] + Union[analytics_admin.GetEnhancedMeasurementSettingsRequest, dict] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> expanded_data_set.ExpandedDataSet: - r"""Lookup for a single ExpandedDataSet. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetExpandedDataSetRequest( - name="name_value", - ) - - # Make the request - response = await client.get_expanded_data_set(request=request) - - # Handle the response - print(response) + ) -> resources.EnhancedMeasurementSettings: + r"""Returns the enhanced measurement settings for this + data stream. Note that the stream must enable enhanced + measurement for these settings to take effect. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetExpandedDataSetRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.GetEnhancedMeasurementSettingsRequest, dict]]): The request object. Request message for - GetExpandedDataSet RPC. + GetEnhancedMeasurementSettings RPC. name (:class:`str`): - Required. The name of the - ExpandedDataSet to get. Example format: - properties/1234/expandedDataSets/5678 + Required. The name of the settings to lookup. Format: + properties/{property}/dataStreams/{data_stream}/enhancedMeasurementSettings + Example: + "properties/1000/dataStreams/2000/enhancedMeasurementSettings" This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -10973,9 +8762,11 @@ async def sample_get_expanded_data_set(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ExpandedDataSet: - A resource message representing a GA4 - ExpandedDataSet. + google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings: + Singleton resource under a web + DataStream, configuring measurement of + additional site interactions and + content. """ # Create or coerce a protobuf request object. @@ -10988,7 +8779,7 @@ async def sample_get_expanded_data_set(): "the individual field arguments should be set." ) - request = analytics_admin.GetExpandedDataSetRequest(request) + request = analytics_admin.GetEnhancedMeasurementSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -10998,8 +8789,8 @@ async def sample_get_expanded_data_set(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_expanded_data_set, - default_timeout=None, + self._client._transport.get_enhanced_measurement_settings, + default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) @@ -11020,55 +8811,43 @@ async def sample_get_expanded_data_set(): # Done; return the response. return response - async def list_expanded_data_sets( + async def update_enhanced_measurement_settings( self, request: Optional[ - Union[analytics_admin.ListExpandedDataSetsRequest, dict] + Union[analytics_admin.UpdateEnhancedMeasurementSettingsRequest, dict] ] = None, *, - parent: Optional[str] = None, + enhanced_measurement_settings: Optional[ + resources.EnhancedMeasurementSettings + ] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListExpandedDataSetsAsyncPager: - r"""Lists ExpandedDataSets on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_expanded_data_sets(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListExpandedDataSetsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_expanded_data_sets(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> resources.EnhancedMeasurementSettings: + r"""Updates the enhanced measurement settings for this + data stream. Note that the stream must enable enhanced + measurement for these settings to take effect. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListExpandedDataSetsRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateEnhancedMeasurementSettingsRequest, dict]]): The request object. Request message for - ListExpandedDataSets RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 + UpdateEnhancedMeasurementSettings RPC. + enhanced_measurement_settings (:class:`google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings`): + Required. The settings to update. The ``name`` field is + used to identify the settings to be updated. - This corresponds to the ``parent`` field + This corresponds to the ``enhanced_measurement_settings`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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, @@ -11078,43 +8857,51 @@ async def sample_list_expanded_data_sets(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListExpandedDataSetsAsyncPager: - Response message for - ListExpandedDataSets RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings: + Singleton resource under a web + DataStream, configuring measurement of + additional site interactions and + content. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([enhanced_measurement_settings, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.ListExpandedDataSetsRequest(request) + request = analytics_admin.UpdateEnhancedMeasurementSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if enhanced_measurement_settings is not None: + request.enhanced_measurement_settings = enhanced_measurement_settings + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_expanded_data_sets, - default_timeout=None, + self._client._transport.update_enhanced_measurement_settings, + default_timeout=60.0, client_info=DEFAULT_CLIENT_INFO, ) # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "enhanced_measurement_settings.name", + request.enhanced_measurement_settings.name, + ), + ) + ), ) # Send the request. @@ -11125,80 +8912,28 @@ async def sample_list_expanded_data_sets(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListExpandedDataSetsAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - async def create_expanded_data_set( + async def create_connected_site_tag( self, request: Optional[ - Union[analytics_admin.CreateExpandedDataSetRequest, dict] + Union[analytics_admin.CreateConnectedSiteTagRequest, dict] ] = None, *, - parent: Optional[str] = None, - expanded_data_set: Optional[gaa_expanded_data_set.ExpandedDataSet] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> gaa_expanded_data_set.ExpandedDataSet: - r"""Creates a ExpandedDataSet. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - expanded_data_set = admin_v1alpha.ExpandedDataSet() - expanded_data_set.display_name = "display_name_value" - - request = admin_v1alpha.CreateExpandedDataSetRequest( - parent="parent_value", - expanded_data_set=expanded_data_set, - ) - - # Make the request - response = await client.create_expanded_data_set(request=request) - - # Handle the response - print(response) + ) -> analytics_admin.CreateConnectedSiteTagResponse: + r"""Creates a connected site tag for a Universal + Analytics property. You can create a maximum of 20 + connected site tags per property. Note: This API cannot + be used on GA4 properties. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateExpandedDataSetRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateConnectedSiteTagRequest, dict]]): The request object. Request message for - CreateExpandedDataSet RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - expanded_data_set (:class:`google.analytics.admin_v1alpha.types.ExpandedDataSet`): - Required. The ExpandedDataSet to - create. - - This corresponds to the ``expanded_data_set`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + CreateConnectedSiteTag RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -11206,44 +8941,22 @@ async def sample_create_expanded_data_set(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ExpandedDataSet: - A resource message representing a GA4 - ExpandedDataSet. + google.analytics.admin_v1alpha.types.CreateConnectedSiteTagResponse: + Response message for + CreateConnectedSiteTag RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, expanded_data_set]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.CreateExpandedDataSetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if expanded_data_set is not None: - request.expanded_data_set = expanded_data_set + request = analytics_admin.CreateConnectedSiteTagRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_expanded_data_set, + self._client._transport.create_connected_site_tag, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - # Send the request. response = await rpc( request, @@ -11255,71 +8968,68 @@ async def sample_create_expanded_data_set(): # Done; return the response. return response - async def update_expanded_data_set( + async def delete_connected_site_tag( self, request: Optional[ - Union[analytics_admin.UpdateExpandedDataSetRequest, dict] + Union[analytics_admin.DeleteConnectedSiteTagRequest, dict] ] = None, *, - expanded_data_set: Optional[gaa_expanded_data_set.ExpandedDataSet] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> gaa_expanded_data_set.ExpandedDataSet: - r"""Updates a ExpandedDataSet on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() + ) -> None: + r"""Deletes a connected site tag for a Universal + Analytics property. Note: this has no effect on GA4 + properties. - # Initialize request argument(s) - expanded_data_set = admin_v1alpha.ExpandedDataSet() - expanded_data_set.display_name = "display_name_value" + Args: + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteConnectedSiteTagRequest, dict]]): + The request object. Request message for + DeleteConnectedSiteTag RPC. + 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. + request = analytics_admin.DeleteConnectedSiteTagRequest(request) - request = admin_v1alpha.UpdateExpandedDataSetRequest( - expanded_data_set=expanded_data_set, - ) + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_connected_site_tag, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) - # Make the request - response = await client.update_expanded_data_set(request=request) + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) - # Handle the response - print(response) + async def list_connected_site_tags( + self, + request: Optional[ + Union[analytics_admin.ListConnectedSiteTagsRequest, dict] + ] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> analytics_admin.ListConnectedSiteTagsResponse: + r"""Lists the connected site tags for a Universal + Analytics property. A maximum of 20 connected site tags + will be returned. Note: this has no effect on GA4 + property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateExpandedDataSetRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ListConnectedSiteTagsRequest, dict]]): The request object. Request message for - UpdateExpandedDataSet RPC. - expanded_data_set (:class:`google.analytics.admin_v1alpha.types.ExpandedDataSet`): - Required. The ExpandedDataSet to update. The resource's - ``name`` field is used to identify the ExpandedDataSet - to be updated. - - This corresponds to the ``expanded_data_set`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + ListConnectedSiteTags RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -11327,46 +9037,22 @@ async def sample_update_expanded_data_set(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ExpandedDataSet: - A resource message representing a GA4 - ExpandedDataSet. + google.analytics.admin_v1alpha.types.ListConnectedSiteTagsResponse: + Response message for + ListConnectedSiteTags RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([expanded_data_set, update_mask]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.UpdateExpandedDataSetRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if expanded_data_set is not None: - request.expanded_data_set = expanded_data_set - if update_mask is not None: - request.update_mask = update_mask + request = analytics_admin.ListConnectedSiteTagsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_expanded_data_set, + self._client._transport.list_connected_site_tags, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("expanded_data_set.name", request.expanded_data_set.name),) - ), - ) - # Send the request. response = await rpc( request, @@ -11378,49 +9064,79 @@ async def sample_update_expanded_data_set(): # Done; return the response. return response - async def delete_expanded_data_set( + async def fetch_connected_ga4_property( self, request: Optional[ - Union[analytics_admin.DeleteExpandedDataSetRequest, dict] + Union[analytics_admin.FetchConnectedGa4PropertyRequest, dict] ] = None, *, - name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a ExpandedDataSet on a property. + ) -> analytics_admin.FetchConnectedGa4PropertyResponse: + r"""Given a specified UA property, looks up the GA4 + property connected to it. Note: this cannot be used with + GA4 properties. + + Args: + request (Optional[Union[google.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyRequest, dict]]): + The request object. Request for looking up GA4 property + connected to a UA property. + 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.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyResponse: + Response for looking up GA4 property + connected to a UA property. - .. code-block:: python + """ + # Create or coerce a protobuf request object. + request = analytics_admin.FetchConnectedGa4PropertyRequest(request) - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.fetch_connected_ga4_property, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) - async def sample_delete_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) - # Initialize request argument(s) - request = admin_v1alpha.DeleteExpandedDataSetRequest( - name="name_value", - ) + # Done; return the response. + return response - # Make the request - await client.delete_expanded_data_set(request=request) + async def get_ad_sense_link( + self, + request: Optional[Union[analytics_admin.GetAdSenseLinkRequest, dict]] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.AdSenseLink: + r"""Looks up a single AdSenseLink. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteExpandedDataSetRequest, dict]]): - The request object. Request message for - DeleteExpandedDataSet RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.GetAdSenseLinkRequest, dict]]): + The request object. Request message to be passed to + GetAdSenseLink method. name (:class:`str`): - Required. Example format: - properties/1234/expandedDataSets/5678 + Required. Unique identifier for the + AdSense Link requested. Format: + properties/{propertyId}/adSenseLinks/{linkId} + Example: + properties/1234/adSenseLinks/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -11430,6 +9146,12 @@ async def sample_delete_expanded_data_set(): 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.analytics.admin_v1alpha.types.AdSenseLink: + A link between a GA4 Property and an + AdSense for Content ad client. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -11441,7 +9163,7 @@ async def sample_delete_expanded_data_set(): "the individual field arguments should be set." ) - request = analytics_admin.DeleteExpandedDataSetRequest(request) + request = analytics_admin.GetAdSenseLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -11451,7 +9173,7 @@ async def sample_delete_expanded_data_set(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_expanded_data_set, + self._client._transport.get_ad_sense_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -11463,60 +9185,44 @@ async def sample_delete_expanded_data_set(): ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def get_channel_group( + # Done; return the response. + return response + + async def create_ad_sense_link( self, - request: Optional[Union[analytics_admin.GetChannelGroupRequest, dict]] = None, + request: Optional[Union[analytics_admin.CreateAdSenseLinkRequest, dict]] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, + adsense_link: Optional[resources.AdSenseLink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> channel_group.ChannelGroup: - r"""Lookup for a single ChannelGroup. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetChannelGroupRequest( - name="name_value", - ) - - # Make the request - response = await client.get_channel_group(request=request) - - # Handle the response - print(response) + ) -> resources.AdSenseLink: + r"""Creates an AdSenseLink. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetChannelGroupRequest, dict]]): - The request object. Request message for GetChannelGroup - RPC. - name (:class:`str`): - Required. The ChannelGroup to get. - Example format: - properties/1234/channelGroups/5678 + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateAdSenseLinkRequest, dict]]): + The request object. Request message to be passed to + CreateAdSenseLink method. + parent (:class:`str`): + Required. The property for which to + create an AdSense Link. Format: + properties/{propertyId} Example: + properties/1234 - This corresponds to the ``name`` field + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + adsense_link (:class:`google.analytics.admin_v1alpha.types.AdSenseLink`): + Required. The AdSense Link to create + This corresponds to the ``adsense_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, @@ -11526,32 +9232,34 @@ async def sample_get_channel_group(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ChannelGroup: - A resource message representing a - Channel Group. + google.analytics.admin_v1alpha.types.AdSenseLink: + A link between a GA4 Property and an + AdSense for Content ad client. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent, adsense_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetChannelGroupRequest(request) + request = analytics_admin.CreateAdSenseLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent + if adsense_link is not None: + request.adsense_link = adsense_link # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_channel_group, + self._client._transport.create_ad_sense_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -11559,7 +9267,7 @@ async def sample_get_channel_group(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -11573,52 +9281,96 @@ async def sample_get_channel_group(): # Done; return the response. return response - async def list_channel_groups( + async def delete_ad_sense_link( self, - request: Optional[Union[analytics_admin.ListChannelGroupsRequest, dict]] = None, + request: Optional[Union[analytics_admin.DeleteAdSenseLinkRequest, dict]] = None, *, - parent: Optional[str] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListChannelGroupsAsyncPager: - r"""Lists ChannelGroups on a property. + ) -> None: + r"""Deletes an AdSenseLink. + + Args: + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteAdSenseLinkRequest, dict]]): + The request object. Request message to be passed to + DeleteAdSenseLink method. + name (:class:`str`): + Required. Unique identifier for the + AdSense Link to be deleted. Format: + properties/{propertyId}/adSenseLinks/{linkId} + Example: + properties/1234/adSenseLinks/5678 + + This corresponds to the ``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. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) - .. code-block:: python + request = analytics_admin.DeleteAdSenseLinkRequest(request) - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name - async def sample_list_channel_groups(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_ad_sense_link, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) - # Initialize request argument(s) - request = admin_v1alpha.ListChannelGroupsRequest( - parent="parent_value", - ) + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) - # Make the request - page_result = client.list_channel_groups(request=request) + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) - # Handle the response - async for response in page_result: - print(response) + async def list_ad_sense_links( + self, + request: Optional[Union[analytics_admin.ListAdSenseLinksRequest, dict]] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListAdSenseLinksAsyncPager: + r"""Lists AdSenseLinks on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListChannelGroupsRequest, dict]]): - The request object. Request message for ListChannelGroups - RPC. + request (Optional[Union[google.analytics.admin_v1alpha.types.ListAdSenseLinksRequest, dict]]): + The request object. Request message to be passed to + ListAdSenseLinks method. parent (:class:`str`): - Required. The property for which to - list ChannelGroups. Example format: - properties/1234 + Required. Resource name of the parent + property. Format: + properties/{propertyId} + Example: properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -11630,9 +9382,9 @@ async def sample_list_channel_groups(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListChannelGroupsAsyncPager: - Response message for - ListChannelGroups RPC. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAdSenseLinksAsyncPager: + Response message for ListAdSenseLinks + method. Iterating over this object will yield results and resolve additional pages automatically. @@ -11648,7 +9400,7 @@ async def sample_list_channel_groups(): "the individual field arguments should be set." ) - request = analytics_admin.ListChannelGroupsRequest(request) + request = analytics_admin.ListAdSenseLinksRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -11658,7 +9410,7 @@ async def sample_list_channel_groups(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_channel_groups, + self._client._transport.list_ad_sense_links, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -11679,7 +9431,7 @@ async def sample_list_channel_groups(): # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. - response = pagers.ListChannelGroupsAsyncPager( + response = pagers.ListAdSenseLinksAsyncPager( method=rpc, request=request, response=response, @@ -11689,66 +9441,29 @@ async def sample_list_channel_groups(): # Done; return the response. return response - async def create_channel_group( + async def get_event_create_rule( self, request: Optional[ - Union[analytics_admin.CreateChannelGroupRequest, dict] + Union[analytics_admin.GetEventCreateRuleRequest, dict] ] = None, *, - parent: Optional[str] = None, - channel_group: Optional[gaa_channel_group.ChannelGroup] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> gaa_channel_group.ChannelGroup: - r"""Creates a ChannelGroup. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - channel_group = admin_v1alpha.ChannelGroup() - channel_group.display_name = "display_name_value" - channel_group.grouping_rule.display_name = "display_name_value" - - request = admin_v1alpha.CreateChannelGroupRequest( - parent="parent_value", - channel_group=channel_group, - ) - - # Make the request - response = await client.create_channel_group(request=request) - - # Handle the response - print(response) + ) -> event_create_and_edit.EventCreateRule: + r"""Lookup for a single EventCreateRule. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateChannelGroupRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.GetEventCreateRuleRequest, dict]]): The request object. Request message for - CreateChannelGroup RPC. - parent (:class:`str`): - Required. The property for which to - create a ChannelGroup. Example format: - properties/1234 + GetEventCreateRule RPC. + name (:class:`str`): + Required. The name of the + EventCreateRule to get. Example format: + properties/123/dataStreams/456/eventCreateRules/789 - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - channel_group (:class:`google.analytics.admin_v1alpha.types.ChannelGroup`): - Required. The ChannelGroup to create. - This corresponds to the ``channel_group`` field + This corresponds to the ``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, @@ -11758,34 +9473,44 @@ async def sample_create_channel_group(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ChannelGroup: - A resource message representing a - Channel Group. + google.analytics.admin_v1alpha.types.EventCreateRule: + An Event Create Rule defines + conditions that will trigger the + creation of an entirely new event based + upon matched criteria of a source event. + Additional mutations of the parameters + from the source event can be defined. + + Unlike Event Edit rules, Event Creation + Rules have no defined order. They will + all be run independently. + + Event Edit and Event Create rules can't + be used to modify an event created from + an Event Create rule. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, channel_group]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateChannelGroupRequest(request) + request = analytics_admin.GetEventCreateRuleRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if channel_group is not None: - request.channel_group = channel_group + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_channel_group, + self._client._transport.get_event_create_rule, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -11793,7 +9518,7 @@ async def sample_create_channel_group(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -11807,70 +9532,28 @@ async def sample_create_channel_group(): # Done; return the response. return response - async def update_channel_group( + async def list_event_create_rules( self, request: Optional[ - Union[analytics_admin.UpdateChannelGroupRequest, dict] + Union[analytics_admin.ListEventCreateRulesRequest, dict] ] = None, *, - channel_group: Optional[gaa_channel_group.ChannelGroup] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> gaa_channel_group.ChannelGroup: - r"""Updates a ChannelGroup. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - channel_group = admin_v1alpha.ChannelGroup() - channel_group.display_name = "display_name_value" - channel_group.grouping_rule.display_name = "display_name_value" - - request = admin_v1alpha.UpdateChannelGroupRequest( - channel_group=channel_group, - ) - - # Make the request - response = await client.update_channel_group(request=request) - - # Handle the response - print(response) + ) -> pagers.ListEventCreateRulesAsyncPager: + r"""Lists EventCreateRules on a web data stream. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateChannelGroupRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ListEventCreateRulesRequest, dict]]): The request object. Request message for - UpdateChannelGroup RPC. - channel_group (:class:`google.analytics.admin_v1alpha.types.ChannelGroup`): - Required. The ChannelGroup to update. The resource's - ``name`` field is used to identify the ChannelGroup to - be updated. + ListEventCreateRules RPC. + parent (:class:`str`): + Required. Example format: + properties/123/dataStreams/456 - This corresponds to the ``channel_group`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. - - This corresponds to the ``update_mask`` field + This corresponds to the ``parent`` 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, @@ -11880,34 +9563,35 @@ async def sample_update_channel_group(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ChannelGroup: - A resource message representing a - Channel Group. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListEventCreateRulesAsyncPager: + Response message for + ListEventCreateRules RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([channel_group, update_mask]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateChannelGroupRequest(request) + request = analytics_admin.ListEventCreateRulesRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if channel_group is not None: - request.channel_group = channel_group - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_channel_group, + self._client._transport.list_event_create_rules, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -11915,9 +9599,7 @@ async def sample_update_channel_group(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("channel_group.name", request.channel_group.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -11928,55 +9610,48 @@ async def sample_update_channel_group(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListEventCreateRulesAsyncPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - async def delete_channel_group( + async def create_event_create_rule( self, request: Optional[ - Union[analytics_admin.DeleteChannelGroupRequest, dict] + Union[analytics_admin.CreateEventCreateRuleRequest, dict] ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, + event_create_rule: Optional[event_create_and_edit.EventCreateRule] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a ChannelGroup on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteChannelGroupRequest( - name="name_value", - ) - - # Make the request - await client.delete_channel_group(request=request) + ) -> event_create_and_edit.EventCreateRule: + r"""Creates an EventCreateRule. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteChannelGroupRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateEventCreateRuleRequest, dict]]): The request object. Request message for - DeleteChannelGroup RPC. - name (:class:`str`): - Required. The ChannelGroup to delete. - Example format: - properties/1234/channelGroups/5678 + CreateEventCreateRule RPC. + parent (:class:`str`): + Required. Example format: + properties/123/dataStreams/456 - This corresponds to the ``name`` field + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + event_create_rule (:class:`google.analytics.admin_v1alpha.types.EventCreateRule`): + Required. The EventCreateRule to + create. + + This corresponds to the ``event_create_rule`` 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, @@ -11984,28 +9659,48 @@ async def sample_delete_channel_group(): 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.analytics.admin_v1alpha.types.EventCreateRule: + An Event Create Rule defines + conditions that will trigger the + creation of an entirely new event based + upon matched criteria of a source event. + Additional mutations of the parameters + from the source event can be defined. + + Unlike Event Edit rules, Event Creation + Rules have no defined order. They will + all be run independently. + + Event Edit and Event Create rules can't + be used to modify an event created from + an Event Create rule. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent, event_create_rule]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.DeleteChannelGroupRequest(request) + request = analytics_admin.CreateEventCreateRuleRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent + if event_create_rule is not None: + request.event_create_rule = event_create_rule # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_channel_group, + self._client._transport.create_event_create_rule, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -12013,84 +9708,7 @@ async def sample_delete_channel_group(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - async def set_automated_ga4_configuration_opt_out( - self, - request: Optional[ - Union[analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse: - r"""Sets the opt out status for the automated GA4 setup - process for a UA property. - Note: this has no effect on GA4 property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_set_automated_ga4_configuration_opt_out(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.SetAutomatedGa4ConfigurationOptOutRequest( - property="property_value", - ) - - # Make the request - response = await client.set_automated_ga4_configuration_opt_out(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutRequest, dict]]): - The request object. Request for setting the opt out - status for the automated GA4 setup - process. - 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.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutResponse: - Response message for setting the opt - out status for the automated GA4 setup - process. - - """ - # Create or coerce a protobuf request object. - request = analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.set_automated_ga4_configuration_opt_out, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -12104,51 +9722,42 @@ async def sample_set_automated_ga4_configuration_opt_out(): # Done; return the response. return response - async def fetch_automated_ga4_configuration_opt_out( + async def update_event_create_rule( self, request: Optional[ - Union[analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, dict] + Union[analytics_admin.UpdateEventCreateRuleRequest, dict] ] = None, *, + event_create_rule: Optional[event_create_and_edit.EventCreateRule] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse: - r"""Fetches the opt out status for the automated GA4 - setup process for a UA property. - Note: this has no effect on GA4 property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_fetch_automated_ga4_configuration_opt_out(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.FetchAutomatedGa4ConfigurationOptOutRequest( - property="property_value", - ) + ) -> event_create_and_edit.EventCreateRule: + r"""Updates an EventCreateRule. - # Make the request - response = await client.fetch_automated_ga4_configuration_opt_out(request=request) + Args: + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateEventCreateRuleRequest, dict]]): + The request object. Request message for + UpdateEventCreateRule RPC. + event_create_rule (:class:`google.analytics.admin_v1alpha.types.EventCreateRule`): + Required. The EventCreateRule to update. The resource's + ``name`` field is used to identify the EventCreateRule + to be updated. - # Handle the response - print(response) + This corresponds to the ``event_create_rule`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. - Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutRequest, dict]]): - The request object. Request for fetching the opt out - status for the automated GA4 setup - process. + This corresponds to the ``update_mask`` 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. @@ -12156,790 +9765,58 @@ async def sample_fetch_automated_ga4_configuration_opt_out(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutResponse: - Response message for fetching the opt - out status for the automated GA4 setup - process. - - """ - # Create or coerce a protobuf request object. - request = analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.fetch_automated_ga4_configuration_opt_out, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) + google.analytics.admin_v1alpha.types.EventCreateRule: + An Event Create Rule defines + conditions that will trigger the + creation of an entirely new event based + upon matched criteria of a source event. + Additional mutations of the parameters + from the source event can be defined. - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) + Unlike Event Edit rules, Event Creation + Rules have no defined order. They will + all be run independently. - # Done; return the response. - return response - - async def get_big_query_link( - self, - request: Optional[Union[analytics_admin.GetBigQueryLinkRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.BigQueryLink: - r"""Lookup for a single BigQuery Link. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_big_query_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetBigQueryLinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_big_query_link(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetBigQueryLinkRequest, dict]]): - The request object. Request message for GetBigQueryLink - RPC. - name (:class:`str`): - Required. The name of the BigQuery link to lookup. - Format: - properties/{property_id}/bigQueryLinks/{bigquery_link_id} - Example: properties/123/bigQueryLinks/456 - - This corresponds to the ``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.analytics.admin_v1alpha.types.BigQueryLink: - A link between a GA4 Property and - BigQuery project. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.GetBigQueryLinkRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_big_query_link, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def list_big_query_links( - self, - request: Optional[Union[analytics_admin.ListBigQueryLinksRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListBigQueryLinksAsyncPager: - r"""Lists BigQuery Links on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_big_query_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListBigQueryLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_big_query_links(request=request) - - # Handle the response - async for response in page_result: - print(response) - - Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListBigQueryLinksRequest, dict]]): - The request object. Request message for ListBigQueryLinks - RPC. - parent (:class:`str`): - Required. The name of the property to list BigQuery - links under. Format: properties/{property_id} Example: - properties/1234 - - This corresponds to the ``parent`` 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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListBigQueryLinksAsyncPager: - Response message for - ListBigQueryLinks RPC - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.ListBigQueryLinksRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_big_query_links, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListBigQueryLinksAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def get_enhanced_measurement_settings( - self, - request: Optional[ - Union[analytics_admin.GetEnhancedMeasurementSettingsRequest, dict] - ] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.EnhancedMeasurementSettings: - r"""Returns the enhanced measurement settings for this - data stream. Note that the stream must enable enhanced - measurement for these settings to take effect. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_enhanced_measurement_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetEnhancedMeasurementSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_enhanced_measurement_settings(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetEnhancedMeasurementSettingsRequest, dict]]): - The request object. Request message for - GetEnhancedMeasurementSettings RPC. - name (:class:`str`): - Required. The name of the settings to lookup. Format: - properties/{property}/dataStreams/{data_stream}/enhancedMeasurementSettings - Example: - "properties/1000/dataStreams/2000/enhancedMeasurementSettings" - - This corresponds to the ``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.analytics.admin_v1alpha.types.EnhancedMeasurementSettings: - Singleton resource under a web - DataStream, configuring measurement of - additional site interactions and - content. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.GetEnhancedMeasurementSettingsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_enhanced_measurement_settings, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def update_enhanced_measurement_settings( - self, - request: Optional[ - Union[analytics_admin.UpdateEnhancedMeasurementSettingsRequest, dict] - ] = None, - *, - enhanced_measurement_settings: Optional[ - resources.EnhancedMeasurementSettings - ] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.EnhancedMeasurementSettings: - r"""Updates the enhanced measurement settings for this - data stream. Note that the stream must enable enhanced - measurement for these settings to take effect. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_enhanced_measurement_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - enhanced_measurement_settings = admin_v1alpha.EnhancedMeasurementSettings() - enhanced_measurement_settings.search_query_parameter = "search_query_parameter_value" - - request = admin_v1alpha.UpdateEnhancedMeasurementSettingsRequest( - enhanced_measurement_settings=enhanced_measurement_settings, - ) - - # Make the request - response = await client.update_enhanced_measurement_settings(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateEnhancedMeasurementSettingsRequest, dict]]): - The request object. Request message for - UpdateEnhancedMeasurementSettings RPC. - enhanced_measurement_settings (:class:`google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings`): - Required. The settings to update. The ``name`` field is - used to identify the settings to be updated. - - This corresponds to the ``enhanced_measurement_settings`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. - - This corresponds to the ``update_mask`` 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.analytics.admin_v1alpha.types.EnhancedMeasurementSettings: - Singleton resource under a web - DataStream, configuring measurement of - additional site interactions and - content. + Event Edit and Event Create rules can't + be used to modify an event created from + an Event Create rule. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([enhanced_measurement_settings, update_mask]) + has_flattened_params = any([event_create_rule, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.UpdateEnhancedMeasurementSettingsRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if enhanced_measurement_settings is not None: - request.enhanced_measurement_settings = enhanced_measurement_settings - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_enhanced_measurement_settings, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "enhanced_measurement_settings.name", - request.enhanced_measurement_settings.name, - ), - ) - ), - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def create_connected_site_tag( - self, - request: Optional[ - Union[analytics_admin.CreateConnectedSiteTagRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.CreateConnectedSiteTagResponse: - r"""Creates a connected site tag for a Universal - Analytics property. You can create a maximum of 20 - connected site tags per property. Note: This API cannot - be used on GA4 properties. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_connected_site_tag(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - connected_site_tag = admin_v1alpha.ConnectedSiteTag() - connected_site_tag.display_name = "display_name_value" - connected_site_tag.tag_id = "tag_id_value" - - request = admin_v1alpha.CreateConnectedSiteTagRequest( - connected_site_tag=connected_site_tag, - ) - - # Make the request - response = await client.create_connected_site_tag(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateConnectedSiteTagRequest, dict]]): - The request object. Request message for - CreateConnectedSiteTag RPC. - 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.analytics.admin_v1alpha.types.CreateConnectedSiteTagResponse: - Response message for - CreateConnectedSiteTag RPC. - - """ - # Create or coerce a protobuf request object. - request = analytics_admin.CreateConnectedSiteTagRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_connected_site_tag, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def delete_connected_site_tag( - self, - request: Optional[ - Union[analytics_admin.DeleteConnectedSiteTagRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a connected site tag for a Universal - Analytics property. Note: this has no effect on GA4 - properties. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_connected_site_tag(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteConnectedSiteTagRequest( - ) - - # Make the request - await client.delete_connected_site_tag(request=request) - - Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteConnectedSiteTagRequest, dict]]): - The request object. Request message for - DeleteConnectedSiteTag RPC. - 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. - request = analytics_admin.DeleteConnectedSiteTagRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_connected_site_tag, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Send the request. - await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - async def list_connected_site_tags( - self, - request: Optional[ - Union[analytics_admin.ListConnectedSiteTagsRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.ListConnectedSiteTagsResponse: - r"""Lists the connected site tags for a Universal - Analytics property. A maximum of 20 connected site tags - will be returned. Note: this has no effect on GA4 - property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_connected_site_tags(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListConnectedSiteTagsRequest( - ) - - # Make the request - response = await client.list_connected_site_tags(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListConnectedSiteTagsRequest, dict]]): - The request object. Request message for - ListConnectedSiteTags RPC. - 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.analytics.admin_v1alpha.types.ListConnectedSiteTagsResponse: - Response message for - ListConnectedSiteTags RPC. - - """ - # Create or coerce a protobuf request object. - request = analytics_admin.ListConnectedSiteTagsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_connected_site_tags, - default_timeout=None, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Send the request. - response = await rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - async def fetch_connected_ga4_property( - self, - request: Optional[ - Union[analytics_admin.FetchConnectedGa4PropertyRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.FetchConnectedGa4PropertyResponse: - r"""Given a specified UA property, looks up the GA4 - property connected to it. Note: this cannot be used with - GA4 properties. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_fetch_connected_ga4_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.FetchConnectedGa4PropertyRequest( - property="property_value", - ) - - # Make the request - response = await client.fetch_connected_ga4_property(request=request) - - # Handle the response - print(response) - - Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyRequest, dict]]): - The request object. Request for looking up GA4 property - connected to a UA property. - 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.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyResponse: - Response for looking up GA4 property - connected to a UA property. + "the individual field arguments should be set." + ) - """ - # Create or coerce a protobuf request object. - request = analytics_admin.FetchConnectedGa4PropertyRequest(request) + request = analytics_admin.UpdateEventCreateRuleRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if event_create_rule is not None: + request.event_create_rule = event_create_rule + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.fetch_connected_ga4_property, + self._client._transport.update_event_create_rule, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("event_create_rule.name", request.event_create_rule.name),) + ), + ) + # Send the request. response = await rpc( request, @@ -12951,53 +9828,27 @@ async def sample_fetch_connected_ga4_property(): # Done; return the response. return response - async def get_ad_sense_link( + async def delete_event_create_rule( self, - request: Optional[Union[analytics_admin.GetAdSenseLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.DeleteEventCreateRuleRequest, dict] + ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AdSenseLink: - r"""Looks up a single AdSenseLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_ad_sense_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAdSenseLinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_ad_sense_link(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes an EventCreateRule. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetAdSenseLinkRequest, dict]]): - The request object. Request message to be passed to - GetAdSenseLink method. + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteEventCreateRuleRequest, dict]]): + The request object. Request message for + DeleteEventCreateRule RPC. name (:class:`str`): - Required. Unique identifier for the - AdSense Link requested. Format: - properties/{propertyId}/adSenseLinks/{linkId} - Example: - properties/1234/adSenseLinks/5678 + Required. Example format: + + properties/123/dataStreams/456/eventCreateRules/789 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -13007,12 +9858,6 @@ async def sample_get_ad_sense_link(): 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.analytics.admin_v1alpha.types.AdSenseLink: - A link between a GA4 Property and an - AdSense for Content ad client. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -13024,7 +9869,7 @@ async def sample_get_ad_sense_link(): "the individual field arguments should be set." ) - request = analytics_admin.GetAdSenseLinkRequest(request) + request = analytics_admin.DeleteEventCreateRuleRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -13034,7 +9879,7 @@ async def sample_get_ad_sense_link(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_ad_sense_link, + self._client._transport.delete_event_create_rule, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -13046,70 +9891,46 @@ async def sample_get_ad_sense_link(): ) # Send the request. - response = await rpc( + await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - async def create_ad_sense_link( + async def update_data_redaction_settings( self, - request: Optional[Union[analytics_admin.CreateAdSenseLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.UpdateDataRedactionSettingsRequest, dict] + ] = None, *, - parent: Optional[str] = None, - adsense_link: Optional[resources.AdSenseLink] = None, + data_redaction_settings: Optional[resources.DataRedactionSettings] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AdSenseLink: - r"""Creates an AdSenseLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_ad_sense_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateAdSenseLinkRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_ad_sense_link(request=request) - - # Handle the response - print(response) + ) -> resources.DataRedactionSettings: + r"""Updates a DataRedactionSettings on a property. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateAdSenseLinkRequest, dict]]): - The request object. Request message to be passed to - CreateAdSenseLink method. - parent (:class:`str`): - Required. The property for which to - create an AdSense Link. Format: - properties/{propertyId} Example: - properties/1234 + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateDataRedactionSettingsRequest, dict]]): + The request object. Request message for + UpdateDataRedactionSettings RPC. + data_redaction_settings (:class:`google.analytics.admin_v1alpha.types.DataRedactionSettings`): + Required. The settings to update. The ``name`` field is + used to identify the settings to be updated. - This corresponds to the ``parent`` field + This corresponds to the ``data_redaction_settings`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - adsense_link (:class:`google.analytics.admin_v1alpha.types.AdSenseLink`): - Required. The AdSense Link to create - This corresponds to the ``adsense_link`` field + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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, @@ -13119,34 +9940,35 @@ async def sample_create_ad_sense_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AdSenseLink: - A link between a GA4 Property and an - AdSense for Content ad client. + google.analytics.admin_v1alpha.types.DataRedactionSettings: + Settings for client-side data + redaction. Singleton resource under a + Web Stream. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, adsense_link]) + has_flattened_params = any([data_redaction_settings, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateAdSenseLinkRequest(request) + request = analytics_admin.UpdateDataRedactionSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if adsense_link is not None: - request.adsense_link = adsense_link + if data_redaction_settings is not None: + request.data_redaction_settings = data_redaction_settings + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_ad_sense_link, + self._client._transport.update_data_redaction_settings, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -13154,7 +9976,14 @@ async def sample_create_ad_sense_link(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "data_redaction_settings.name", + request.data_redaction_settings.name, + ), + ) + ), ) # Send the request. @@ -13168,50 +9997,28 @@ async def sample_create_ad_sense_link(): # Done; return the response. return response - async def delete_ad_sense_link( + async def get_data_redaction_settings( self, - request: Optional[Union[analytics_admin.DeleteAdSenseLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.GetDataRedactionSettingsRequest, dict] + ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes an AdSenseLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_ad_sense_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteAdSenseLinkRequest( - name="name_value", - ) - - # Make the request - await client.delete_ad_sense_link(request=request) + ) -> resources.DataRedactionSettings: + r"""Lookup for a single DataRedactionSettings. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteAdSenseLinkRequest, dict]]): - The request object. Request message to be passed to - DeleteAdSenseLink method. + request (Optional[Union[google.analytics.admin_v1alpha.types.GetDataRedactionSettingsRequest, dict]]): + The request object. Request message for + GetDataRedactionSettings RPC. name (:class:`str`): - Required. Unique identifier for the - AdSense Link to be deleted. Format: - properties/{propertyId}/adSenseLinks/{linkId} + Required. The name of the settings to lookup. Format: + properties/{property}/dataStreams/{data_stream}/dataRedactionSettings Example: - properties/1234/adSenseLinks/5678 + "properties/1000/dataStreams/2000/dataRedactionSettings" This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -13221,6 +10028,13 @@ async def sample_delete_ad_sense_link(): 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.analytics.admin_v1alpha.types.DataRedactionSettings: + Settings for client-side data + redaction. Singleton resource under a + Web Stream. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -13232,7 +10046,7 @@ async def sample_delete_ad_sense_link(): "the individual field arguments should be set." ) - request = analytics_admin.DeleteAdSenseLinkRequest(request) + request = analytics_admin.GetDataRedactionSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -13242,7 +10056,7 @@ async def sample_delete_ad_sense_link(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_ad_sense_link, + self._client._transport.get_data_redaction_settings, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -13254,64 +10068,33 @@ async def sample_delete_ad_sense_link(): ) # Send the request. - await rpc( + response = await rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def list_ad_sense_links( + # Done; return the response. + return response + + async def create_rollup_property( self, - request: Optional[Union[analytics_admin.ListAdSenseLinksRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.CreateRollupPropertyRequest, dict] + ] = None, *, - parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListAdSenseLinksAsyncPager: - r"""Lists AdSenseLinks on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_ad_sense_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAdSenseLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_ad_sense_links(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> analytics_admin.CreateRollupPropertyResponse: + r"""Create a roll-up property and all roll-up property + source links. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListAdSenseLinksRequest, dict]]): - The request object. Request message to be passed to - ListAdSenseLinks method. - parent (:class:`str`): - Required. Resource name of the parent - property. Format: - properties/{propertyId} - Example: properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateRollupPropertyRequest, dict]]): + The request object. Request message for + CreateRollupProperty RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -13319,45 +10102,22 @@ async def sample_list_ad_sense_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAdSenseLinksAsyncPager: - Response message for ListAdSenseLinks - method. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.CreateRollupPropertyResponse: + Response message for + CreateRollupProperty RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.ListAdSenseLinksRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent + request = analytics_admin.CreateRollupPropertyRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_ad_sense_links, + self._client._transport.create_rollup_property, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - # Send the request. response = await rpc( request, @@ -13366,91 +10126,49 @@ async def sample_list_ad_sense_links(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListAdSenseLinksAsyncPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - async def get_event_create_rule( + async def get_rollup_property_source_link( self, request: Optional[ - Union[analytics_admin.GetEventCreateRuleRequest, dict] + Union[analytics_admin.GetRollupPropertySourceLinkRequest, dict] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> event_create_and_edit.EventCreateRule: - r"""Lookup for a single EventCreateRule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_get_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetEventCreateRuleRequest( - name="name_value", - ) - - # Make the request - response = await client.get_event_create_rule(request=request) - - # Handle the response - print(response) + ) -> resources.RollupPropertySourceLink: + r"""Lookup for a single roll-up property source Link. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.GetEventCreateRuleRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.GetRollupPropertySourceLinkRequest, dict]]): The request object. Request message for - GetEventCreateRule RPC. + GetRollupPropertySourceLink RPC. name (:class:`str`): - Required. The name of the - EventCreateRule to get. Example format: - properties/123/dataStreams/456/eventCreateRules/789 + Required. The name of the roll-up property source link + to lookup. Format: + properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link_id} + Example: properties/123/rollupPropertySourceLinks/456 This corresponds to the ``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.analytics.admin_v1alpha.types.EventCreateRule: - An Event Create Rule defines - conditions that will trigger the - creation of an entirely new event based - upon matched criteria of a source event. - Additional mutations of the parameters - from the source event can be defined. - - Unlike Event Edit rules, Event Creation - Rules have no defined order. They will - all be run independently. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. - Event Edit and Event Create rules can't - be used to modify an event created from - an Event Create rule. + Returns: + google.analytics.admin_v1alpha.types.RollupPropertySourceLink: + A link that references a source + property under the parent rollup + property. """ # Create or coerce a protobuf request object. @@ -13463,7 +10181,7 @@ async def sample_get_event_create_rule(): "the individual field arguments should be set." ) - request = analytics_admin.GetEventCreateRuleRequest(request) + request = analytics_admin.GetRollupPropertySourceLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -13473,7 +10191,7 @@ async def sample_get_event_create_rule(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_event_create_rule, + self._client._transport.get_rollup_property_source_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -13495,53 +10213,30 @@ async def sample_get_event_create_rule(): # Done; return the response. return response - async def list_event_create_rules( + async def list_rollup_property_source_links( self, request: Optional[ - Union[analytics_admin.ListEventCreateRulesRequest, dict] + Union[analytics_admin.ListRollupPropertySourceLinksRequest, dict] ] = None, *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListEventCreateRulesAsyncPager: - r"""Lists EventCreateRules on a web data stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_list_event_create_rules(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListEventCreateRulesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_event_create_rules(request=request) - - # Handle the response - async for response in page_result: - print(response) + ) -> pagers.ListRollupPropertySourceLinksAsyncPager: + r"""Lists roll-up property source Links on a property. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.ListEventCreateRulesRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.ListRollupPropertySourceLinksRequest, dict]]): The request object. Request message for - ListEventCreateRules RPC. + ListRollupPropertySourceLinks RPC. parent (:class:`str`): - Required. Example format: - properties/123/dataStreams/456 + Required. The name of the roll-up property to list + roll-up property source links under. Format: + properties/{property_id} Example: properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -13553,9 +10248,9 @@ async def sample_list_event_create_rules(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListEventCreateRulesAsyncPager: + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListRollupPropertySourceLinksAsyncPager: Response message for - ListEventCreateRules RPC. + ListRollupPropertySourceLinks RPC. Iterating over this object will yield results and resolve additional pages automatically. @@ -13571,7 +10266,7 @@ async def sample_list_event_create_rules(): "the individual field arguments should be set." ) - request = analytics_admin.ListEventCreateRulesRequest(request) + request = analytics_admin.ListRollupPropertySourceLinksRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -13581,7 +10276,7 @@ async def sample_list_event_create_rules(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_event_create_rules, + self._client._transport.list_rollup_property_source_links, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -13602,7 +10297,7 @@ async def sample_list_event_create_rules(): # This method is paged; wrap the response in a pager, which provides # an `__aiter__` convenience method. - response = pagers.ListEventCreateRulesAsyncPager( + response = pagers.ListRollupPropertySourceLinksAsyncPager( method=rpc, request=request, response=response, @@ -13612,69 +10307,41 @@ async def sample_list_event_create_rules(): # Done; return the response. return response - async def create_event_create_rule( + async def create_rollup_property_source_link( self, request: Optional[ - Union[analytics_admin.CreateEventCreateRuleRequest, dict] + Union[analytics_admin.CreateRollupPropertySourceLinkRequest, dict] ] = None, *, parent: Optional[str] = None, - event_create_rule: Optional[event_create_and_edit.EventCreateRule] = None, + rollup_property_source_link: Optional[ + resources.RollupPropertySourceLink + ] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> event_create_and_edit.EventCreateRule: - r"""Creates an EventCreateRule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_create_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - event_create_rule = admin_v1alpha.EventCreateRule() - event_create_rule.destination_event = "destination_event_value" - event_create_rule.event_conditions.field = "field_value" - event_create_rule.event_conditions.comparison_type = "REGULAR_EXPRESSION_CASE_INSENSITIVE" - event_create_rule.event_conditions.value = "value_value" - - request = admin_v1alpha.CreateEventCreateRuleRequest( - parent="parent_value", - event_create_rule=event_create_rule, - ) - - # Make the request - response = await client.create_event_create_rule(request=request) - - # Handle the response - print(response) + ) -> resources.RollupPropertySourceLink: + r"""Creates a roll-up property source link. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.CreateEventCreateRuleRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateRollupPropertySourceLinkRequest, dict]]): The request object. Request message for - CreateEventCreateRule RPC. + CreateRollupPropertySourceLink RPC. parent (:class:`str`): - Required. Example format: - properties/123/dataStreams/456 + Required. Format: properties/{property_id} Example: + properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - event_create_rule (:class:`google.analytics.admin_v1alpha.types.EventCreateRule`): - Required. The EventCreateRule to - create. + rollup_property_source_link (:class:`google.analytics.admin_v1alpha.types.RollupPropertySourceLink`): + Required. The roll-up property source + link to create. - This corresponds to the ``event_create_rule`` field + This corresponds to the ``rollup_property_source_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, @@ -13684,46 +10351,35 @@ async def sample_create_event_create_rule(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.EventCreateRule: - An Event Create Rule defines - conditions that will trigger the - creation of an entirely new event based - upon matched criteria of a source event. - Additional mutations of the parameters - from the source event can be defined. - - Unlike Event Edit rules, Event Creation - Rules have no defined order. They will - all be run independently. - - Event Edit and Event Create rules can't - be used to modify an event created from - an Event Create rule. + google.analytics.admin_v1alpha.types.RollupPropertySourceLink: + A link that references a source + property under the parent rollup + property. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, event_create_rule]) + has_flattened_params = any([parent, rollup_property_source_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateEventCreateRuleRequest(request) + request = analytics_admin.CreateRollupPropertySourceLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if event_create_rule is not None: - request.event_create_rule = event_create_rule + if rollup_property_source_link is not None: + request.rollup_property_source_link = rollup_property_source_link # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_event_create_rule, + self._client._transport.create_rollup_property_source_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -13745,72 +10401,32 @@ async def sample_create_event_create_rule(): # Done; return the response. return response - async def update_event_create_rule( + async def delete_rollup_property_source_link( self, request: Optional[ - Union[analytics_admin.UpdateEventCreateRuleRequest, dict] + Union[analytics_admin.DeleteRollupPropertySourceLinkRequest, dict] ] = None, *, - event_create_rule: Optional[event_create_and_edit.EventCreateRule] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> event_create_and_edit.EventCreateRule: - r"""Updates an EventCreateRule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_update_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - event_create_rule = admin_v1alpha.EventCreateRule() - event_create_rule.destination_event = "destination_event_value" - event_create_rule.event_conditions.field = "field_value" - event_create_rule.event_conditions.comparison_type = "REGULAR_EXPRESSION_CASE_INSENSITIVE" - event_create_rule.event_conditions.value = "value_value" - - request = admin_v1alpha.UpdateEventCreateRuleRequest( - event_create_rule=event_create_rule, - ) - - # Make the request - response = await client.update_event_create_rule(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a roll-up property source link. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateEventCreateRuleRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteRollupPropertySourceLinkRequest, dict]]): The request object. Request message for - UpdateEventCreateRule RPC. - event_create_rule (:class:`google.analytics.admin_v1alpha.types.EventCreateRule`): - Required. The EventCreateRule to update. The resource's - ``name`` field is used to identify the EventCreateRule - to be updated. - - This corresponds to the ``event_create_rule`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + DeleteRollupPropertySourceLink RPC. + name (:class:`str`): + Required. Format: + properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link_id} + Example: properties/1234/rollupPropertySourceLinks/5678 - This corresponds to the ``update_mask`` field + This corresponds to the ``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, @@ -13818,48 +10434,28 @@ async def sample_update_event_create_rule(): 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.analytics.admin_v1alpha.types.EventCreateRule: - An Event Create Rule defines - conditions that will trigger the - creation of an entirely new event based - upon matched criteria of a source event. - Additional mutations of the parameters - from the source event can be defined. - - Unlike Event Edit rules, Event Creation - Rules have no defined order. They will - all be run independently. - - Event Edit and Event Create rules can't - be used to modify an event created from - an Event Create rule. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([event_create_rule, update_mask]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateEventCreateRuleRequest(request) + request = analytics_admin.DeleteRollupPropertySourceLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if event_create_rule is not None: - request.event_create_rule = event_create_rule - if update_mask is not None: - request.update_mask = update_mask + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_event_create_rule, + self._client._transport.delete_rollup_property_source_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -13867,9 +10463,53 @@ async def sample_update_event_create_rule(): # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("event_create_rule.name", request.event_create_rule.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + async def create_subproperty( + self, + request: Optional[Union[analytics_admin.CreateSubpropertyRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> analytics_admin.CreateSubpropertyResponse: + r"""Create a subproperty and a subproperty event filter + that applies to the created subproperty. + + Args: + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateSubpropertyRequest, dict]]): + The request object. Request message for CreateSubproperty + RPC. + 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.analytics.admin_v1alpha.types.CreateSubpropertyResponse: + Response message for + CreateSubproperty RPC. + + """ + # Create or coerce a protobuf request object. + request = analytics_admin.CreateSubpropertyRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_subproperty, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, ) # Send the request. @@ -13883,10 +10523,10 @@ async def sample_update_event_create_rule(): # Done; return the response. return response - async def delete_event_create_rule( + async def delete_subproperty_event_filter( self, request: Optional[ - Union[analytics_admin.DeleteEventCreateRuleRequest, dict] + Union[analytics_admin.DeleteSubpropertyEventFilterRequest, dict] ] = None, *, name: Optional[str] = None, @@ -13894,39 +10534,17 @@ async def delete_event_create_rule( timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: - r"""Deletes an EventCreateRule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - async def sample_delete_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteEventCreateRuleRequest( - name="name_value", - ) - - # Make the request - await client.delete_event_create_rule(request=request) + r"""Deletes a subproperty event filter. Args: - request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteEventCreateRuleRequest, dict]]): + request (Optional[Union[google.analytics.admin_v1alpha.types.DeleteSubpropertyEventFilterRequest, dict]]): The request object. Request message for - DeleteEventCreateRule RPC. + DeleteSubpropertyEventFilter RPC. name (:class:`str`): - Required. Example format: - - properties/123/dataStreams/456/eventCreateRules/789 + Required. Resource name of the subproperty event filter + to delete. Format: + properties/property_id/subpropertyEventFilters/subproperty_event_filter + Example: properties/123/subpropertyEventFilters/456 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -13947,7 +10565,7 @@ async def sample_delete_event_create_rule(): "the individual field arguments should be set." ) - request = analytics_admin.DeleteEventCreateRuleRequest(request) + request = analytics_admin.DeleteSubpropertyEventFilterRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -13957,7 +10575,7 @@ async def sample_delete_event_create_rule(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.delete_event_create_rule, + self._client._transport.delete_subproperty_event_filter, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -13976,6 +10594,97 @@ async def sample_delete_event_create_rule(): metadata=metadata, ) + async def create_subproperty_event_filter( + self, + request: Optional[ + Union[analytics_admin.CreateSubpropertyEventFilterRequest, dict] + ] = None, + *, + parent: Optional[str] = None, + subproperty_event_filter: Optional[ + gaa_subproperty_event_filter.SubpropertyEventFilter + ] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gaa_subproperty_event_filter.SubpropertyEventFilter: + r"""Creates a subproperty Event Filter. + + Args: + request (Optional[Union[google.analytics.admin_v1alpha.types.CreateSubpropertyEventFilterRequest, dict]]): + The request object. Request message for + CreateSubpropertyEventFilter RPC. + parent (:class:`str`): + Required. The ordinary property for which to create a + subproperty event filter. Format: properties/property_id + Example: properties/123 + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + subproperty_event_filter (:class:`google.analytics.admin_v1alpha.types.SubpropertyEventFilter`): + Required. The subproperty event + filter to create. + + This corresponds to the ``subproperty_event_filter`` 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.analytics.admin_v1alpha.types.SubpropertyEventFilter: + A resource message representing a GA4 + Subproperty event filter. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, subproperty_event_filter]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.CreateSubpropertyEventFilterRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if subproperty_event_filter is not None: + request.subproperty_event_filter = subproperty_event_filter + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_subproperty_event_filter, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + async def __aenter__(self) -> "AnalyticsAdminServiceAsyncClient": return self diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py index 99b23878..fa4ece48 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py @@ -55,6 +55,9 @@ from google.analytics.admin_v1alpha.types import ( expanded_data_set as gaa_expanded_data_set, ) +from google.analytics.admin_v1alpha.types import ( + subproperty_event_filter as gaa_subproperty_event_filter, +) from google.analytics.admin_v1alpha.types import access_report, analytics_admin from google.analytics.admin_v1alpha.types import audience from google.analytics.admin_v1alpha.types import audience as gaa_audience @@ -62,6 +65,7 @@ from google.analytics.admin_v1alpha.types import event_create_and_edit from google.analytics.admin_v1alpha.types import expanded_data_set from google.analytics.admin_v1alpha.types import resources +from google.analytics.admin_v1alpha.types import subproperty_event_filter from .transports.base import DEFAULT_CLIENT_INFO, AnalyticsAdminServiceTransport from .transports.grpc import AnalyticsAdminServiceGrpcTransport @@ -390,6 +394,26 @@ def parse_custom_metric_path(path: str) -> Dict[str, str]: ) return m.groupdict() if m else {} + @staticmethod + def data_redaction_settings_path( + property: str, + data_stream: str, + ) -> str: + """Returns a fully-qualified data_redaction_settings string.""" + return "properties/{property}/dataStreams/{data_stream}/dataRedactionSettings".format( + property=property, + data_stream=data_stream, + ) + + @staticmethod + def parse_data_redaction_settings_path(path: str) -> Dict[str, str]: + """Parses a data_redaction_settings path into its component segments.""" + m = re.match( + r"^properties/(?P.+?)/dataStreams/(?P.+?)/dataRedactionSettings$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def data_retention_settings_path( property: str, @@ -654,6 +678,26 @@ def parse_property_path(path: str) -> Dict[str, str]: m = re.match(r"^properties/(?P.+?)$", path) return m.groupdict() if m else {} + @staticmethod + def rollup_property_source_link_path( + property: str, + rollup_property_source_link: str, + ) -> str: + """Returns a fully-qualified rollup_property_source_link string.""" + return "properties/{property}/rollupPropertySourceLinks/{rollup_property_source_link}".format( + property=property, + rollup_property_source_link=rollup_property_source_link, + ) + + @staticmethod + def parse_rollup_property_source_link_path(path: str) -> Dict[str, str]: + """Parses a rollup_property_source_link path into its component segments.""" + m = re.match( + r"^properties/(?P.+?)/rollupPropertySourceLinks/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def search_ads360_link_path( property: str, @@ -697,20 +741,23 @@ def parse_sk_ad_network_conversion_value_schema_path(path: str) -> Dict[str, str return m.groupdict() if m else {} @staticmethod - def user_link_path( - account: str, - user_link: str, + def subproperty_event_filter_path( + property: str, + sub_property_event_filter: str, ) -> str: - """Returns a fully-qualified user_link string.""" - return "accounts/{account}/userLinks/{user_link}".format( - account=account, - user_link=user_link, + """Returns a fully-qualified subproperty_event_filter string.""" + return "properties/{property}/subpropertyEventFilters/{sub_property_event_filter}".format( + property=property, + sub_property_event_filter=sub_property_event_filter, ) @staticmethod - def parse_user_link_path(path: str) -> Dict[str, str]: - """Parses a user_link path into its component segments.""" - m = re.match(r"^accounts/(?P.+?)/userLinks/(?P.+?)$", path) + def parse_subproperty_event_filter_path(path: str) -> Dict[str, str]: + """Parses a subproperty_event_filter path into its component segments.""" + m = re.match( + r"^properties/(?P.+?)/subpropertyEventFilters/(?P.+?)$", + path, + ) return m.groupdict() if m else {} @staticmethod @@ -968,32 +1015,6 @@ def get_account( ) -> resources.Account: r"""Lookup for a single Account. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_account(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAccountRequest( - name="name_value", - ) - - # Make the request - response = client.get_account(request=request) - - # Handle the response - print(response) - Args: request (Union[google.analytics.admin_v1alpha.types.GetAccountRequest, dict]): The request object. Request message for GetAccount RPC. @@ -1074,32 +1095,6 @@ def list_accounts( excluded by default. Returns an empty list if no relevant accounts are found. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_accounts(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAccountsRequest( - ) - - # Make the request - page_result = client.list_accounts(request=request) - - # Handle the response - for response in page_result: - print(response) - Args: request (Union[google.analytics.admin_v1alpha.types.ListAccountsRequest, dict]): The request object. Request message for ListAccounts RPC. @@ -1167,35 +1162,12 @@ def delete_account( If the accounts are not restored before the expiration time, the account and all child resources (eg: - Properties, GoogleAdsLinks, Streams, UserLinks) will be - permanently purged. + Properties, GoogleAdsLinks, Streams, AccessBindings) + will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_account(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteAccountRequest( - name="name_value", - ) - - # Make the request - client.delete_account(request=request) - Args: request (Union[google.analytics.admin_v1alpha.types.DeleteAccountRequest, dict]): The request object. Request message for DeleteAccount @@ -1265,35 +1237,6 @@ def update_account( ) -> resources.Account: r"""Updates an account. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_account(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - account = admin_v1alpha.Account() - account.display_name = "display_name_value" - - request = admin_v1alpha.UpdateAccountRequest( - account=account, - ) - - # Make the request - response = client.update_account(request=request) - - # Handle the response - print(response) - Args: request (Union[google.analytics.admin_v1alpha.types.UpdateAccountRequest, dict]): The request object. Request message for UpdateAccount @@ -1385,31 +1328,6 @@ def provision_account_ticket( ) -> analytics_admin.ProvisionAccountTicketResponse: r"""Requests a ticket for creating an account. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_provision_account_ticket(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ProvisionAccountTicketRequest( - ) - - # Make the request - response = client.provision_account_ticket(request=request) - - # Handle the response - print(response) - Args: request (Union[google.analytics.admin_v1alpha.types.ProvisionAccountTicketRequest, dict]): The request object. Request message for @@ -1462,32 +1380,6 @@ def list_account_summaries( r"""Returns summaries of all accounts accessible by the caller. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_account_summaries(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAccountSummariesRequest( - ) - - # Make the request - page_result = client.list_account_summaries(request=request) - - # Handle the response - for response in page_result: - print(response) - Args: request (Union[google.analytics.admin_v1alpha.types.ListAccountSummariesRequest, dict]): The request object. Request message for @@ -1550,32 +1442,6 @@ def get_property( ) -> resources.Property: r"""Lookup for a single "GA4" Property. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetPropertyRequest( - name="name_value", - ) - - # Make the request - response = client.get_property(request=request) - - # Handle the response - print(response) - Args: request (Union[google.analytics.admin_v1alpha.types.GetPropertyRequest, dict]): The request object. Request message for GetProperty RPC. @@ -1656,33 +1522,6 @@ def list_properties( excluded by default. Returns an empty list if no relevant properties are found. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_properties(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListPropertiesRequest( - filter="filter_value", - ) - - # Make the request - page_result = client.list_properties(request=request) - - # Handle the response - for response in page_result: - print(response) - Args: request (Union[google.analytics.admin_v1alpha.types.ListPropertiesRequest, dict]): The request object. Request message for ListProperties @@ -1746,36 +1585,6 @@ def create_property( r"""Creates an "GA4" property with the specified location and attributes. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - property = admin_v1alpha.Property() - property.display_name = "display_name_value" - property.time_zone = "time_zone_value" - - request = admin_v1alpha.CreatePropertyRequest( - property=property, - ) - - # Make the request - response = client.create_property(request=request) - - # Handle the response - print(response) - Args: request (Union[google.analytics.admin_v1alpha.types.CreatePropertyRequest, dict]): The request object. Request message for CreateProperty @@ -1853,39 +1662,13 @@ def delete_property( If the properties are not restored before the expiration time, the Property and all child resources (eg: - GoogleAdsLinks, Streams, UserLinks) will be permanently - purged. + GoogleAdsLinks, Streams, AccessBindings) will be + permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found, or is not a GA4 Property. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeletePropertyRequest( - name="name_value", - ) - - # Make the request - response = client.delete_property(request=request) - - # Handle the response - print(response) - Args: request (Union[google.analytics.admin_v1alpha.types.DeletePropertyRequest, dict]): The request object. Request message for DeleteProperty @@ -1964,36 +1747,6 @@ def update_property( ) -> resources.Property: r"""Updates a property. - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - property = admin_v1alpha.Property() - property.display_name = "display_name_value" - property.time_zone = "time_zone_value" - - request = admin_v1alpha.UpdatePropertyRequest( - property=property, - ) - - # Make the request - response = client.update_property(request=request) - - # Handle the response - print(response) - Args: request (Union[google.analytics.admin_v1alpha.types.UpdatePropertyRequest, dict]): The request object. Request message for UpdateProperty @@ -2074,52 +1827,38 @@ def sample_update_property(): # Done; return the response. return response - def get_user_link( + def create_firebase_link( self, - request: Optional[Union[analytics_admin.GetUserLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.CreateFirebaseLinkRequest, dict] + ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, + firebase_link: Optional[resources.FirebaseLink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.UserLink: - r"""Gets information about a user's link to an account or - property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetUserLinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_user_link(request=request) + ) -> resources.FirebaseLink: + r"""Creates a FirebaseLink. - # Handle the response - print(response) + Properties can have at most one FirebaseLink. Args: - request (Union[google.analytics.admin_v1alpha.types.GetUserLinkRequest, dict]): - The request object. Request message for GetUserLink RPC. - name (str): - Required. Example format: - accounts/1234/userLinks/5678 + request (Union[google.analytics.admin_v1alpha.types.CreateFirebaseLinkRequest, dict]): + The request object. Request message for + CreateFirebaseLink RPC + parent (str): + Required. Format: properties/{property_id} Example: + properties/1234 - This corresponds to the ``name`` field + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + firebase_link (google.analytics.admin_v1alpha.types.FirebaseLink): + Required. The Firebase link to + create. + + This corresponds to the ``firebase_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, @@ -2129,16 +1868,15 @@ def sample_get_user_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.UserLink: - A resource message representing a - user's permissions on an Account or - Property resource. + google.analytics.admin_v1alpha.types.FirebaseLink: + A link between a GA4 property and a + Firebase project. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent, firebase_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -2146,24 +1884,26 @@ def sample_get_user_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetUserLinkRequest. + # in a analytics_admin.CreateFirebaseLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetUserLinkRequest): - request = analytics_admin.GetUserLinkRequest(request) + if not isinstance(request, analytics_admin.CreateFirebaseLinkRequest): + request = analytics_admin.CreateFirebaseLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent + if firebase_link is not None: + request.firebase_link = firebase_link # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_user_link] + rpc = self._transport._wrapped_methods[self._transport.create_firebase_link] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -2177,134 +1917,95 @@ def sample_get_user_link(): # Done; return the response. return response - def batch_get_user_links( + def delete_firebase_link( self, - request: Optional[Union[analytics_admin.BatchGetUserLinksRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.DeleteFirebaseLinkRequest, dict] + ] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchGetUserLinksResponse: - r"""Gets information about multiple users' links to an - account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_batch_get_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.BatchGetUserLinksRequest( - parent="parent_value", - names=['names_value1', 'names_value2'], - ) - - # Make the request - response = client.batch_get_user_links(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a FirebaseLink on a property Args: - request (Union[google.analytics.admin_v1alpha.types.BatchGetUserLinksRequest, dict]): - The request object. Request message for BatchGetUserLinks - RPC. + request (Union[google.analytics.admin_v1alpha.types.DeleteFirebaseLinkRequest, dict]): + The request object. Request message for + DeleteFirebaseLink RPC + name (str): + Required. Format: + properties/{property_id}/firebaseLinks/{firebase_link_id} + Example: properties/1234/firebaseLinks/5678 + + This corresponds to the ``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.analytics.admin_v1alpha.types.BatchGetUserLinksResponse: - Response message for - BatchGetUserLinks RPC. - """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + 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 analytics_admin.BatchGetUserLinksRequest. + # in a analytics_admin.DeleteFirebaseLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.BatchGetUserLinksRequest): - request = analytics_admin.BatchGetUserLinksRequest(request) + if not isinstance(request, analytics_admin.DeleteFirebaseLinkRequest): + request = analytics_admin.DeleteFirebaseLinkRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.batch_get_user_links] + rpc = self._transport._wrapped_methods[self._transport.delete_firebase_link] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = rpc( + rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - def list_user_links( + def list_firebase_links( self, - request: Optional[Union[analytics_admin.ListUserLinksRequest, dict]] = None, + request: Optional[Union[analytics_admin.ListFirebaseLinksRequest, dict]] = None, *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListUserLinksPager: - r"""Lists all user links on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListUserLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_user_links(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> pagers.ListFirebaseLinksPager: + r"""Lists FirebaseLinks on a property. + Properties can have at most one FirebaseLink. Args: - request (Union[google.analytics.admin_v1alpha.types.ListUserLinksRequest, dict]): - The request object. Request message for ListUserLinks - RPC. + request (Union[google.analytics.admin_v1alpha.types.ListFirebaseLinksRequest, dict]): + The request object. Request message for ListFirebaseLinks + RPC parent (str): - Required. Example format: - accounts/1234 + Required. Format: properties/{property_id} Example: + properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -2316,9 +2017,9 @@ def sample_list_user_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListUserLinksPager: - Response message for ListUserLinks - RPC. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListFirebaseLinksPager: + Response message for + ListFirebaseLinks RPC Iterating over this object will yield results and resolve additional pages automatically. @@ -2335,11 +2036,11 @@ def sample_list_user_links(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListUserLinksRequest. + # in a analytics_admin.ListFirebaseLinksRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListUserLinksRequest): - request = analytics_admin.ListUserLinksRequest(request) + if not isinstance(request, analytics_admin.ListFirebaseLinksRequest): + request = analytics_admin.ListFirebaseLinksRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: @@ -2347,7 +2048,7 @@ def sample_list_user_links(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_user_links] + rpc = self._transport._wrapped_methods[self._transport.list_firebase_links] # Certain fields should be provided within the metadata header; # add these here. @@ -2365,7 +2066,7 @@ def sample_list_user_links(): # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. - response = pagers.ListUserLinksPager( + response = pagers.ListFirebaseLinksPager( method=rpc, request=request, response=response, @@ -2375,57 +2076,32 @@ def sample_list_user_links(): # Done; return the response. return response - def audit_user_links( + def get_global_site_tag( self, - request: Optional[Union[analytics_admin.AuditUserLinksRequest, dict]] = None, + request: Optional[Union[analytics_admin.GetGlobalSiteTagRequest, dict]] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.AuditUserLinksPager: - r"""Lists all user links on an account or property, - including implicit ones that come from effective - permissions granted by groups or organization admin - roles. - - If a returned user link does not have direct - permissions, they cannot be removed from the account or - property directly with the DeleteUserLink command. They - have to be removed from the group/etc that gives them - permissions, which is currently only usable/discoverable - in the GA or GMP UIs. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_audit_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.AuditUserLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.audit_user_links(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> resources.GlobalSiteTag: + r"""Returns the Site Tag for the specified web stream. + Site Tags are immutable singletons. Args: - request (Union[google.analytics.admin_v1alpha.types.AuditUserLinksRequest, dict]): - The request object. Request message for AuditUserLinks + request (Union[google.analytics.admin_v1alpha.types.GetGlobalSiteTagRequest, dict]): + The request object. Request message for GetGlobalSiteTag RPC. + name (str): + Required. The name of the site tag to lookup. Note that + site tags are singletons and do not have unique IDs. + Format: + properties/{property_id}/dataStreams/{stream_id}/globalSiteTag + Example: "properties/123/dataStreams/456/globalSiteTag" + + This corresponds to the ``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. @@ -2433,30 +2109,42 @@ def sample_audit_user_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.AuditUserLinksPager: - Response message for AuditUserLinks - RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.GlobalSiteTag: + Read-only resource with the tag for + sending data from a website to a + DataStream. Only present for web + DataStream resources. """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + 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 analytics_admin.AuditUserLinksRequest. + # in a analytics_admin.GetGlobalSiteTagRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.AuditUserLinksRequest): - request = analytics_admin.AuditUserLinksRequest(request) + if not isinstance(request, analytics_admin.GetGlobalSiteTagRequest): + request = analytics_admin.GetGlobalSiteTagRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.audit_user_links] + rpc = self._transport._wrapped_methods[self._transport.get_global_site_tag] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -2467,85 +2155,39 @@ def sample_audit_user_links(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.AuditUserLinksPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - def create_user_link( + def create_google_ads_link( self, - request: Optional[Union[analytics_admin.CreateUserLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.CreateGoogleAdsLinkRequest, dict] + ] = None, *, parent: Optional[str] = None, - user_link: Optional[resources.UserLink] = None, + google_ads_link: Optional[resources.GoogleAdsLink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.UserLink: - r"""Creates a user link on an account or property. - - If the user with the specified email already has - permissions on the account or property, then the user's - existing permissions will be unioned with the - permissions specified in the new UserLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateUserLinkRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_user_link(request=request) - - # Handle the response - print(response) + ) -> resources.GoogleAdsLink: + r"""Creates a GoogleAdsLink. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateUserLinkRequest, dict]): - The request object. Request message for CreateUserLink - RPC. - Users can have multiple email addresses - associated with their Google account, - and one of these email addresses is the - "primary" email address. Any of the - email addresses associated with a Google - account may be used for a new UserLink, - but the returned UserLink will always - contain the "primary" email address. As - a result, the input and output email - address for this request may differ. + request (Union[google.analytics.admin_v1alpha.types.CreateGoogleAdsLinkRequest, dict]): + The request object. Request message for + CreateGoogleAdsLink RPC parent (str): Required. Example format: - accounts/1234 + properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - user_link (google.analytics.admin_v1alpha.types.UserLink): - Required. The user link to create. - This corresponds to the ``user_link`` field + google_ads_link (google.analytics.admin_v1alpha.types.GoogleAdsLink): + Required. The GoogleAdsLink to + create. + + This corresponds to the ``google_ads_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, @@ -2555,16 +2197,15 @@ def sample_create_user_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.UserLink: - A resource message representing a - user's permissions on an Account or - Property resource. + google.analytics.admin_v1alpha.types.GoogleAdsLink: + A link between a GA4 property and a + Google Ads account. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, user_link]) + has_flattened_params = any([parent, google_ads_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -2572,21 +2213,21 @@ def sample_create_user_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateUserLinkRequest. + # in a analytics_admin.CreateGoogleAdsLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateUserLinkRequest): - request = analytics_admin.CreateUserLinkRequest(request) + if not isinstance(request, analytics_admin.CreateGoogleAdsLinkRequest): + request = analytics_admin.CreateGoogleAdsLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if user_link is not None: - request.user_link = user_link + if google_ads_link is not None: + request.google_ads_link = google_ads_link # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_user_link] + rpc = self._transport._wrapped_methods[self._transport.create_google_ads_link] # Certain fields should be provided within the metadata header; # add these here. @@ -2605,55 +2246,39 @@ def sample_create_user_link(): # Done; return the response. return response - def batch_create_user_links( + def update_google_ads_link( self, request: Optional[ - Union[analytics_admin.BatchCreateUserLinksRequest, dict] + Union[analytics_admin.UpdateGoogleAdsLinkRequest, dict] ] = None, *, + google_ads_link: Optional[resources.GoogleAdsLink] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchCreateUserLinksResponse: - r"""Creates information about multiple users' links to an - account or property. - This method is transactional. If any UserLink cannot be - created, none of the UserLinks will be created. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_batch_create_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - requests = admin_v1alpha.CreateUserLinkRequest() - requests.parent = "parent_value" - - request = admin_v1alpha.BatchCreateUserLinksRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - response = client.batch_create_user_links(request=request) - - # Handle the response - print(response) + ) -> resources.GoogleAdsLink: + r"""Updates a GoogleAdsLink on a property Args: - request (Union[google.analytics.admin_v1alpha.types.BatchCreateUserLinksRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.UpdateGoogleAdsLinkRequest, dict]): The request object. Request message for - BatchCreateUserLinks RPC. + UpdateGoogleAdsLink RPC + google_ads_link (google.analytics.admin_v1alpha.types.GoogleAdsLink): + The GoogleAdsLink to update + This corresponds to the ``google_ads_link`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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. @@ -2661,27 +2286,44 @@ def sample_batch_create_user_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.BatchCreateUserLinksResponse: - Response message for - BatchCreateUserLinks RPC. + google.analytics.admin_v1alpha.types.GoogleAdsLink: + A link between a GA4 property and a + Google Ads account. """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([google_ads_link, update_mask]) + if request is not None and has_flattened_params: + 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 analytics_admin.BatchCreateUserLinksRequest. + # in a analytics_admin.UpdateGoogleAdsLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.BatchCreateUserLinksRequest): - request = analytics_admin.BatchCreateUserLinksRequest(request) + if not isinstance(request, analytics_admin.UpdateGoogleAdsLinkRequest): + request = analytics_admin.UpdateGoogleAdsLinkRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if google_ads_link is not None: + request.google_ads_link = google_ads_link + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.batch_create_user_links] + rpc = self._transport._wrapped_methods[self._transport.update_google_ads_link] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata( + (("google_ads_link.name", request.google_ads_link.name),) + ), ) # Send the request. @@ -2695,49 +2337,28 @@ def sample_batch_create_user_links(): # Done; return the response. return response - def update_user_link( + def delete_google_ads_link( self, - request: Optional[Union[analytics_admin.UpdateUserLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.DeleteGoogleAdsLinkRequest, dict] + ] = None, *, - user_link: Optional[resources.UserLink] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.UserLink: - r"""Updates a user link on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateUserLinkRequest( - ) - - # Make the request - response = client.update_user_link(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a GoogleAdsLink on a property Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateUserLinkRequest, dict]): - The request object. Request message for UpdateUserLink - RPC. - user_link (google.analytics.admin_v1alpha.types.UserLink): - Required. The user link to update. - This corresponds to the ``user_link`` field + request (Union[google.analytics.admin_v1alpha.types.DeleteGoogleAdsLinkRequest, dict]): + The request object. Request message for + DeleteGoogleAdsLink RPC. + name (str): + Required. Example format: + properties/1234/googleAdsLinks/5678 + + This corresponds to the ``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, @@ -2745,18 +2366,11 @@ def sample_update_user_link(): 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.analytics.admin_v1alpha.types.UserLink: - A resource message representing a - user's permissions on an Account or - Property resource. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([user_link]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -2764,82 +2378,58 @@ def sample_update_user_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateUserLinkRequest. + # in a analytics_admin.DeleteGoogleAdsLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateUserLinkRequest): - request = analytics_admin.UpdateUserLinkRequest(request) + if not isinstance(request, analytics_admin.DeleteGoogleAdsLinkRequest): + request = analytics_admin.DeleteGoogleAdsLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if user_link is not None: - request.user_link = user_link + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_user_link] + rpc = self._transport._wrapped_methods[self._transport.delete_google_ads_link] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("user_link.name", request.user_link.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = rpc( + rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - def batch_update_user_links( + def list_google_ads_links( self, request: Optional[ - Union[analytics_admin.BatchUpdateUserLinksRequest, dict] + Union[analytics_admin.ListGoogleAdsLinksRequest, dict] ] = None, *, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchUpdateUserLinksResponse: - r"""Updates information about multiple users' links to an - account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_batch_update_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.BatchUpdateUserLinksRequest( - parent="parent_value", - ) - - # Make the request - response = client.batch_update_user_links(request=request) - - # Handle the response - print(response) + ) -> pagers.ListGoogleAdsLinksPager: + r"""Lists GoogleAdsLinks on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.BatchUpdateUserLinksRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ListGoogleAdsLinksRequest, dict]): The request object. Request message for - BatchUpdateUserLinks RPC. + ListGoogleAdsLinks RPC. + parent (str): + Required. Example format: + properties/1234 + + This corresponds to the ``parent`` 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. @@ -2847,22 +2437,38 @@ def sample_batch_update_user_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.BatchUpdateUserLinksResponse: + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListGoogleAdsLinksPager: Response message for - BatchUpdateUserLinks RPC. + ListGoogleAdsLinks RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + 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 analytics_admin.BatchUpdateUserLinksRequest. + # in a analytics_admin.ListGoogleAdsLinksRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.BatchUpdateUserLinksRequest): - request = analytics_admin.BatchUpdateUserLinksRequest(request) + if not isinstance(request, analytics_admin.ListGoogleAdsLinksRequest): + request = analytics_admin.ListGoogleAdsLinksRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.batch_update_user_links] + rpc = self._transport._wrapped_methods[self._transport.list_google_ads_links] # Certain fields should be provided within the metadata header; # add these here. @@ -2878,52 +2484,44 @@ def sample_batch_update_user_links(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListGoogleAdsLinksPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - def delete_user_link( + def get_data_sharing_settings( self, - request: Optional[Union[analytics_admin.DeleteUserLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.GetDataSharingSettingsRequest, dict] + ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a user link on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteUserLinkRequest( - name="name_value", - ) - - # Make the request - client.delete_user_link(request=request) + ) -> resources.DataSharingSettings: + r"""Get data sharing settings on an account. + Data sharing settings are singletons. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteUserLinkRequest, dict]): - The request object. Request message for DeleteUserLink - RPC. + request (Union[google.analytics.admin_v1alpha.types.GetDataSharingSettingsRequest, dict]): + The request object. Request message for + GetDataSharingSettings RPC. name (str): - Required. Example format: - accounts/1234/userLinks/5678 - - This corresponds to the ``name`` field + Required. The name of the settings to + lookup. Format: + accounts/{account}/dataSharingSettings + Example: + "accounts/1000/dataSharingSettings" + + This corresponds to the ``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, @@ -2931,6 +2529,13 @@ def sample_delete_user_link(): 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.analytics.admin_v1alpha.types.DataSharingSettings: + A resource message representing data + sharing settings of a Google Analytics + account. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -2943,11 +2548,11 @@ def sample_delete_user_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteUserLinkRequest. + # in a analytics_admin.GetDataSharingSettingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.DeleteUserLinkRequest): - request = analytics_admin.DeleteUserLinkRequest(request) + if not isinstance(request, analytics_admin.GetDataSharingSettingsRequest): + request = analytics_admin.GetDataSharingSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -2955,7 +2560,9 @@ def sample_delete_user_link(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_user_link] + rpc = self._transport._wrapped_methods[ + self._transport.get_data_sharing_settings + ] # Certain fields should be provided within the metadata header; # add these here. @@ -2964,147 +2571,123 @@ def sample_delete_user_link(): ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def batch_delete_user_links( + # Done; return the response. + return response + + def get_measurement_protocol_secret( self, request: Optional[ - Union[analytics_admin.BatchDeleteUserLinksRequest, dict] + Union[analytics_admin.GetMeasurementProtocolSecretRequest, dict] ] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes information about multiple users' links to an - account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_batch_delete_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - requests = admin_v1alpha.DeleteUserLinkRequest() - requests.name = "name_value" - - request = admin_v1alpha.BatchDeleteUserLinksRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - client.batch_delete_user_links(request=request) + ) -> resources.MeasurementProtocolSecret: + r"""Lookup for a single "GA4" MeasurementProtocolSecret. Args: - request (Union[google.analytics.admin_v1alpha.types.BatchDeleteUserLinksRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.GetMeasurementProtocolSecretRequest, dict]): The request object. Request message for - BatchDeleteUserLinks RPC. + GetMeasurementProtocolSecret RPC. + name (str): + Required. The name of the measurement + protocol secret to lookup. Format: + + properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret} + + This corresponds to the ``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.analytics.admin_v1alpha.types.MeasurementProtocolSecret: + A secret value used for sending hits + to Measurement Protocol. + """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + 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 analytics_admin.BatchDeleteUserLinksRequest. + # in a analytics_admin.GetMeasurementProtocolSecretRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.BatchDeleteUserLinksRequest): - request = analytics_admin.BatchDeleteUserLinksRequest(request) + if not isinstance(request, analytics_admin.GetMeasurementProtocolSecretRequest): + request = analytics_admin.GetMeasurementProtocolSecretRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.batch_delete_user_links] + rpc = self._transport._wrapped_methods[ + self._transport.get_measurement_protocol_secret + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def create_firebase_link( + # Done; return the response. + return response + + def list_measurement_protocol_secrets( self, request: Optional[ - Union[analytics_admin.CreateFirebaseLinkRequest, dict] + Union[analytics_admin.ListMeasurementProtocolSecretsRequest, dict] ] = None, *, parent: Optional[str] = None, - firebase_link: Optional[resources.FirebaseLink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.FirebaseLink: - r"""Creates a FirebaseLink. - - Properties can have at most one FirebaseLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_firebase_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateFirebaseLinkRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_firebase_link(request=request) - - # Handle the response - print(response) + ) -> pagers.ListMeasurementProtocolSecretsPager: + r"""Returns child MeasurementProtocolSecrets under the + specified parent Property. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateFirebaseLinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ListMeasurementProtocolSecretsRequest, dict]): The request object. Request message for - CreateFirebaseLink RPC + ListMeasurementProtocolSecret RPC parent (str): - Required. Format: properties/{property_id} Example: - properties/1234 + Required. The resource name of the + parent stream. Format: - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - firebase_link (google.analytics.admin_v1alpha.types.FirebaseLink): - Required. The Firebase link to - create. + properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets - This corresponds to the ``firebase_link`` field + This corresponds to the ``parent`` 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, @@ -3114,15 +2697,18 @@ def sample_create_firebase_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.FirebaseLink: - A link between a GA4 property and a - Firebase project. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListMeasurementProtocolSecretsPager: + Response message for + ListMeasurementProtocolSecret RPC + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, firebase_link]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -3130,21 +2716,23 @@ def sample_create_firebase_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateFirebaseLinkRequest. + # in a analytics_admin.ListMeasurementProtocolSecretsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateFirebaseLinkRequest): - request = analytics_admin.CreateFirebaseLinkRequest(request) + if not isinstance( + request, analytics_admin.ListMeasurementProtocolSecretsRequest + ): + request = analytics_admin.ListMeasurementProtocolSecretsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if firebase_link is not None: - request.firebase_link = firebase_link # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_firebase_link] + rpc = self._transport._wrapped_methods[ + self._transport.list_measurement_protocol_secrets + ] # Certain fields should be provided within the metadata header; # add these here. @@ -3160,55 +2748,51 @@ def sample_create_firebase_link(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListMeasurementProtocolSecretsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - def delete_firebase_link( + def create_measurement_protocol_secret( self, request: Optional[ - Union[analytics_admin.DeleteFirebaseLinkRequest, dict] + Union[analytics_admin.CreateMeasurementProtocolSecretRequest, dict] ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, + measurement_protocol_secret: Optional[ + resources.MeasurementProtocolSecret + ] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a FirebaseLink on a property - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_firebase_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteFirebaseLinkRequest( - name="name_value", - ) - - # Make the request - client.delete_firebase_link(request=request) + ) -> resources.MeasurementProtocolSecret: + r"""Creates a measurement protocol secret. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteFirebaseLinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.CreateMeasurementProtocolSecretRequest, dict]): The request object. Request message for - DeleteFirebaseLink RPC - name (str): - Required. Format: - properties/{property_id}/firebaseLinks/{firebase_link_id} - Example: properties/1234/firebaseLinks/5678 + CreateMeasurementProtocolSecret RPC + parent (str): + Required. The parent resource where + this secret will be created. Format: + properties/{property}/dataStreams/{dataStream} - This corresponds to the ``name`` field + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + measurement_protocol_secret (google.analytics.admin_v1alpha.types.MeasurementProtocolSecret): + Required. The measurement protocol + secret to create. + + This corresponds to the ``measurement_protocol_secret`` 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, @@ -3216,11 +2800,17 @@ def sample_delete_firebase_link(): 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.analytics.admin_v1alpha.types.MeasurementProtocolSecret: + A secret value used for sending hits + to Measurement Protocol. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent, measurement_protocol_secret]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -3228,82 +2818,68 @@ def sample_delete_firebase_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteFirebaseLinkRequest. + # in a analytics_admin.CreateMeasurementProtocolSecretRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.DeleteFirebaseLinkRequest): - request = analytics_admin.DeleteFirebaseLinkRequest(request) + if not isinstance( + request, analytics_admin.CreateMeasurementProtocolSecretRequest + ): + request = analytics_admin.CreateMeasurementProtocolSecretRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent + if measurement_protocol_secret is not None: + request.measurement_protocol_secret = measurement_protocol_secret # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_firebase_link] + rpc = self._transport._wrapped_methods[ + self._transport.create_measurement_protocol_secret + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def list_firebase_links( + # Done; return the response. + return response + + def delete_measurement_protocol_secret( self, - request: Optional[Union[analytics_admin.ListFirebaseLinksRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.DeleteMeasurementProtocolSecretRequest, dict] + ] = None, *, - parent: Optional[str] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListFirebaseLinksPager: - r"""Lists FirebaseLinks on a property. - Properties can have at most one FirebaseLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_firebase_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListFirebaseLinksRequest( - parent="parent_value", - ) + ) -> None: + r"""Deletes target MeasurementProtocolSecret. - # Make the request - page_result = client.list_firebase_links(request=request) + Args: + request (Union[google.analytics.admin_v1alpha.types.DeleteMeasurementProtocolSecretRequest, dict]): + The request object. Request message for + DeleteMeasurementProtocolSecret RPC + name (str): + Required. The name of the + MeasurementProtocolSecret to delete. + Format: - # Handle the response - for response in page_result: - print(response) + properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret} - Args: - request (Union[google.analytics.admin_v1alpha.types.ListFirebaseLinksRequest, dict]): - The request object. Request message for ListFirebaseLinks - RPC - parent (str): - Required. Format: properties/{property_id} Example: - properties/1234 - - This corresponds to the ``parent`` field + This corresponds to the ``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, @@ -3311,20 +2887,11 @@ def sample_list_firebase_links(): 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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListFirebaseLinksPager: - Response message for - ListFirebaseLinks RPC - Iterating over this object will yield - results and resolve additional pages - automatically. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -3332,96 +2899,71 @@ def sample_list_firebase_links(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListFirebaseLinksRequest. + # in a analytics_admin.DeleteMeasurementProtocolSecretRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListFirebaseLinksRequest): - request = analytics_admin.ListFirebaseLinksRequest(request) + if not isinstance( + request, analytics_admin.DeleteMeasurementProtocolSecretRequest + ): + request = analytics_admin.DeleteMeasurementProtocolSecretRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_firebase_links] + rpc = self._transport._wrapped_methods[ + self._transport.delete_measurement_protocol_secret + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = rpc( + 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.ListFirebaseLinksPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_global_site_tag( + def update_measurement_protocol_secret( self, - request: Optional[Union[analytics_admin.GetGlobalSiteTagRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.UpdateMeasurementProtocolSecretRequest, dict] + ] = None, *, - name: Optional[str] = None, + measurement_protocol_secret: Optional[ + resources.MeasurementProtocolSecret + ] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.GlobalSiteTag: - r"""Returns the Site Tag for the specified web stream. - Site Tags are immutable singletons. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_global_site_tag(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetGlobalSiteTagRequest( - name="name_value", - ) - - # Make the request - response = client.get_global_site_tag(request=request) - - # Handle the response - print(response) + ) -> resources.MeasurementProtocolSecret: + r"""Updates a measurement protocol secret. Args: - request (Union[google.analytics.admin_v1alpha.types.GetGlobalSiteTagRequest, dict]): - The request object. Request message for GetGlobalSiteTag - RPC. - name (str): - Required. The name of the site tag to lookup. Note that - site tags are singletons and do not have unique IDs. - Format: - properties/{property_id}/dataStreams/{stream_id}/globalSiteTag - Example: "properties/123/dataStreams/456/globalSiteTag" + request (Union[google.analytics.admin_v1alpha.types.UpdateMeasurementProtocolSecretRequest, dict]): + The request object. Request message for + UpdateMeasurementProtocolSecret RPC + measurement_protocol_secret (google.analytics.admin_v1alpha.types.MeasurementProtocolSecret): + Required. The measurement protocol + secret to update. - This corresponds to the ``name`` field + This corresponds to the ``measurement_protocol_secret`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be + updated. Omitted fields will not be + updated. + + This corresponds to the ``update_mask`` 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, @@ -3431,17 +2973,15 @@ def sample_get_global_site_tag(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.GlobalSiteTag: - Read-only resource with the tag for - sending data from a website to a - DataStream. Only present for web - DataStream resources. + google.analytics.admin_v1alpha.types.MeasurementProtocolSecret: + A secret value used for sending hits + to Measurement Protocol. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([measurement_protocol_secret, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -3449,24 +2989,37 @@ def sample_get_global_site_tag(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetGlobalSiteTagRequest. + # in a analytics_admin.UpdateMeasurementProtocolSecretRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetGlobalSiteTagRequest): - request = analytics_admin.GetGlobalSiteTagRequest(request) + if not isinstance( + request, analytics_admin.UpdateMeasurementProtocolSecretRequest + ): + request = analytics_admin.UpdateMeasurementProtocolSecretRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if measurement_protocol_secret is not None: + request.measurement_protocol_secret = measurement_protocol_secret + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_global_site_tag] + rpc = self._transport._wrapped_methods[ + self._transport.update_measurement_protocol_secret + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "measurement_protocol_secret.name", + request.measurement_protocol_secret.name, + ), + ) + ), ) # Send the request. @@ -3480,64 +3033,26 @@ def sample_get_global_site_tag(): # Done; return the response. return response - def create_google_ads_link( + def acknowledge_user_data_collection( self, request: Optional[ - Union[analytics_admin.CreateGoogleAdsLinkRequest, dict] + Union[analytics_admin.AcknowledgeUserDataCollectionRequest, dict] ] = None, *, - parent: Optional[str] = None, - google_ads_link: Optional[resources.GoogleAdsLink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.GoogleAdsLink: - r"""Creates a GoogleAdsLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_google_ads_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateGoogleAdsLinkRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_google_ads_link(request=request) - - # Handle the response - print(response) + ) -> analytics_admin.AcknowledgeUserDataCollectionResponse: + r"""Acknowledges the terms of user data collection for + the specified property. + This acknowledgement must be completed (either in the + Google Analytics UI or through this API) before + MeasurementProtocolSecret resources may be created. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateGoogleAdsLinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionRequest, dict]): The request object. Request message for - CreateGoogleAdsLink RPC - parent (str): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - google_ads_link (google.analytics.admin_v1alpha.types.GoogleAdsLink): - Required. The GoogleAdsLink to - create. - - This corresponds to the ``google_ads_link`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + AcknowledgeUserDataCollection RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -3545,42 +3060,31 @@ def sample_create_google_ads_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.GoogleAdsLink: - A link between a GA4 property and a - Google Ads account. + google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionResponse: + Response message for + AcknowledgeUserDataCollection RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, google_ads_link]) - if request is not None and has_flattened_params: - 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 analytics_admin.CreateGoogleAdsLinkRequest. + # in a analytics_admin.AcknowledgeUserDataCollectionRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateGoogleAdsLinkRequest): - request = analytics_admin.CreateGoogleAdsLinkRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if google_ads_link is not None: - request.google_ads_link = google_ads_link + if not isinstance( + request, analytics_admin.AcknowledgeUserDataCollectionRequest + ): + request = analytics_admin.AcknowledgeUserDataCollectionRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_google_ads_link] + rpc = self._transport._wrapped_methods[ + self._transport.acknowledge_user_data_collection + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("property", request.property),)), ) # Send the request. @@ -3594,62 +3098,29 @@ def sample_create_google_ads_link(): # Done; return the response. return response - def update_google_ads_link( + def get_sk_ad_network_conversion_value_schema( self, request: Optional[ - Union[analytics_admin.UpdateGoogleAdsLinkRequest, dict] + Union[analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, dict] ] = None, *, - google_ads_link: Optional[resources.GoogleAdsLink] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.GoogleAdsLink: - r"""Updates a GoogleAdsLink on a property - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_google_ads_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateGoogleAdsLinkRequest( - ) - - # Make the request - response = client.update_google_ads_link(request=request) - - # Handle the response - print(response) + ) -> resources.SKAdNetworkConversionValueSchema: + r"""Looks up a single SKAdNetworkConversionValueSchema. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateGoogleAdsLinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.GetSKAdNetworkConversionValueSchemaRequest, dict]): The request object. Request message for - UpdateGoogleAdsLink RPC - google_ads_link (google.analytics.admin_v1alpha.types.GoogleAdsLink): - The GoogleAdsLink to update - This corresponds to the ``google_ads_link`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + GetSKAdNetworkConversionValueSchema RPC. + name (str): + Required. The resource name of SKAdNetwork conversion + value schema to look up. Format: + properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema} - This corresponds to the ``update_mask`` field + This corresponds to the ``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, @@ -3659,15 +3130,15 @@ def sample_update_google_ads_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.GoogleAdsLink: - A link between a GA4 property and a - Google Ads account. + google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema: + SKAdNetwork conversion value schema + of an iOS stream. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([google_ads_link, update_mask]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -3675,28 +3146,30 @@ def sample_update_google_ads_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateGoogleAdsLinkRequest. + # in a analytics_admin.GetSKAdNetworkConversionValueSchemaRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateGoogleAdsLinkRequest): - request = analytics_admin.UpdateGoogleAdsLinkRequest(request) + if not isinstance( + request, analytics_admin.GetSKAdNetworkConversionValueSchemaRequest + ): + request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. - if google_ads_link is not None: - request.google_ads_link = google_ads_link - if update_mask is not None: - request.update_mask = update_mask + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_google_ads_link] + rpc = self._transport._wrapped_methods[ + self._transport.get_sk_ad_network_conversion_value_schema + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("google_ads_link.name", request.google_ads_link.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -3710,51 +3183,40 @@ def sample_update_google_ads_link(): # Done; return the response. return response - def delete_google_ads_link( + def create_sk_ad_network_conversion_value_schema( self, request: Optional[ - Union[analytics_admin.DeleteGoogleAdsLinkRequest, dict] + Union[analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, dict] ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, + skadnetwork_conversion_value_schema: Optional[ + resources.SKAdNetworkConversionValueSchema + ] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a GoogleAdsLink on a property - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_google_ads_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteGoogleAdsLinkRequest( - name="name_value", - ) - - # Make the request - client.delete_google_ads_link(request=request) + ) -> resources.SKAdNetworkConversionValueSchema: + r"""Creates a SKAdNetworkConversionValueSchema. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteGoogleAdsLinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.CreateSKAdNetworkConversionValueSchemaRequest, dict]): The request object. Request message for - DeleteGoogleAdsLink RPC. - name (str): - Required. Example format: - properties/1234/googleAdsLinks/5678 + CreateSKAdNetworkConversionValueSchema + RPC. + parent (str): + Required. The parent resource where + this schema will be created. Format: + properties/{property}/dataStreams/{dataStream} - This corresponds to the ``name`` field + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + skadnetwork_conversion_value_schema (google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema): + Required. SKAdNetwork conversion + value schema to create. + + This corresponds to the ``skadnetwork_conversion_value_schema`` 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, @@ -3762,11 +3224,17 @@ def sample_delete_google_ads_link(): 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.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema: + SKAdNetwork conversion value schema + of an iOS stream. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent, skadnetwork_conversion_value_schema]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -3774,83 +3242,71 @@ def sample_delete_google_ads_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteGoogleAdsLinkRequest. + # in a analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.DeleteGoogleAdsLinkRequest): - request = analytics_admin.DeleteGoogleAdsLinkRequest(request) + if not isinstance( + request, analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest + ): + request = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent + if skadnetwork_conversion_value_schema is not None: + request.skadnetwork_conversion_value_schema = ( + skadnetwork_conversion_value_schema + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_google_ads_link] + rpc = self._transport._wrapped_methods[ + self._transport.create_sk_ad_network_conversion_value_schema + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def list_google_ads_links( + # Done; return the response. + return response + + def delete_sk_ad_network_conversion_value_schema( self, request: Optional[ - Union[analytics_admin.ListGoogleAdsLinksRequest, dict] + Union[analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, dict] ] = None, *, - parent: Optional[str] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListGoogleAdsLinksPager: - r"""Lists GoogleAdsLinks on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_google_ads_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListGoogleAdsLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_google_ads_links(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> None: + r"""Deletes target SKAdNetworkConversionValueSchema. Args: - request (Union[google.analytics.admin_v1alpha.types.ListGoogleAdsLinksRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.DeleteSKAdNetworkConversionValueSchemaRequest, dict]): The request object. Request message for - ListGoogleAdsLinks RPC. - parent (str): - Required. Example format: - properties/1234 + DeleteSKAdNetworkConversionValueSchema + RPC. + name (str): + Required. The name of the + SKAdNetworkConversionValueSchema to delete. Format: + properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema} - This corresponds to the ``parent`` field + This corresponds to the ``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, @@ -3858,20 +3314,11 @@ def sample_list_google_ads_links(): 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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListGoogleAdsLinksPager: - Response message for - ListGoogleAdsLinks RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -3879,98 +3326,74 @@ def sample_list_google_ads_links(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListGoogleAdsLinksRequest. + # in a analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListGoogleAdsLinksRequest): - request = analytics_admin.ListGoogleAdsLinksRequest(request) + if not isinstance( + request, analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest + ): + request = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_google_ads_links] + rpc = self._transport._wrapped_methods[ + self._transport.delete_sk_ad_network_conversion_value_schema + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = rpc( + 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.ListGoogleAdsLinksPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_data_sharing_settings( + def update_sk_ad_network_conversion_value_schema( self, request: Optional[ - Union[analytics_admin.GetDataSharingSettingsRequest, dict] + Union[analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, dict] ] = None, *, - name: Optional[str] = None, + skadnetwork_conversion_value_schema: Optional[ + resources.SKAdNetworkConversionValueSchema + ] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DataSharingSettings: - r"""Get data sharing settings on an account. - Data sharing settings are singletons. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_data_sharing_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDataSharingSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.get_data_sharing_settings(request=request) - - # Handle the response - print(response) + ) -> resources.SKAdNetworkConversionValueSchema: + r"""Updates a SKAdNetworkConversionValueSchema. Args: - request (Union[google.analytics.admin_v1alpha.types.GetDataSharingSettingsRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.UpdateSKAdNetworkConversionValueSchemaRequest, dict]): The request object. Request message for - GetDataSharingSettings RPC. - name (str): - Required. The name of the settings to - lookup. Format: - accounts/{account}/dataSharingSettings - Example: - "accounts/1000/dataSharingSettings" + UpdateSKAdNetworkConversionValueSchema + RPC. + skadnetwork_conversion_value_schema (google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema): + Required. SKAdNetwork conversion + value schema to update. - This corresponds to the ``name`` field + This corresponds to the ``skadnetwork_conversion_value_schema`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be + updated. Omitted fields will not be + updated. + + This corresponds to the ``update_mask`` 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, @@ -3980,16 +3403,15 @@ def sample_get_data_sharing_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DataSharingSettings: - A resource message representing data - sharing settings of a Google Analytics - account. + google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema: + SKAdNetwork conversion value schema + of an iOS stream. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([skadnetwork_conversion_value_schema, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -3997,30 +3419,45 @@ def sample_get_data_sharing_settings(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetDataSharingSettingsRequest. + # in a analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetDataSharingSettingsRequest): - request = analytics_admin.GetDataSharingSettingsRequest(request) + if not isinstance( + request, analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest + ): + request = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if skadnetwork_conversion_value_schema is not None: + request.skadnetwork_conversion_value_schema = ( + skadnetwork_conversion_value_schema + ) + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.get_data_sharing_settings + self._transport.update_sk_ad_network_conversion_value_schema ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "skadnetwork_conversion_value_schema.name", + request.skadnetwork_conversion_value_schema.name, + ), + ) + ), + ) + + # Send the request. + response = rpc( request, retry=retry, timeout=timeout, @@ -4030,56 +3467,33 @@ def sample_get_data_sharing_settings(): # Done; return the response. return response - def get_measurement_protocol_secret( + def list_sk_ad_network_conversion_value_schemas( self, request: Optional[ - Union[analytics_admin.GetMeasurementProtocolSecretRequest, dict] + Union[analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, dict] ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.MeasurementProtocolSecret: - r"""Lookup for a single "GA4" MeasurementProtocolSecret. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetMeasurementProtocolSecretRequest( - name="name_value", - ) - - # Make the request - response = client.get_measurement_protocol_secret(request=request) - - # Handle the response - print(response) + ) -> pagers.ListSKAdNetworkConversionValueSchemasPager: + r"""Lists SKAdNetworkConversionValueSchema on a stream. + Properties can have at most one + SKAdNetworkConversionValueSchema. Args: - request (Union[google.analytics.admin_v1alpha.types.GetMeasurementProtocolSecretRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ListSKAdNetworkConversionValueSchemasRequest, dict]): The request object. Request message for - GetMeasurementProtocolSecret RPC. - name (str): - Required. The name of the measurement - protocol secret to lookup. Format: - - properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret} + ListSKAdNetworkConversionValueSchemas + RPC + parent (str): + Required. The DataStream resource to list schemas for. + Format: + properties/{property_id}/dataStreams/{dataStream} + Example: properties/1234/dataStreams/5678 - This corresponds to the ``name`` field + This corresponds to the ``parent`` 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, @@ -4089,15 +3503,18 @@ def sample_get_measurement_protocol_secret(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.MeasurementProtocolSecret: - A secret value used for sending hits - to Measurement Protocol. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSKAdNetworkConversionValueSchemasPager: + Response message for + ListSKAdNetworkConversionValueSchemas + RPC Iterating over this object will + yield results and resolve additional + pages automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -4105,26 +3522,30 @@ def sample_get_measurement_protocol_secret(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetMeasurementProtocolSecretRequest. + # in a analytics_admin.ListSKAdNetworkConversionValueSchemasRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetMeasurementProtocolSecretRequest): - request = analytics_admin.GetMeasurementProtocolSecretRequest(request) + if not isinstance( + request, analytics_admin.ListSKAdNetworkConversionValueSchemasRequest + ): + request = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.get_measurement_protocol_secret + self._transport.list_sk_ad_network_conversion_value_schemas ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -4135,63 +3556,35 @@ def sample_get_measurement_protocol_secret(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListSKAdNetworkConversionValueSchemasPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - def list_measurement_protocol_secrets( + def search_change_history_events( self, request: Optional[ - Union[analytics_admin.ListMeasurementProtocolSecretsRequest, dict] + Union[analytics_admin.SearchChangeHistoryEventsRequest, dict] ] = None, *, - parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListMeasurementProtocolSecretsPager: - r"""Returns child MeasurementProtocolSecrets under the - specified parent Property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_measurement_protocol_secrets(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListMeasurementProtocolSecretsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_measurement_protocol_secrets(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> pagers.SearchChangeHistoryEventsPager: + r"""Searches through all changes to an account or its + children given the specified set of filters. Args: - request (Union[google.analytics.admin_v1alpha.types.ListMeasurementProtocolSecretsRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.SearchChangeHistoryEventsRequest, dict]): The request object. Request message for - ListMeasurementProtocolSecret RPC - parent (str): - Required. The resource name of the - parent stream. Format: - - properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + SearchChangeHistoryEvents RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -4199,47 +3592,32 @@ def sample_list_measurement_protocol_secrets(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListMeasurementProtocolSecretsPager: - Response message for - ListMeasurementProtocolSecret RPC + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.SearchChangeHistoryEventsPager: + Response message for SearchAccounts + RPC. Iterating over this object will yield results and resolve additional pages automatically. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - 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 analytics_admin.ListMeasurementProtocolSecretsRequest. + # in a analytics_admin.SearchChangeHistoryEventsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.ListMeasurementProtocolSecretsRequest - ): - request = analytics_admin.ListMeasurementProtocolSecretsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent + if not isinstance(request, analytics_admin.SearchChangeHistoryEventsRequest): + request = analytics_admin.SearchChangeHistoryEventsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.list_measurement_protocol_secrets + self._transport.search_change_history_events ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("account", request.account),)), ) # Send the request. @@ -4252,7 +3630,7 @@ def sample_list_measurement_protocol_secrets(): # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. - response = pagers.ListMeasurementProtocolSecretsPager( + response = pagers.SearchChangeHistoryEventsPager( method=rpc, request=request, response=response, @@ -4262,69 +3640,29 @@ def sample_list_measurement_protocol_secrets(): # Done; return the response. return response - def create_measurement_protocol_secret( + def get_google_signals_settings( self, request: Optional[ - Union[analytics_admin.CreateMeasurementProtocolSecretRequest, dict] + Union[analytics_admin.GetGoogleSignalsSettingsRequest, dict] ] = None, *, - parent: Optional[str] = None, - measurement_protocol_secret: Optional[ - resources.MeasurementProtocolSecret - ] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.MeasurementProtocolSecret: - r"""Creates a measurement protocol secret. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - measurement_protocol_secret = admin_v1alpha.MeasurementProtocolSecret() - measurement_protocol_secret.display_name = "display_name_value" - - request = admin_v1alpha.CreateMeasurementProtocolSecretRequest( - parent="parent_value", - measurement_protocol_secret=measurement_protocol_secret, - ) - - # Make the request - response = client.create_measurement_protocol_secret(request=request) - - # Handle the response - print(response) + ) -> resources.GoogleSignalsSettings: + r"""Lookup for Google Signals settings for a property. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateMeasurementProtocolSecretRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.GetGoogleSignalsSettingsRequest, dict]): The request object. Request message for - CreateMeasurementProtocolSecret RPC - parent (str): - Required. The parent resource where - this secret will be created. Format: - properties/{property}/dataStreams/{dataStream} - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - measurement_protocol_secret (google.analytics.admin_v1alpha.types.MeasurementProtocolSecret): - Required. The measurement protocol - secret to create. + GetGoogleSignalsSettings RPC + name (str): + Required. The name of the google + signals settings to retrieve. Format: + properties/{property}/googleSignalsSettings - This corresponds to the ``measurement_protocol_secret`` field + This corresponds to the ``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, @@ -4334,15 +3672,15 @@ def sample_create_measurement_protocol_secret(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.MeasurementProtocolSecret: - A secret value used for sending hits - to Measurement Protocol. + google.analytics.admin_v1alpha.types.GoogleSignalsSettings: + Settings values for Google Signals. + This is a singleton resource. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, measurement_protocol_secret]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -4350,30 +3688,26 @@ def sample_create_measurement_protocol_secret(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateMeasurementProtocolSecretRequest. + # in a analytics_admin.GetGoogleSignalsSettingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.CreateMeasurementProtocolSecretRequest - ): - request = analytics_admin.CreateMeasurementProtocolSecretRequest(request) + if not isinstance(request, analytics_admin.GetGoogleSignalsSettingsRequest): + request = analytics_admin.GetGoogleSignalsSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if measurement_protocol_secret is not None: - request.measurement_protocol_secret = measurement_protocol_secret + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.create_measurement_protocol_secret + self._transport.get_google_signals_settings ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -4387,54 +3721,39 @@ def sample_create_measurement_protocol_secret(): # Done; return the response. return response - def delete_measurement_protocol_secret( + def update_google_signals_settings( self, request: Optional[ - Union[analytics_admin.DeleteMeasurementProtocolSecretRequest, dict] + Union[analytics_admin.UpdateGoogleSignalsSettingsRequest, dict] ] = None, *, - name: Optional[str] = None, + google_signals_settings: Optional[resources.GoogleSignalsSettings] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes target MeasurementProtocolSecret. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteMeasurementProtocolSecretRequest( - name="name_value", - ) - - # Make the request - client.delete_measurement_protocol_secret(request=request) + ) -> resources.GoogleSignalsSettings: + r"""Updates Google Signals settings for a property. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteMeasurementProtocolSecretRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.UpdateGoogleSignalsSettingsRequest, dict]): The request object. Request message for - DeleteMeasurementProtocolSecret RPC - name (str): - Required. The name of the - MeasurementProtocolSecret to delete. - Format: + UpdateGoogleSignalsSettings RPC + google_signals_settings (google.analytics.admin_v1alpha.types.GoogleSignalsSettings): + Required. The settings to update. The ``name`` field is + used to identify the settings to be updated. - properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret} + This corresponds to the ``google_signals_settings`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. - This corresponds to the ``name`` field + This corresponds to the ``update_mask`` 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, @@ -4442,11 +3761,17 @@ def sample_delete_measurement_protocol_secret(): 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.analytics.admin_v1alpha.types.GoogleSignalsSettings: + Settings values for Google Signals. + This is a singleton resource. + + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([google_signals_settings, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -4454,100 +3779,81 @@ def sample_delete_measurement_protocol_secret(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteMeasurementProtocolSecretRequest. + # in a analytics_admin.UpdateGoogleSignalsSettingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.DeleteMeasurementProtocolSecretRequest - ): - request = analytics_admin.DeleteMeasurementProtocolSecretRequest(request) + if not isinstance(request, analytics_admin.UpdateGoogleSignalsSettingsRequest): + request = analytics_admin.UpdateGoogleSignalsSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if google_signals_settings is not None: + request.google_signals_settings = google_signals_settings + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.delete_measurement_protocol_secret + self._transport.update_google_signals_settings ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "google_signals_settings.name", + request.google_signals_settings.name, + ), + ) + ), ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def update_measurement_protocol_secret( + # Done; return the response. + return response + + def create_conversion_event( self, request: Optional[ - Union[analytics_admin.UpdateMeasurementProtocolSecretRequest, dict] + Union[analytics_admin.CreateConversionEventRequest, dict] ] = None, *, - measurement_protocol_secret: Optional[ - resources.MeasurementProtocolSecret - ] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, + conversion_event: Optional[resources.ConversionEvent] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.MeasurementProtocolSecret: - r"""Updates a measurement protocol secret. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - measurement_protocol_secret = admin_v1alpha.MeasurementProtocolSecret() - measurement_protocol_secret.display_name = "display_name_value" - - request = admin_v1alpha.UpdateMeasurementProtocolSecretRequest( - measurement_protocol_secret=measurement_protocol_secret, - ) - - # Make the request - response = client.update_measurement_protocol_secret(request=request) - - # Handle the response - print(response) + ) -> resources.ConversionEvent: + r"""Creates a conversion event with the specified + attributes. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateMeasurementProtocolSecretRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.CreateConversionEventRequest, dict]): The request object. Request message for - UpdateMeasurementProtocolSecret RPC - measurement_protocol_secret (google.analytics.admin_v1alpha.types.MeasurementProtocolSecret): - Required. The measurement protocol - secret to update. + CreateConversionEvent RPC + parent (str): + Required. The resource name of the + parent property where this conversion + event will be created. Format: + properties/123 - This corresponds to the ``measurement_protocol_secret`` field + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be - updated. Omitted fields will not be - updated. + conversion_event (google.analytics.admin_v1alpha.types.ConversionEvent): + Required. The conversion event to + create. - This corresponds to the ``update_mask`` field + This corresponds to the ``conversion_event`` 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, @@ -4557,15 +3863,15 @@ def sample_update_measurement_protocol_secret(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.MeasurementProtocolSecret: - A secret value used for sending hits - to Measurement Protocol. + google.analytics.admin_v1alpha.types.ConversionEvent: + A conversion event in a Google + Analytics property. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([measurement_protocol_secret, update_mask]) + has_flattened_params = any([parent, conversion_event]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -4573,37 +3879,26 @@ def sample_update_measurement_protocol_secret(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateMeasurementProtocolSecretRequest. + # in a analytics_admin.CreateConversionEventRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.UpdateMeasurementProtocolSecretRequest - ): - request = analytics_admin.UpdateMeasurementProtocolSecretRequest(request) + if not isinstance(request, analytics_admin.CreateConversionEventRequest): + request = analytics_admin.CreateConversionEventRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if measurement_protocol_secret is not None: - request.measurement_protocol_secret = measurement_protocol_secret - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent + if conversion_event is not None: + request.conversion_event = conversion_event # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.update_measurement_protocol_secret - ] + rpc = self._transport._wrapped_methods[self._transport.create_conversion_event] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "measurement_protocol_secret.name", - request.measurement_protocol_secret.name, - ), - ) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -4617,53 +3912,42 @@ def sample_update_measurement_protocol_secret(): # Done; return the response. return response - def acknowledge_user_data_collection( + def update_conversion_event( self, request: Optional[ - Union[analytics_admin.AcknowledgeUserDataCollectionRequest, dict] + Union[analytics_admin.UpdateConversionEventRequest, dict] ] = None, *, + conversion_event: Optional[resources.ConversionEvent] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.AcknowledgeUserDataCollectionResponse: - r"""Acknowledges the terms of user data collection for - the specified property. - This acknowledgement must be completed (either in the - Google Analytics UI or through this API) before - MeasurementProtocolSecret resources may be created. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_acknowledge_user_data_collection(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.AcknowledgeUserDataCollectionRequest( - property="property_value", - acknowledgement="acknowledgement_value", - ) - - # Make the request - response = client.acknowledge_user_data_collection(request=request) - - # Handle the response - print(response) + ) -> resources.ConversionEvent: + r"""Updates a conversion event with the specified + attributes. Args: - request (Union[google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.UpdateConversionEventRequest, dict]): The request object. Request message for - AcknowledgeUserDataCollection RPC. + UpdateConversionEvent RPC + conversion_event (google.analytics.admin_v1alpha.types.ConversionEvent): + Required. The conversion event to update. The ``name`` + field is used to identify the settings to be updated. + + This corresponds to the ``conversion_event`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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. @@ -4671,31 +3955,44 @@ def sample_acknowledge_user_data_collection(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionResponse: - Response message for - AcknowledgeUserDataCollection RPC. + google.analytics.admin_v1alpha.types.ConversionEvent: + A conversion event in a Google + Analytics property. """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([conversion_event, update_mask]) + if request is not None and has_flattened_params: + 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 analytics_admin.AcknowledgeUserDataCollectionRequest. + # in a analytics_admin.UpdateConversionEventRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.AcknowledgeUserDataCollectionRequest - ): - request = analytics_admin.AcknowledgeUserDataCollectionRequest(request) + if not isinstance(request, analytics_admin.UpdateConversionEventRequest): + request = analytics_admin.UpdateConversionEventRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if conversion_event is not None: + request.conversion_event = conversion_event + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.acknowledge_user_data_collection - ] + rpc = self._transport._wrapped_methods[self._transport.update_conversion_event] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("property", request.property),)), + gapic_v1.routing_header.to_grpc_metadata( + (("conversion_event.name", request.conversion_event.name),) + ), ) # Send the request. @@ -4709,53 +4006,28 @@ def sample_acknowledge_user_data_collection(): # Done; return the response. return response - def get_sk_ad_network_conversion_value_schema( + def get_conversion_event( self, request: Optional[ - Union[analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, dict] + Union[analytics_admin.GetConversionEventRequest, dict] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SKAdNetworkConversionValueSchema: - r"""Looks up a single SKAdNetworkConversionValueSchema. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetSKAdNetworkConversionValueSchemaRequest( - name="name_value", - ) - - # Make the request - response = client.get_sk_ad_network_conversion_value_schema(request=request) - - # Handle the response - print(response) + ) -> resources.ConversionEvent: + r"""Retrieve a single conversion event. Args: - request (Union[google.analytics.admin_v1alpha.types.GetSKAdNetworkConversionValueSchemaRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.GetConversionEventRequest, dict]): The request object. Request message for - GetSKAdNetworkConversionValueSchema RPC. + GetConversionEvent RPC name (str): - Required. The resource name of SKAdNetwork conversion - value schema to look up. Format: - properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema} + Required. The resource name of the conversion event to + retrieve. Format: + properties/{property}/conversionEvents/{conversion_event} + Example: "properties/123/conversionEvents/456" This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -4767,9 +4039,9 @@ def sample_get_sk_ad_network_conversion_value_schema(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema: - SKAdNetwork conversion value schema - of an iOS stream. + google.analytics.admin_v1alpha.types.ConversionEvent: + A conversion event in a Google + Analytics property. """ # Create or coerce a protobuf request object. @@ -4783,15 +4055,11 @@ def sample_get_sk_ad_network_conversion_value_schema(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetSKAdNetworkConversionValueSchemaRequest. + # in a analytics_admin.GetConversionEventRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.GetSKAdNetworkConversionValueSchemaRequest - ): - request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest( - request - ) + if not isinstance(request, analytics_admin.GetConversionEventRequest): + request = analytics_admin.GetConversionEventRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -4799,9 +4067,7 @@ def sample_get_sk_ad_network_conversion_value_schema(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_sk_ad_network_conversion_value_schema - ] + rpc = self._transport._wrapped_methods[self._transport.get_conversion_event] # Certain fields should be provided within the metadata header; # add these here. @@ -4820,68 +4086,104 @@ def sample_get_sk_ad_network_conversion_value_schema(): # Done; return the response. return response - def create_sk_ad_network_conversion_value_schema( + def delete_conversion_event( self, request: Optional[ - Union[analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, dict] + Union[analytics_admin.DeleteConversionEventRequest, dict] ] = None, *, - parent: Optional[str] = None, - skadnetwork_conversion_value_schema: Optional[ - resources.SKAdNetworkConversionValueSchema - ] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SKAdNetworkConversionValueSchema: - r"""Creates a SKAdNetworkConversionValueSchema. + ) -> None: + r"""Deletes a conversion event in a property. + + Args: + request (Union[google.analytics.admin_v1alpha.types.DeleteConversionEventRequest, dict]): + The request object. Request message for + DeleteConversionEvent RPC + name (str): + Required. The resource name of the conversion event to + delete. Format: + properties/{property}/conversionEvents/{conversion_event} + Example: "properties/123/conversionEvents/456" - .. code-block:: python + This corresponds to the ``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. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.DeleteConversionEventRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.DeleteConversionEventRequest): + request = analytics_admin.DeleteConversionEventRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name - def sample_create_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_conversion_event] - # Initialize request argument(s) - request = admin_v1alpha.CreateSKAdNetworkConversionValueSchemaRequest( - parent="parent_value", - ) + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) - # Make the request - response = client.create_sk_ad_network_conversion_value_schema(request=request) + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) - # Handle the response - print(response) + def list_conversion_events( + self, + request: Optional[ + Union[analytics_admin.ListConversionEventsRequest, dict] + ] = None, + *, + parent: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListConversionEventsPager: + r"""Returns a list of conversion events in the specified + parent property. + Returns an empty list if no conversion events are found. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateSKAdNetworkConversionValueSchemaRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ListConversionEventsRequest, dict]): The request object. Request message for - CreateSKAdNetworkConversionValueSchema - RPC. + ListConversionEvents RPC parent (str): - Required. The parent resource where - this schema will be created. Format: - properties/{property}/dataStreams/{dataStream} + Required. The resource name of the + parent property. Example: + 'properties/123' This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - skadnetwork_conversion_value_schema (google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema): - Required. SKAdNetwork conversion - value schema to create. - - This corresponds to the ``skadnetwork_conversion_value_schema`` 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. @@ -4889,15 +4191,18 @@ def sample_create_sk_ad_network_conversion_value_schema(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema: - SKAdNetwork conversion value schema - of an iOS stream. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListConversionEventsPager: + Response message for + ListConversionEvents RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, skadnetwork_conversion_value_schema]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -4905,29 +4210,19 @@ def sample_create_sk_ad_network_conversion_value_schema(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest. + # in a analytics_admin.ListConversionEventsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest - ): - request = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest( - request - ) + if not isinstance(request, analytics_admin.ListConversionEventsRequest): + request = analytics_admin.ListConversionEventsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if skadnetwork_conversion_value_schema is not None: - request.skadnetwork_conversion_value_schema = ( - skadnetwork_conversion_value_schema - ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.create_sk_ad_network_conversion_value_schema - ] + rpc = self._transport._wrapped_methods[self._transport.list_conversion_events] # Certain fields should be provided within the metadata header; # add these here. @@ -4943,54 +4238,40 @@ def sample_create_sk_ad_network_conversion_value_schema(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListConversionEventsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - def delete_sk_ad_network_conversion_value_schema( + def get_display_video360_advertiser_link( self, request: Optional[ - Union[analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, dict] + Union[analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, dict] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes target SKAdNetworkConversionValueSchema. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteSKAdNetworkConversionValueSchemaRequest( - name="name_value", - ) - - # Make the request - client.delete_sk_ad_network_conversion_value_schema(request=request) + ) -> resources.DisplayVideo360AdvertiserLink: + r"""Look up a single DisplayVideo360AdvertiserLink Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteSKAdNetworkConversionValueSchemaRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkRequest, dict]): The request object. Request message for - DeleteSKAdNetworkConversionValueSchema - RPC. + GetDisplayVideo360AdvertiserLink RPC. name (str): Required. The name of the - SKAdNetworkConversionValueSchema to delete. Format: - properties/{property}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema} + DisplayVideo360AdvertiserLink to get. + Example format: + properties/1234/displayVideo360AdvertiserLink/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -5000,6 +4281,12 @@ def sample_delete_sk_ad_network_conversion_value_schema(): 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.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: + A link between a GA4 property and a + Display & Video 360 advertiser. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -5012,15 +4299,13 @@ def sample_delete_sk_ad_network_conversion_value_schema(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest. + # in a analytics_admin.GetDisplayVideo360AdvertiserLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance( - request, analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest + request, analytics_admin.GetDisplayVideo360AdvertiserLinkRequest ): - request = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest( - request - ) + request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -5029,7 +4314,7 @@ def sample_delete_sk_ad_network_conversion_value_schema(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.delete_sk_ad_network_conversion_value_schema + self._transport.get_display_video360_advertiser_link ] # Certain fields should be provided within the metadata header; @@ -5039,72 +4324,39 @@ def sample_delete_sk_ad_network_conversion_value_schema(): ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def update_sk_ad_network_conversion_value_schema( + # Done; return the response. + return response + + def list_display_video360_advertiser_links( self, request: Optional[ - Union[analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, dict] + Union[analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, dict] ] = None, *, - skadnetwork_conversion_value_schema: Optional[ - resources.SKAdNetworkConversionValueSchema - ] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SKAdNetworkConversionValueSchema: - r"""Updates a SKAdNetworkConversionValueSchema. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateSKAdNetworkConversionValueSchemaRequest( - ) - - # Make the request - response = client.update_sk_ad_network_conversion_value_schema(request=request) - - # Handle the response - print(response) + ) -> pagers.ListDisplayVideo360AdvertiserLinksPager: + r"""Lists all DisplayVideo360AdvertiserLinks on a + property. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateSKAdNetworkConversionValueSchemaRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksRequest, dict]): The request object. Request message for - UpdateSKAdNetworkConversionValueSchema - RPC. - skadnetwork_conversion_value_schema (google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema): - Required. SKAdNetwork conversion - value schema to update. - - This corresponds to the ``skadnetwork_conversion_value_schema`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be - updated. Omitted fields will not be - updated. + ListDisplayVideo360AdvertiserLinks RPC. + parent (str): + Required. Example format: + properties/1234 - This corresponds to the ``update_mask`` field + This corresponds to the ``parent`` 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, @@ -5114,15 +4366,18 @@ def sample_update_sk_ad_network_conversion_value_schema(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema: - SKAdNetwork conversion value schema - of an iOS stream. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinksPager: + Response message for + ListDisplayVideo360AdvertiserLinks RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([skadnetwork_conversion_value_schema, update_mask]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -5130,41 +4385,28 @@ def sample_update_sk_ad_network_conversion_value_schema(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest. + # in a analytics_admin.ListDisplayVideo360AdvertiserLinksRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance( - request, analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest + request, analytics_admin.ListDisplayVideo360AdvertiserLinksRequest ): - request = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest( - request - ) + request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if skadnetwork_conversion_value_schema is not None: - request.skadnetwork_conversion_value_schema = ( - skadnetwork_conversion_value_schema - ) - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.update_sk_ad_network_conversion_value_schema + self._transport.list_display_video360_advertiser_links ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "skadnetwork_conversion_value_schema.name", - request.skadnetwork_conversion_value_schema.name, - ), - ) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -5175,65 +4417,57 @@ def sample_update_sk_ad_network_conversion_value_schema(): metadata=metadata, ) - # Done; return the response. - return response - - def list_sk_ad_network_conversion_value_schemas( - self, + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListDisplayVideo360AdvertiserLinksPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def create_display_video360_advertiser_link( + self, request: Optional[ - Union[analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, dict] + Union[analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, dict] ] = None, *, parent: Optional[str] = None, + display_video_360_advertiser_link: Optional[ + resources.DisplayVideo360AdvertiserLink + ] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListSKAdNetworkConversionValueSchemasPager: - r"""Lists SKAdNetworkConversionValueSchema on a stream. - Properties can have at most one - SKAdNetworkConversionValueSchema. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_sk_ad_network_conversion_value_schemas(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListSKAdNetworkConversionValueSchemasRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_sk_ad_network_conversion_value_schemas(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> resources.DisplayVideo360AdvertiserLink: + r"""Creates a DisplayVideo360AdvertiserLink. + This can only be utilized by users who have proper + authorization both on the Google Analytics property and + on the Display & Video 360 advertiser. Users who do not + have access to the Display & Video 360 advertiser should + instead seek to create a DisplayVideo360LinkProposal. Args: - request (Union[google.analytics.admin_v1alpha.types.ListSKAdNetworkConversionValueSchemasRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkRequest, dict]): The request object. Request message for - ListSKAdNetworkConversionValueSchemas - RPC + CreateDisplayVideo360AdvertiserLink RPC. parent (str): - Required. Format: - properties/{property_id}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema - Example: - properties/1234/dataStreams/5678/sKAdNetworkConversionValueSchema + Required. Example format: + properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. + display_video_360_advertiser_link (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink): + Required. The + DisplayVideo360AdvertiserLink to create. + + This corresponds to the ``display_video_360_advertiser_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. @@ -5241,18 +4475,15 @@ def sample_list_sk_ad_network_conversion_value_schemas(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSKAdNetworkConversionValueSchemasPager: - Response message for - ListSKAdNetworkConversionValueSchemas - RPC Iterating over this object will - yield results and resolve additional - pages automatically. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: + A link between a GA4 property and a + Display & Video 360 advertiser. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([parent, display_video_360_advertiser_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -5260,24 +4491,28 @@ def sample_list_sk_ad_network_conversion_value_schemas(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListSKAdNetworkConversionValueSchemasRequest. + # in a analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. if not isinstance( - request, analytics_admin.ListSKAdNetworkConversionValueSchemasRequest + request, analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest ): - request = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest( + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest( request ) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent + if display_video_360_advertiser_link is not None: + request.display_video_360_advertiser_link = ( + display_video_360_advertiser_link + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.list_sk_ad_network_conversion_value_schemas + self._transport.create_display_video360_advertiser_link ] # Certain fields should be provided within the metadata header; @@ -5294,166 +4529,122 @@ def sample_list_sk_ad_network_conversion_value_schemas(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListSKAdNetworkConversionValueSchemasPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - def search_change_history_events( + def delete_display_video360_advertiser_link( self, request: Optional[ - Union[analytics_admin.SearchChangeHistoryEventsRequest, dict] + Union[analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, dict] ] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.SearchChangeHistoryEventsPager: - r"""Searches through all changes to an account or its - children given the specified set of filters. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_search_change_history_events(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.SearchChangeHistoryEventsRequest( - account="account_value", - ) - - # Make the request - page_result = client.search_change_history_events(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> None: + r"""Deletes a DisplayVideo360AdvertiserLink on a + property. Args: - request (Union[google.analytics.admin_v1alpha.types.SearchChangeHistoryEventsRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkRequest, dict]): The request object. Request message for - SearchChangeHistoryEvents RPC. + DeleteDisplayVideo360AdvertiserLink RPC. + name (str): + Required. The name of the + DisplayVideo360AdvertiserLink to delete. + Example format: + properties/1234/displayVideo360AdvertiserLinks/5678 + + This corresponds to the ``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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.SearchChangeHistoryEventsPager: - Response message for SearchAccounts - RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. - """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + 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 analytics_admin.SearchChangeHistoryEventsRequest. + # in a analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.SearchChangeHistoryEventsRequest): - request = analytics_admin.SearchChangeHistoryEventsRequest(request) + if not isinstance( + request, analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest + ): + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest( + request + ) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.search_change_history_events + self._transport.delete_display_video360_advertiser_link ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("account", request.account),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = rpc( + 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.SearchChangeHistoryEventsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_google_signals_settings( + def update_display_video360_advertiser_link( self, request: Optional[ - Union[analytics_admin.GetGoogleSignalsSettingsRequest, dict] + Union[analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, dict] ] = None, *, - name: Optional[str] = None, + display_video_360_advertiser_link: Optional[ + resources.DisplayVideo360AdvertiserLink + ] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.GoogleSignalsSettings: - r"""Lookup for Google Signals settings for a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_google_signals_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetGoogleSignalsSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.get_google_signals_settings(request=request) - - # Handle the response - print(response) + ) -> resources.DisplayVideo360AdvertiserLink: + r"""Updates a DisplayVideo360AdvertiserLink on a + property. Args: - request (Union[google.analytics.admin_v1alpha.types.GetGoogleSignalsSettingsRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.UpdateDisplayVideo360AdvertiserLinkRequest, dict]): The request object. Request message for - GetGoogleSignalsSettings RPC - name (str): - Required. The name of the google - signals settings to retrieve. Format: - properties/{property}/googleSignalsSettings + UpdateDisplayVideo360AdvertiserLink RPC. + display_video_360_advertiser_link (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink): + The DisplayVideo360AdvertiserLink to + update - This corresponds to the ``name`` field + This corresponds to the ``display_video_360_advertiser_link`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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, @@ -5463,15 +4654,15 @@ def sample_get_google_signals_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.GoogleSignalsSettings: - Settings values for Google Signals. - This is a singleton resource. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: + A link between a GA4 property and a + Display & Video 360 advertiser. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([display_video_360_advertiser_link, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -5479,26 +4670,41 @@ def sample_get_google_signals_settings(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetGoogleSignalsSettingsRequest. + # in a analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetGoogleSignalsSettingsRequest): - request = analytics_admin.GetGoogleSignalsSettingsRequest(request) + if not isinstance( + request, analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest + ): + request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if display_video_360_advertiser_link is not None: + request.display_video_360_advertiser_link = ( + display_video_360_advertiser_link + ) + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.get_google_signals_settings + self._transport.update_display_video360_advertiser_link ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "display_video_360_advertiser_link.name", + request.display_video_360_advertiser_link.name, + ), + ) + ), ) # Send the request. @@ -5512,64 +4718,32 @@ def sample_get_google_signals_settings(): # Done; return the response. return response - def update_google_signals_settings( + def get_display_video360_advertiser_link_proposal( self, request: Optional[ - Union[analytics_admin.UpdateGoogleSignalsSettingsRequest, dict] + Union[analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, dict] ] = None, *, - google_signals_settings: Optional[resources.GoogleSignalsSettings] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.GoogleSignalsSettings: - r"""Updates Google Signals settings for a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_google_signals_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateGoogleSignalsSettingsRequest( - ) - - # Make the request - response = client.update_google_signals_settings(request=request) - - # Handle the response - print(response) + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Lookup for a single + DisplayVideo360AdvertiserLinkProposal. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateGoogleSignalsSettingsRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkProposalRequest, dict]): The request object. Request message for - UpdateGoogleSignalsSettings RPC - google_signals_settings (google.analytics.admin_v1alpha.types.GoogleSignalsSettings): - Required. The settings to update. The ``name`` field is - used to identify the settings to be updated. - - This corresponds to the ``google_signals_settings`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + GetDisplayVideo360AdvertiserLinkProposal + RPC. + name (str): + Required. The name of the + DisplayVideo360AdvertiserLinkProposal to + get. Example format: + properties/1234/displayVideo360AdvertiserLinkProposals/5678 - This corresponds to the ``update_mask`` field + This corresponds to the ``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, @@ -5579,15 +4753,23 @@ def sample_update_google_signals_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.GoogleSignalsSettings: - Settings values for Google Signals. - This is a singleton resource. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: + A proposal for a link between a GA4 + property and a Display & Video 360 + advertiser. + + A proposal is converted to a + DisplayVideo360AdvertiserLink once + approved. Google Analytics admins + approve inbound proposals while Display + & Video 360 admins approve outbound + proposals. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([google_signals_settings, update_mask]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -5595,35 +4777,30 @@ def sample_update_google_signals_settings(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateGoogleSignalsSettingsRequest. + # in a analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateGoogleSignalsSettingsRequest): - request = analytics_admin.UpdateGoogleSignalsSettingsRequest(request) + if not isinstance( + request, analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest + ): + request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. - if google_signals_settings is not None: - request.google_signals_settings = google_signals_settings - if update_mask is not None: - request.update_mask = update_mask + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.update_google_signals_settings + self._transport.get_display_video360_advertiser_link_proposal ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "google_signals_settings.name", - request.google_signals_settings.name, - ), - ) - ), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -5637,67 +4814,34 @@ def sample_update_google_signals_settings(): # Done; return the response. return response - def create_conversion_event( + def list_display_video360_advertiser_link_proposals( self, request: Optional[ - Union[analytics_admin.CreateConversionEventRequest, dict] + Union[ + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, dict + ] ] = None, *, parent: Optional[str] = None, - conversion_event: Optional[resources.ConversionEvent] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.ConversionEvent: - r"""Creates a conversion event with the specified - attributes. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateConversionEventRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_conversion_event(request=request) - - # Handle the response - print(response) + ) -> pagers.ListDisplayVideo360AdvertiserLinkProposalsPager: + r"""Lists DisplayVideo360AdvertiserLinkProposals on a + property. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateConversionEventRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsRequest, dict]): The request object. Request message for - CreateConversionEvent RPC + ListDisplayVideo360AdvertiserLinkProposals + RPC. parent (str): - Required. The resource name of the - parent property where this conversion - event will be created. Format: - properties/123 + Required. Example format: + properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - conversion_event (google.analytics.admin_v1alpha.types.ConversionEvent): - Required. The conversion event to - create. - - This corresponds to the ``conversion_event`` 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. @@ -5705,15 +4849,18 @@ def sample_create_conversion_event(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ConversionEvent: - A conversion event in a Google - Analytics property. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinkProposalsPager: + Response message for + ListDisplayVideo360AdvertiserLinkProposals + RPC. Iterating over this object will + yield results and resolve additional + pages automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, conversion_event]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -5721,21 +4868,25 @@ def sample_create_conversion_event(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateConversionEventRequest. + # in a analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateConversionEventRequest): - request = analytics_admin.CreateConversionEventRequest(request) + if not isinstance( + request, analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest + ): + request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if conversion_event is not None: - request.conversion_event = conversion_event # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_conversion_event] + rpc = self._transport._wrapped_methods[ + self._transport.list_display_video360_advertiser_link_proposals + ] # Certain fields should be provided within the metadata header; # add these here. @@ -5751,68 +4902,54 @@ def sample_create_conversion_event(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListDisplayVideo360AdvertiserLinkProposalsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - def update_conversion_event( + def create_display_video360_advertiser_link_proposal( self, request: Optional[ - Union[analytics_admin.UpdateConversionEventRequest, dict] + Union[ + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, dict + ] ] = None, *, - conversion_event: Optional[resources.ConversionEvent] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, + display_video_360_advertiser_link_proposal: Optional[ + resources.DisplayVideo360AdvertiserLinkProposal + ] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.ConversionEvent: - r"""Updates a conversion event with the specified - attributes. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateConversionEventRequest( - ) - - # Make the request - response = client.update_conversion_event(request=request) - - # Handle the response - print(response) + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Creates a DisplayVideo360AdvertiserLinkProposal. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateConversionEventRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkProposalRequest, dict]): The request object. Request message for - UpdateConversionEvent RPC - conversion_event (google.analytics.admin_v1alpha.types.ConversionEvent): - Required. The conversion event to update. The ``name`` - field is used to identify the settings to be updated. + CreateDisplayVideo360AdvertiserLinkProposal + RPC. + parent (str): + Required. Example format: + properties/1234 - This corresponds to the ``conversion_event`` field + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + display_video_360_advertiser_link_proposal (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal): + Required. The + DisplayVideo360AdvertiserLinkProposal to + create. - This corresponds to the ``update_mask`` field + This corresponds to the ``display_video_360_advertiser_link_proposal`` 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, @@ -5822,15 +4959,23 @@ def sample_update_conversion_event(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ConversionEvent: - A conversion event in a Google - Analytics property. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: + A proposal for a link between a GA4 + property and a Display & Video 360 + advertiser. + + A proposal is converted to a + DisplayVideo360AdvertiserLink once + approved. Google Analytics admins + approve inbound proposals while Display + & Video 360 admins approve outbound + proposals. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([conversion_event, update_mask]) + has_flattened_params = any([parent, display_video_360_advertiser_link_proposal]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -5838,28 +4983,36 @@ def sample_update_conversion_event(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateConversionEventRequest. + # in a analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateConversionEventRequest): - request = analytics_admin.UpdateConversionEventRequest(request) + if not isinstance( + request, analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest + ): + request = ( + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + ) # If we have keyword arguments corresponding to fields on the # request, apply these. - if conversion_event is not None: - request.conversion_event = conversion_event - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent + if display_video_360_advertiser_link_proposal is not None: + request.display_video_360_advertiser_link_proposal = ( + display_video_360_advertiser_link_proposal + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_conversion_event] + rpc = self._transport._wrapped_methods[ + self._transport.create_display_video360_advertiser_link_proposal + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("conversion_event.name", request.conversion_event.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -5873,54 +5026,32 @@ def sample_update_conversion_event(): # Done; return the response. return response - def get_conversion_event( + def delete_display_video360_advertiser_link_proposal( self, request: Optional[ - Union[analytics_admin.GetConversionEventRequest, dict] + Union[ + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, dict + ] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.ConversionEvent: - r"""Retrieve a single conversion event. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetConversionEventRequest( - name="name_value", - ) - - # Make the request - response = client.get_conversion_event(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a DisplayVideo360AdvertiserLinkProposal on a + property. This can only be used on cancelled proposals. Args: - request (Union[google.analytics.admin_v1alpha.types.GetConversionEventRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkProposalRequest, dict]): The request object. Request message for - GetConversionEvent RPC + DeleteDisplayVideo360AdvertiserLinkProposal + RPC. name (str): - Required. The resource name of the conversion event to - retrieve. Format: - properties/{property}/conversionEvents/{conversion_event} - Example: "properties/123/conversionEvents/456" + Required. The name of the + DisplayVideo360AdvertiserLinkProposal to + delete. Example format: + properties/1234/displayVideo360AdvertiserLinkProposals/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -5930,12 +5061,6 @@ def sample_get_conversion_event(): 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.analytics.admin_v1alpha.types.ConversionEvent: - A conversion event in a Google - Analytics property. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -5948,11 +5073,17 @@ def sample_get_conversion_event(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetConversionEventRequest. + # in a analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetConversionEventRequest): - request = analytics_admin.GetConversionEventRequest(request) + if not isinstance( + request, analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest + ): + request = ( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + ) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -5960,7 +5091,9 @@ def sample_get_conversion_event(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_conversion_event] + rpc = self._transport._wrapped_methods[ + self._transport.delete_display_video360_advertiser_link_proposal + ] # Certain fields should be provided within the metadata header; # add these here. @@ -5969,95 +5102,68 @@ def sample_get_conversion_event(): ) # Send the request. - response = rpc( + rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - def delete_conversion_event( + def approve_display_video360_advertiser_link_proposal( self, request: Optional[ - Union[analytics_admin.DeleteConversionEventRequest, dict] + Union[ + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, + dict, + ] ] = None, *, - name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a conversion event in a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteConversionEventRequest( - name="name_value", - ) - - # Make the request - client.delete_conversion_event(request=request) + ) -> analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse: + r"""Approves a DisplayVideo360AdvertiserLinkProposal. + The DisplayVideo360AdvertiserLinkProposal will be + deleted and a new DisplayVideo360AdvertiserLink will be + created. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteConversionEventRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalRequest, dict]): The request object. Request message for - DeleteConversionEvent RPC - name (str): - Required. The resource name of the conversion event to - delete. Format: - properties/{property}/conversionEvents/{conversion_event} - Example: "properties/123/conversionEvents/456" - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + ApproveDisplayVideo360AdvertiserLinkProposal + RPC. 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.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalResponse: + Response message for + ApproveDisplayVideo360AdvertiserLinkProposal + RPC. + """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - 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 analytics_admin.DeleteConversionEventRequest. + # in a analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.DeleteConversionEventRequest): - request = analytics_admin.DeleteConversionEventRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name + if not isinstance( + request, analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest + ): + request = ( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_conversion_event] + rpc = self._transport._wrapped_methods[ + self._transport.approve_display_video360_advertiser_link_proposal + ] # Certain fields should be provided within the metadata header; # add these here. @@ -6066,67 +5172,131 @@ def sample_delete_conversion_event(): ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def list_conversion_events( + # Done; return the response. + return response + + def cancel_display_video360_advertiser_link_proposal( self, request: Optional[ - Union[analytics_admin.ListConversionEventsRequest, dict] + Union[ + analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, dict + ] ] = None, *, - parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListConversionEventsPager: - r"""Returns a list of conversion events in the specified - parent property. - Returns an empty list if no conversion events are found. + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Cancels a DisplayVideo360AdvertiserLinkProposal. + Cancelling can mean either: + + - Declining a proposal initiated from Display & Video + 360 + - Withdrawing a proposal initiated from Google Analytics + After being cancelled, a proposal will eventually be + deleted automatically. - .. code-block:: python + Args: + request (Union[google.analytics.admin_v1alpha.types.CancelDisplayVideo360AdvertiserLinkProposalRequest, dict]): + The request object. Request message for + CancelDisplayVideo360AdvertiserLinkProposal + RPC. + 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. - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha + Returns: + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: + A proposal for a link between a GA4 + property and a Display & Video 360 + advertiser. - def sample_list_conversion_events(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() + A proposal is converted to a + DisplayVideo360AdvertiserLink once + approved. Google Analytics admins + approve inbound proposals while Display + & Video 360 admins approve outbound + proposals. - # Initialize request argument(s) - request = admin_v1alpha.ListConversionEventsRequest( - parent="parent_value", + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest + ): + request = ( + analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest( + request ) + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.cancel_display_video360_advertiser_link_proposal + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) - # Make the request - page_result = client.list_conversion_events(request=request) + # Done; return the response. + return response - # Handle the response - for response in page_result: - print(response) + def create_custom_dimension( + self, + request: Optional[ + Union[analytics_admin.CreateCustomDimensionRequest, dict] + ] = None, + *, + parent: Optional[str] = None, + custom_dimension: Optional[resources.CustomDimension] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CustomDimension: + r"""Creates a CustomDimension. Args: - request (Union[google.analytics.admin_v1alpha.types.ListConversionEventsRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.CreateCustomDimensionRequest, dict]): The request object. Request message for - ListConversionEvents RPC + CreateCustomDimension RPC. parent (str): - Required. The resource name of the - parent property. Example: - 'properties/123' + Required. Example format: + properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. + custom_dimension (google.analytics.admin_v1alpha.types.CustomDimension): + Required. The CustomDimension to + create. + + This corresponds to the ``custom_dimension`` 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. @@ -6134,18 +5304,13 @@ def sample_list_conversion_events(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListConversionEventsPager: - Response message for - ListConversionEvents RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. - + google.analytics.admin_v1alpha.types.CustomDimension: + A definition for a CustomDimension. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([parent, custom_dimension]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -6153,19 +5318,21 @@ def sample_list_conversion_events(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListConversionEventsRequest. + # in a analytics_admin.CreateCustomDimensionRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListConversionEventsRequest): - request = analytics_admin.ListConversionEventsRequest(request) + if not isinstance(request, analytics_admin.CreateCustomDimensionRequest): + request = analytics_admin.CreateCustomDimensionRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent + if custom_dimension is not None: + request.custom_dimension = custom_dimension # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_conversion_events] + rpc = self._transport._wrapped_methods[self._transport.create_custom_dimension] # Certain fields should be provided within the metadata header; # add these here. @@ -6181,68 +5348,39 @@ def sample_list_conversion_events(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListConversionEventsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - def get_display_video360_advertiser_link( + def update_custom_dimension( self, request: Optional[ - Union[analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, dict] + Union[analytics_admin.UpdateCustomDimensionRequest, dict] ] = None, *, - name: Optional[str] = None, + custom_dimension: Optional[resources.CustomDimension] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLink: - r"""Look up a single DisplayVideo360AdvertiserLink - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDisplayVideo360AdvertiserLinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_display_video360_advertiser_link(request=request) - - # Handle the response - print(response) + ) -> resources.CustomDimension: + r"""Updates a CustomDimension on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.UpdateCustomDimensionRequest, dict]): The request object. Request message for - GetDisplayVideo360AdvertiserLink RPC. - name (str): - Required. The name of the - DisplayVideo360AdvertiserLink to get. - Example format: - properties/1234/displayVideo360AdvertiserLink/5678 + UpdateCustomDimension RPC. + custom_dimension (google.analytics.admin_v1alpha.types.CustomDimension): + The CustomDimension to update + This corresponds to the ``custom_dimension`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. - This corresponds to the ``name`` field + This corresponds to the ``update_mask`` 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, @@ -6252,15 +5390,13 @@ def sample_get_display_video360_advertiser_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: - A link between a GA4 property and a - Display & Video 360 advertiser. - + google.analytics.admin_v1alpha.types.CustomDimension: + A definition for a CustomDimension. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([custom_dimension, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -6268,28 +5404,28 @@ def sample_get_display_video360_advertiser_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetDisplayVideo360AdvertiserLinkRequest. + # in a analytics_admin.UpdateCustomDimensionRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.GetDisplayVideo360AdvertiserLinkRequest - ): - request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(request) + if not isinstance(request, analytics_admin.UpdateCustomDimensionRequest): + request = analytics_admin.UpdateCustomDimensionRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if custom_dimension is not None: + request.custom_dimension = custom_dimension + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_display_video360_advertiser_link - ] + rpc = self._transport._wrapped_methods[self._transport.update_custom_dimension] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + (("custom_dimension.name", request.custom_dimension.name),) + ), ) # Send the request. @@ -6303,51 +5439,23 @@ def sample_get_display_video360_advertiser_link(): # Done; return the response. return response - def list_display_video360_advertiser_links( + def list_custom_dimensions( self, request: Optional[ - Union[analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, dict] + Union[analytics_admin.ListCustomDimensionsRequest, dict] ] = None, *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListDisplayVideo360AdvertiserLinksPager: - r"""Lists all DisplayVideo360AdvertiserLinks on a - property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_display_video360_advertiser_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListDisplayVideo360AdvertiserLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_display_video360_advertiser_links(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> pagers.ListCustomDimensionsPager: + r"""Lists CustomDimensions on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ListCustomDimensionsRequest, dict]): The request object. Request message for - ListDisplayVideo360AdvertiserLinks RPC. + ListCustomDimensions RPC. parent (str): Required. Example format: properties/1234 @@ -6362,9 +5470,9 @@ def sample_list_display_video360_advertiser_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinksPager: + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomDimensionsPager: Response message for - ListDisplayVideo360AdvertiserLinks RPC. + ListCustomDimensions RPC. Iterating over this object will yield results and resolve additional pages automatically. @@ -6381,13 +5489,11 @@ def sample_list_display_video360_advertiser_links(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListDisplayVideo360AdvertiserLinksRequest. + # in a analytics_admin.ListCustomDimensionsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.ListDisplayVideo360AdvertiserLinksRequest - ): - request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(request) + if not isinstance(request, analytics_admin.ListCustomDimensionsRequest): + request = analytics_admin.ListCustomDimensionsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: @@ -6395,9 +5501,7 @@ def sample_list_display_video360_advertiser_links(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.list_display_video360_advertiser_links - ] + rpc = self._transport._wrapped_methods[self._transport.list_custom_dimensions] # Certain fields should be provided within the metadata header; # add these here. @@ -6415,7 +5519,7 @@ def sample_list_display_video360_advertiser_links(): # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. - response = pagers.ListDisplayVideo360AdvertiserLinksPager( + response = pagers.ListCustomDimensionsPager( method=rpc, request=request, response=response, @@ -6425,69 +5529,30 @@ def sample_list_display_video360_advertiser_links(): # Done; return the response. return response - def create_display_video360_advertiser_link( + def archive_custom_dimension( self, request: Optional[ - Union[analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, dict] + Union[analytics_admin.ArchiveCustomDimensionRequest, dict] ] = None, *, - parent: Optional[str] = None, - display_video_360_advertiser_link: Optional[ - resources.DisplayVideo360AdvertiserLink - ] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLink: - r"""Creates a DisplayVideo360AdvertiserLink. - This can only be utilized by users who have proper - authorization both on the Google Analytics property and - on the Display & Video 360 advertiser. Users who do not - have access to the Display & Video 360 advertiser should - instead seek to create a DisplayVideo360LinkProposal. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateDisplayVideo360AdvertiserLinkRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_display_video360_advertiser_link(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Archives a CustomDimension on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ArchiveCustomDimensionRequest, dict]): The request object. Request message for - CreateDisplayVideo360AdvertiserLink RPC. - parent (str): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - display_video_360_advertiser_link (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink): - Required. The - DisplayVideo360AdvertiserLink to create. + ArchiveCustomDimension RPC. + name (str): + Required. The name of the + CustomDimension to archive. Example + format: + properties/1234/customDimensions/5678 - This corresponds to the ``display_video_360_advertiser_link`` field + This corresponds to the ``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, @@ -6495,17 +5560,11 @@ def sample_create_display_video360_advertiser_link(): 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.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: - A link between a GA4 property and a - Display & Video 360 advertiser. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, display_video_360_advertiser_link]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -6513,93 +5572,55 @@ def sample_create_display_video360_advertiser_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest. + # in a analytics_admin.ArchiveCustomDimensionRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest - ): - request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest( - request - ) + if not isinstance(request, analytics_admin.ArchiveCustomDimensionRequest): + request = analytics_admin.ArchiveCustomDimensionRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if display_video_360_advertiser_link is not None: - request.display_video_360_advertiser_link = ( - display_video_360_advertiser_link - ) + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.create_display_video360_advertiser_link - ] + rpc = self._transport._wrapped_methods[self._transport.archive_custom_dimension] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = rpc( + rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - def delete_display_video360_advertiser_link( + def get_custom_dimension( self, request: Optional[ - Union[analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, dict] + Union[analytics_admin.GetCustomDimensionRequest, dict] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a DisplayVideo360AdvertiserLink on a - property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteDisplayVideo360AdvertiserLinkRequest( - name="name_value", - ) - - # Make the request - client.delete_display_video360_advertiser_link(request=request) + ) -> resources.CustomDimension: + r"""Lookup for a single CustomDimension. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.GetCustomDimensionRequest, dict]): The request object. Request message for - DeleteDisplayVideo360AdvertiserLink RPC. + GetCustomDimension RPC. name (str): Required. The name of the - DisplayVideo360AdvertiserLink to delete. - Example format: - properties/1234/displayVideo360AdvertiserLinks/5678 + CustomDimension to get. Example format: + properties/1234/customDimensions/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -6609,6 +5630,10 @@ def sample_delete_display_video360_advertiser_link(): 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.analytics.admin_v1alpha.types.CustomDimension: + A definition for a CustomDimension. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -6621,15 +5646,11 @@ def sample_delete_display_video360_advertiser_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest. + # in a analytics_admin.GetCustomDimensionRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest - ): - request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest( - request - ) + if not isinstance(request, analytics_admin.GetCustomDimensionRequest): + request = analytics_admin.GetCustomDimensionRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -6637,9 +5658,7 @@ def sample_delete_display_video360_advertiser_link(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.delete_display_video360_advertiser_link - ] + rpc = self._transport._wrapped_methods[self._transport.get_custom_dimension] # Certain fields should be provided within the metadata header; # add these here. @@ -6648,73 +5667,44 @@ def sample_delete_display_video360_advertiser_link(): ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def update_display_video360_advertiser_link( + # Done; return the response. + return response + + def create_custom_metric( self, request: Optional[ - Union[analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, dict] + Union[analytics_admin.CreateCustomMetricRequest, dict] ] = None, *, - display_video_360_advertiser_link: Optional[ - resources.DisplayVideo360AdvertiserLink - ] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, + custom_metric: Optional[resources.CustomMetric] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLink: - r"""Updates a DisplayVideo360AdvertiserLink on a - property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateDisplayVideo360AdvertiserLinkRequest( - ) - - # Make the request - response = client.update_display_video360_advertiser_link(request=request) - - # Handle the response - print(response) + ) -> resources.CustomMetric: + r"""Creates a CustomMetric. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateDisplayVideo360AdvertiserLinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.CreateCustomMetricRequest, dict]): The request object. Request message for - UpdateDisplayVideo360AdvertiserLink RPC. - display_video_360_advertiser_link (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink): - The DisplayVideo360AdvertiserLink to - update + CreateCustomMetric RPC. + parent (str): + Required. Example format: + properties/1234 - This corresponds to the ``display_video_360_advertiser_link`` field + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. - - This corresponds to the ``update_mask`` field + custom_metric (google.analytics.admin_v1alpha.types.CustomMetric): + Required. The CustomMetric to create. + This corresponds to the ``custom_metric`` 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, @@ -6724,15 +5714,13 @@ def sample_update_display_video360_advertiser_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: - A link between a GA4 property and a - Display & Video 360 advertiser. - + google.analytics.admin_v1alpha.types.CustomMetric: + A definition for a custom metric. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([display_video_360_advertiser_link, update_mask]) + has_flattened_params = any([parent, custom_metric]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -6740,41 +5728,26 @@ def sample_update_display_video360_advertiser_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest. + # in a analytics_admin.CreateCustomMetricRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest - ): - request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest( - request - ) + if not isinstance(request, analytics_admin.CreateCustomMetricRequest): + request = analytics_admin.CreateCustomMetricRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if display_video_360_advertiser_link is not None: - request.display_video_360_advertiser_link = ( - display_video_360_advertiser_link - ) - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent + if custom_metric is not None: + request.custom_metric = custom_metric # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.update_display_video360_advertiser_link - ] + rpc = self._transport._wrapped_methods[self._transport.create_custom_metric] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "display_video_360_advertiser_link.name", - request.display_video_360_advertiser_link.name, - ), - ) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -6788,58 +5761,36 @@ def sample_update_display_video360_advertiser_link(): # Done; return the response. return response - def get_display_video360_advertiser_link_proposal( + def update_custom_metric( self, request: Optional[ - Union[analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, dict] + Union[analytics_admin.UpdateCustomMetricRequest, dict] ] = None, *, - name: Optional[str] = None, + custom_metric: Optional[resources.CustomMetric] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLinkProposal: - r"""Lookup for a single - DisplayVideo360AdvertiserLinkProposal. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - response = client.get_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) + ) -> resources.CustomMetric: + r"""Updates a CustomMetric on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkProposalRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.UpdateCustomMetricRequest, dict]): The request object. Request message for - GetDisplayVideo360AdvertiserLinkProposal - RPC. - name (str): - Required. The name of the - DisplayVideo360AdvertiserLinkProposal to - get. Example format: - properties/1234/displayVideo360AdvertiserLinkProposals/5678 + UpdateCustomMetric RPC. + custom_metric (google.analytics.admin_v1alpha.types.CustomMetric): + The CustomMetric to update + This corresponds to the ``custom_metric`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. - This corresponds to the ``name`` field + This corresponds to the ``update_mask`` 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, @@ -6849,23 +5800,13 @@ def sample_get_display_video360_advertiser_link_proposal(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: - A proposal for a link between a GA4 - property and a Display & Video 360 - advertiser. - - A proposal is converted to a - DisplayVideo360AdvertiserLink once - approved. Google Analytics admins - approve inbound proposals while Display - & Video 360 admins approve outbound - proposals. - + google.analytics.admin_v1alpha.types.CustomMetric: + A definition for a custom metric. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([custom_metric, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -6873,30 +5814,28 @@ def sample_get_display_video360_advertiser_link_proposal(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest. + # in a analytics_admin.UpdateCustomMetricRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest - ): - request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest( - request - ) + if not isinstance(request, analytics_admin.UpdateCustomMetricRequest): + request = analytics_admin.UpdateCustomMetricRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if custom_metric is not None: + request.custom_metric = custom_metric + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_display_video360_advertiser_link_proposal - ] + rpc = self._transport._wrapped_methods[self._transport.update_custom_metric] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + (("custom_metric.name", request.custom_metric.name),) + ), ) # Send the request. @@ -6910,53 +5849,20 @@ def sample_get_display_video360_advertiser_link_proposal(): # Done; return the response. return response - def list_display_video360_advertiser_link_proposals( + def list_custom_metrics( self, - request: Optional[ - Union[ - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, dict - ] - ] = None, + request: Optional[Union[analytics_admin.ListCustomMetricsRequest, dict]] = None, *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListDisplayVideo360AdvertiserLinkProposalsPager: - r"""Lists DisplayVideo360AdvertiserLinkProposals on a - property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_display_video360_advertiser_link_proposals(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListDisplayVideo360AdvertiserLinkProposalsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_display_video360_advertiser_link_proposals(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> pagers.ListCustomMetricsPager: + r"""Lists CustomMetrics on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsRequest, dict]): - The request object. Request message for - ListDisplayVideo360AdvertiserLinkProposals + request (Union[google.analytics.admin_v1alpha.types.ListCustomMetricsRequest, dict]): + The request object. Request message for ListCustomMetrics RPC. parent (str): Required. Example format: @@ -6972,12 +5878,12 @@ def sample_list_display_video360_advertiser_link_proposals(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinkProposalsPager: + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomMetricsPager: Response message for - ListDisplayVideo360AdvertiserLinkProposals - RPC. Iterating over this object will - yield results and resolve additional - pages automatically. + ListCustomMetrics RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. @@ -6991,15 +5897,11 @@ def sample_list_display_video360_advertiser_link_proposals(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest. + # in a analytics_admin.ListCustomMetricsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest - ): - request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest( - request - ) + if not isinstance(request, analytics_admin.ListCustomMetricsRequest): + request = analytics_admin.ListCustomMetricsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: @@ -7007,9 +5909,7 @@ def sample_list_display_video360_advertiser_link_proposals(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.list_display_video360_advertiser_link_proposals - ] + rpc = self._transport._wrapped_methods[self._transport.list_custom_metrics] # Certain fields should be provided within the metadata header; # add these here. @@ -7027,7 +5927,7 @@ def sample_list_display_video360_advertiser_link_proposals(): # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. - response = pagers.ListDisplayVideo360AdvertiserLinkProposalsPager( + response = pagers.ListCustomMetricsPager( method=rpc, request=request, response=response, @@ -7037,68 +5937,29 @@ def sample_list_display_video360_advertiser_link_proposals(): # Done; return the response. return response - def create_display_video360_advertiser_link_proposal( + def archive_custom_metric( self, request: Optional[ - Union[ - analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, dict - ] + Union[analytics_admin.ArchiveCustomMetricRequest, dict] ] = None, *, - parent: Optional[str] = None, - display_video_360_advertiser_link_proposal: Optional[ - resources.DisplayVideo360AdvertiserLinkProposal - ] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLinkProposal: - r"""Creates a DisplayVideo360AdvertiserLinkProposal. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateDisplayVideo360AdvertiserLinkProposalRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Archives a CustomMetric on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkProposalRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ArchiveCustomMetricRequest, dict]): The request object. Request message for - CreateDisplayVideo360AdvertiserLinkProposal - RPC. - parent (str): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - display_video_360_advertiser_link_proposal (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal): - Required. The - DisplayVideo360AdvertiserLinkProposal to - create. + ArchiveCustomMetric RPC. + name (str): + Required. The name of the + CustomMetric to archive. Example format: + properties/1234/customMetrics/5678 - This corresponds to the ``display_video_360_advertiser_link_proposal`` field + This corresponds to the ``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, @@ -7106,124 +5967,65 @@ def sample_create_display_video360_advertiser_link_proposal(): 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.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: - A proposal for a link between a GA4 - property and a Display & Video 360 - advertiser. - - A proposal is converted to a - DisplayVideo360AdvertiserLink once - approved. Google Analytics admins - approve inbound proposals while Display - & Video 360 admins approve outbound - proposals. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, display_video_360_advertiser_link_proposal]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + 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 analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest. + # in a analytics_admin.ArchiveCustomMetricRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest - ): - request = ( - analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest( - request - ) - ) + if not isinstance(request, analytics_admin.ArchiveCustomMetricRequest): + request = analytics_admin.ArchiveCustomMetricRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if display_video_360_advertiser_link_proposal is not None: - request.display_video_360_advertiser_link_proposal = ( - display_video_360_advertiser_link_proposal - ) + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.create_display_video360_advertiser_link_proposal - ] + rpc = self._transport._wrapped_methods[self._transport.archive_custom_metric] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = rpc( + rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - def delete_display_video360_advertiser_link_proposal( + def get_custom_metric( self, - request: Optional[ - Union[ - analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, dict - ] - ] = None, + request: Optional[Union[analytics_admin.GetCustomMetricRequest, dict]] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a DisplayVideo360AdvertiserLinkProposal on a - property. This can only be used on cancelled proposals. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - client.delete_display_video360_advertiser_link_proposal(request=request) + ) -> resources.CustomMetric: + r"""Lookup for a single CustomMetric. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkProposalRequest, dict]): - The request object. Request message for - DeleteDisplayVideo360AdvertiserLinkProposal + request (Union[google.analytics.admin_v1alpha.types.GetCustomMetricRequest, dict]): + The request object. Request message for GetCustomMetric RPC. name (str): Required. The name of the - DisplayVideo360AdvertiserLinkProposal to - delete. Example format: - properties/1234/displayVideo360AdvertiserLinkProposals/5678 + CustomMetric to get. Example format: + properties/1234/customMetrics/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -7233,6 +6035,10 @@ def sample_delete_display_video360_advertiser_link_proposal(): 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.analytics.admin_v1alpha.types.CustomMetric: + A definition for a custom metric. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -7245,17 +6051,11 @@ def sample_delete_display_video360_advertiser_link_proposal(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest. + # in a analytics_admin.GetCustomMetricRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest - ): - request = ( - analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest( - request - ) - ) + if not isinstance(request, analytics_admin.GetCustomMetricRequest): + request = analytics_admin.GetCustomMetricRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -7263,9 +6063,7 @@ def sample_delete_display_video360_advertiser_link_proposal(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.delete_display_video360_advertiser_link_proposal - ] + rpc = self._transport._wrapped_methods[self._transport.get_custom_metric] # Certain fields should be provided within the metadata header; # add these here. @@ -7274,62 +6072,45 @@ def sample_delete_display_video360_advertiser_link_proposal(): ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def approve_display_video360_advertiser_link_proposal( + # Done; return the response. + return response + + def get_data_retention_settings( self, request: Optional[ - Union[ - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, - dict, - ] + Union[analytics_admin.GetDataRetentionSettingsRequest, dict] ] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse: - r"""Approves a DisplayVideo360AdvertiserLinkProposal. - The DisplayVideo360AdvertiserLinkProposal will be - deleted and a new DisplayVideo360AdvertiserLink will be - created. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_approve_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ApproveDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - response = client.approve_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) + ) -> resources.DataRetentionSettings: + r"""Returns the singleton data retention settings for + this property. Args: - request (Union[google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.GetDataRetentionSettingsRequest, dict]): The request object. Request message for - ApproveDisplayVideo360AdvertiserLinkProposal - RPC. + GetDataRetentionSettings RPC. + name (str): + Required. The name of the settings to + lookup. Format: + + properties/{property}/dataRetentionSettings + Example: + "properties/1000/dataRetentionSettings" + + This corresponds to the ``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. @@ -7337,30 +6118,36 @@ def sample_approve_display_video360_advertiser_link_proposal(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalResponse: - Response message for - ApproveDisplayVideo360AdvertiserLinkProposal - RPC. + google.analytics.admin_v1alpha.types.DataRetentionSettings: + Settings values for data retention. + This is a singleton resource. """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + 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 analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest. + # in a analytics_admin.GetDataRetentionSettingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest - ): - request = ( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest( - request - ) - ) + if not isinstance(request, analytics_admin.GetDataRetentionSettingsRequest): + request = analytics_admin.GetDataRetentionSettingsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.approve_display_video360_advertiser_link_proposal + self._transport.get_data_retention_settings ] # Certain fields should be provided within the metadata header; @@ -7380,58 +6167,42 @@ def sample_approve_display_video360_advertiser_link_proposal(): # Done; return the response. return response - def cancel_display_video360_advertiser_link_proposal( + def update_data_retention_settings( self, request: Optional[ - Union[ - analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, dict - ] + Union[analytics_admin.UpdateDataRetentionSettingsRequest, dict] ] = None, *, + data_retention_settings: Optional[resources.DataRetentionSettings] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLinkProposal: - r"""Cancels a DisplayVideo360AdvertiserLinkProposal. - Cancelling can mean either: - - - Declining a proposal initiated from Display & Video - 360 - - Withdrawing a proposal initiated from Google Analytics - After being cancelled, a proposal will eventually be - deleted automatically. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_cancel_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CancelDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - response = client.cancel_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) + ) -> resources.DataRetentionSettings: + r"""Updates the singleton data retention settings for + this property. Args: - request (Union[google.analytics.admin_v1alpha.types.CancelDisplayVideo360AdvertiserLinkProposalRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.UpdateDataRetentionSettingsRequest, dict]): The request object. Request message for - CancelDisplayVideo360AdvertiserLinkProposal - RPC. + UpdateDataRetentionSettings RPC. + data_retention_settings (google.analytics.admin_v1alpha.types.DataRetentionSettings): + Required. The settings to update. The ``name`` field is + used to identify the settings to be updated. + + This corresponds to the ``data_retention_settings`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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. @@ -7439,43 +6210,51 @@ def sample_cancel_display_video360_advertiser_link_proposal(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: - A proposal for a link between a GA4 - property and a Display & Video 360 - advertiser. - - A proposal is converted to a - DisplayVideo360AdvertiserLink once - approved. Google Analytics admins - approve inbound proposals while Display - & Video 360 admins approve outbound - proposals. + google.analytics.admin_v1alpha.types.DataRetentionSettings: + Settings values for data retention. + This is a singleton resource. """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([data_retention_settings, update_mask]) + if request is not None and has_flattened_params: + 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 analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest. + # in a analytics_admin.UpdateDataRetentionSettingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest - ): - request = ( - analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest( - request - ) - ) + if not isinstance(request, analytics_admin.UpdateDataRetentionSettingsRequest): + request = analytics_admin.UpdateDataRetentionSettingsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if data_retention_settings is not None: + request.data_retention_settings = data_retention_settings + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.cancel_display_video360_advertiser_link_proposal + self._transport.update_data_retention_settings ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "data_retention_settings.name", + request.data_retention_settings.name, + ), + ) + ), ) # Send the request. @@ -7489,56 +6268,22 @@ def sample_cancel_display_video360_advertiser_link_proposal(): # Done; return the response. return response - def create_custom_dimension( + def create_data_stream( self, - request: Optional[ - Union[analytics_admin.CreateCustomDimensionRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.CreateDataStreamRequest, dict]] = None, *, parent: Optional[str] = None, - custom_dimension: Optional[resources.CustomDimension] = None, + data_stream: Optional[resources.DataStream] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomDimension: - r"""Creates a CustomDimension. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - custom_dimension = admin_v1alpha.CustomDimension() - custom_dimension.parameter_name = "parameter_name_value" - custom_dimension.display_name = "display_name_value" - custom_dimension.scope = "ITEM" - - request = admin_v1alpha.CreateCustomDimensionRequest( - parent="parent_value", - custom_dimension=custom_dimension, - ) - - # Make the request - response = client.create_custom_dimension(request=request) - - # Handle the response - print(response) + ) -> resources.DataStream: + r"""Creates a DataStream. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateCustomDimensionRequest, dict]): - The request object. Request message for - CreateCustomDimension RPC. + request (Union[google.analytics.admin_v1alpha.types.CreateDataStreamRequest, dict]): + The request object. Request message for CreateDataStream + RPC. parent (str): Required. Example format: properties/1234 @@ -7546,11 +6291,9 @@ def sample_create_custom_dimension(): This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - custom_dimension (google.analytics.admin_v1alpha.types.CustomDimension): - Required. The CustomDimension to - create. - - This corresponds to the ``custom_dimension`` field + data_stream (google.analytics.admin_v1alpha.types.DataStream): + Required. The DataStream to create. + This corresponds to the ``data_stream`` 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, @@ -7560,13 +6303,15 @@ def sample_create_custom_dimension(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomDimension: - A definition for a CustomDimension. + google.analytics.admin_v1alpha.types.DataStream: + A resource message representing a + data stream. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, custom_dimension]) + has_flattened_params = any([parent, data_stream]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -7574,21 +6319,21 @@ def sample_create_custom_dimension(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateCustomDimensionRequest. + # in a analytics_admin.CreateDataStreamRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateCustomDimensionRequest): - request = analytics_admin.CreateCustomDimensionRequest(request) + if not isinstance(request, analytics_admin.CreateDataStreamRequest): + request = analytics_admin.CreateDataStreamRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if custom_dimension is not None: - request.custom_dimension = custom_dimension + if data_stream is not None: + request.data_stream = data_stream # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_custom_dimension] + rpc = self._transport._wrapped_methods[self._transport.create_data_stream] # Certain fields should be provided within the metadata header; # add these here. @@ -7607,52 +6352,93 @@ def sample_create_custom_dimension(): # Done; return the response. return response - def update_custom_dimension( + def delete_data_stream( self, - request: Optional[ - Union[analytics_admin.UpdateCustomDimensionRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.DeleteDataStreamRequest, dict]] = None, *, - custom_dimension: Optional[resources.CustomDimension] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomDimension: - r"""Updates a CustomDimension on a property. + ) -> None: + r"""Deletes a DataStream on a property. - .. code-block:: python + Args: + request (Union[google.analytics.admin_v1alpha.types.DeleteDataStreamRequest, dict]): + The request object. Request message for DeleteDataStream + RPC. + name (str): + Required. The name of the DataStream + to delete. Example format: + properties/1234/dataStreams/5678 - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha + This corresponds to the ``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. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) - def sample_update_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.DeleteDataStreamRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.DeleteDataStreamRequest): + request = analytics_admin.DeleteDataStreamRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name - # Initialize request argument(s) - request = admin_v1alpha.UpdateCustomDimensionRequest( - ) + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.delete_data_stream] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) - # Make the request - response = client.update_custom_dimension(request=request) + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) - # Handle the response - print(response) + def update_data_stream( + self, + request: Optional[Union[analytics_admin.UpdateDataStreamRequest, dict]] = None, + *, + data_stream: Optional[resources.DataStream] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DataStream: + r"""Updates a DataStream on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateCustomDimensionRequest, dict]): - The request object. Request message for - UpdateCustomDimension RPC. - custom_dimension (google.analytics.admin_v1alpha.types.CustomDimension): - The CustomDimension to update - This corresponds to the ``custom_dimension`` field + request (Union[google.analytics.admin_v1alpha.types.UpdateDataStreamRequest, dict]): + The request object. Request message for UpdateDataStream + RPC. + data_stream (google.analytics.admin_v1alpha.types.DataStream): + The DataStream to update + This corresponds to the ``data_stream`` field on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (google.protobuf.field_mask_pb2.FieldMask): @@ -7671,13 +6457,15 @@ def sample_update_custom_dimension(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomDimension: - A definition for a CustomDimension. + google.analytics.admin_v1alpha.types.DataStream: + A resource message representing a + data stream. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([custom_dimension, update_mask]) + has_flattened_params = any([data_stream, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -7685,27 +6473,27 @@ def sample_update_custom_dimension(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateCustomDimensionRequest. + # in a analytics_admin.UpdateDataStreamRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateCustomDimensionRequest): - request = analytics_admin.UpdateCustomDimensionRequest(request) + if not isinstance(request, analytics_admin.UpdateDataStreamRequest): + request = analytics_admin.UpdateDataStreamRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if custom_dimension is not None: - request.custom_dimension = custom_dimension + if data_stream is not None: + request.data_stream = data_stream if update_mask is not None: request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_custom_dimension] + rpc = self._transport._wrapped_methods[self._transport.update_data_stream] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata( - (("custom_dimension.name", request.custom_dimension.name),) + (("data_stream.name", request.data_stream.name),) ), ) @@ -7720,50 +6508,21 @@ def sample_update_custom_dimension(): # Done; return the response. return response - def list_custom_dimensions( + def list_data_streams( self, - request: Optional[ - Union[analytics_admin.ListCustomDimensionsRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.ListDataStreamsRequest, dict]] = None, *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCustomDimensionsPager: - r"""Lists CustomDimensions on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_custom_dimensions(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListCustomDimensionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_custom_dimensions(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> pagers.ListDataStreamsPager: + r"""Lists DataStreams on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.ListCustomDimensionsRequest, dict]): - The request object. Request message for - ListCustomDimensions RPC. + request (Union[google.analytics.admin_v1alpha.types.ListDataStreamsRequest, dict]): + The request object. Request message for ListDataStreams + RPC. parent (str): Required. Example format: properties/1234 @@ -7778,9 +6537,9 @@ def sample_list_custom_dimensions(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomDimensionsPager: - Response message for - ListCustomDimensions RPC. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDataStreamsPager: + Response message for ListDataStreams + RPC. Iterating over this object will yield results and resolve additional pages automatically. @@ -7797,11 +6556,11 @@ def sample_list_custom_dimensions(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListCustomDimensionsRequest. + # in a analytics_admin.ListDataStreamsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListCustomDimensionsRequest): - request = analytics_admin.ListCustomDimensionsRequest(request) + if not isinstance(request, analytics_admin.ListDataStreamsRequest): + request = analytics_admin.ListDataStreamsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: @@ -7809,7 +6568,7 @@ def sample_list_custom_dimensions(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_custom_dimensions] + rpc = self._transport._wrapped_methods[self._transport.list_data_streams] # Certain fields should be provided within the metadata header; # add these here. @@ -7827,7 +6586,7 @@ def sample_list_custom_dimensions(): # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. - response = pagers.ListCustomDimensionsPager( + response = pagers.ListDataStreamsPager( method=rpc, request=request, response=response, @@ -7837,51 +6596,25 @@ def sample_list_custom_dimensions(): # Done; return the response. return response - def archive_custom_dimension( + def get_data_stream( self, - request: Optional[ - Union[analytics_admin.ArchiveCustomDimensionRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.GetDataStreamRequest, dict]] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Archives a CustomDimension on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_archive_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ArchiveCustomDimensionRequest( - name="name_value", - ) - - # Make the request - client.archive_custom_dimension(request=request) + ) -> resources.DataStream: + r"""Lookup for a single DataStream. Args: - request (Union[google.analytics.admin_v1alpha.types.ArchiveCustomDimensionRequest, dict]): - The request object. Request message for - ArchiveCustomDimension RPC. + request (Union[google.analytics.admin_v1alpha.types.GetDataStreamRequest, dict]): + The request object. Request message for GetDataStream + RPC. name (str): - Required. The name of the - CustomDimension to archive. Example - format: - properties/1234/customDimensions/5678 + Required. The name of the DataStream + to get. Example format: + properties/1234/dataStreams/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -7891,7 +6624,13 @@ def sample_archive_custom_dimension(): 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.analytics.admin_v1alpha.types.DataStream: + A resource message representing a + data stream. + + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. @@ -7903,11 +6642,11 @@ def sample_archive_custom_dimension(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ArchiveCustomDimensionRequest. + # in a analytics_admin.GetDataStreamRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ArchiveCustomDimensionRequest): - request = analytics_admin.ArchiveCustomDimensionRequest(request) + if not isinstance(request, analytics_admin.GetDataStreamRequest): + request = analytics_admin.GetDataStreamRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -7915,7 +6654,7 @@ def sample_archive_custom_dimension(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.archive_custom_dimension] + rpc = self._transport._wrapped_methods[self._transport.get_data_stream] # Certain fields should be provided within the metadata header; # add these here. @@ -7924,60 +6663,36 @@ def sample_archive_custom_dimension(): ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def get_custom_dimension( + # Done; return the response. + return response + + def get_audience( self, - request: Optional[ - Union[analytics_admin.GetCustomDimensionRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.GetAudienceRequest, dict]] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomDimension: - r"""Lookup for a single CustomDimension. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetCustomDimensionRequest( - name="name_value", - ) - - # Make the request - response = client.get_custom_dimension(request=request) - - # Handle the response - print(response) + ) -> audience.Audience: + r"""Lookup for a single Audience. + Audiences created before 2020 may not be supported. + Default audiences will not show filter definitions. Args: - request (Union[google.analytics.admin_v1alpha.types.GetCustomDimensionRequest, dict]): - The request object. Request message for - GetCustomDimension RPC. + request (Union[google.analytics.admin_v1alpha.types.GetAudienceRequest, dict]): + The request object. Request message for GetAudience RPC. name (str): - Required. The name of the - CustomDimension to get. Example format: - properties/1234/customDimensions/5678 + Required. The name of the Audience to + get. Example format: + properties/1234/audiences/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -7989,8 +6704,10 @@ def sample_get_custom_dimension(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomDimension: - A definition for a CustomDimension. + google.analytics.admin_v1alpha.types.Audience: + A resource message representing a GA4 + Audience. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -8003,11 +6720,11 @@ def sample_get_custom_dimension(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetCustomDimensionRequest. + # in a analytics_admin.GetAudienceRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetCustomDimensionRequest): - request = analytics_admin.GetCustomDimensionRequest(request) + if not isinstance(request, analytics_admin.GetAudienceRequest): + request = analytics_admin.GetAudienceRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -8015,7 +6732,7 @@ def sample_get_custom_dimension(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_custom_dimension] + rpc = self._transport._wrapped_methods[self._transport.get_audience] # Certain fields should be provided within the metadata header; # add these here. @@ -8034,57 +6751,23 @@ def sample_get_custom_dimension(): # Done; return the response. return response - def create_custom_metric( + def list_audiences( self, - request: Optional[ - Union[analytics_admin.CreateCustomMetricRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.ListAudiencesRequest, dict]] = None, *, parent: Optional[str] = None, - custom_metric: Optional[resources.CustomMetric] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomMetric: - r"""Creates a CustomMetric. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - custom_metric = admin_v1alpha.CustomMetric() - custom_metric.parameter_name = "parameter_name_value" - custom_metric.display_name = "display_name_value" - custom_metric.measurement_unit = "HOURS" - custom_metric.scope = "EVENT" - - request = admin_v1alpha.CreateCustomMetricRequest( - parent="parent_value", - custom_metric=custom_metric, - ) - - # Make the request - response = client.create_custom_metric(request=request) - - # Handle the response - print(response) + ) -> pagers.ListAudiencesPager: + r"""Lists Audiences on a property. + Audiences created before 2020 may not be supported. + Default audiences will not show filter definitions. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateCustomMetricRequest, dict]): - The request object. Request message for - CreateCustomMetric RPC. + request (Union[google.analytics.admin_v1alpha.types.ListAudiencesRequest, dict]): + The request object. Request message for ListAudiences + RPC. parent (str): Required. Example format: properties/1234 @@ -8092,11 +6775,6 @@ def sample_create_custom_metric(): This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - custom_metric (google.analytics.admin_v1alpha.types.CustomMetric): - Required. The CustomMetric to create. - This corresponds to the ``custom_metric`` 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. @@ -8104,13 +6782,18 @@ def sample_create_custom_metric(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomMetric: - A definition for a custom metric. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAudiencesPager: + Response message for ListAudiences + RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, custom_metric]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -8118,21 +6801,19 @@ def sample_create_custom_metric(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateCustomMetricRequest. + # in a analytics_admin.ListAudiencesRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateCustomMetricRequest): - request = analytics_admin.CreateCustomMetricRequest(request) + if not isinstance(request, analytics_admin.ListAudiencesRequest): + request = analytics_admin.ListAudiencesRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if custom_metric is not None: - request.custom_metric = custom_metric # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_custom_metric] + rpc = self._transport._wrapped_methods[self._transport.list_audiences] # Certain fields should be provided within the metadata header; # add these here. @@ -8148,64 +6829,44 @@ def sample_create_custom_metric(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListAudiencesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - def update_custom_metric( + def create_audience( self, - request: Optional[ - Union[analytics_admin.UpdateCustomMetricRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.CreateAudienceRequest, dict]] = None, *, - custom_metric: Optional[resources.CustomMetric] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, + audience: Optional[gaa_audience.Audience] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomMetric: - r"""Updates a CustomMetric on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateCustomMetricRequest( - ) - - # Make the request - response = client.update_custom_metric(request=request) - - # Handle the response - print(response) + ) -> gaa_audience.Audience: + r"""Creates an Audience. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateCustomMetricRequest, dict]): - The request object. Request message for - UpdateCustomMetric RPC. - custom_metric (google.analytics.admin_v1alpha.types.CustomMetric): - The CustomMetric to update - This corresponds to the ``custom_metric`` field + request (Union[google.analytics.admin_v1alpha.types.CreateAudienceRequest, dict]): + The request object. Request message for CreateAudience + RPC. + parent (str): + Required. Example format: + properties/1234 + + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. - - This corresponds to the ``update_mask`` field + audience (google.analytics.admin_v1alpha.types.Audience): + Required. The audience to create. + This corresponds to the ``audience`` 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, @@ -8215,13 +6876,15 @@ def sample_update_custom_metric(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomMetric: - A definition for a custom metric. + google.analytics.admin_v1alpha.types.Audience: + A resource message representing a GA4 + Audience. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([custom_metric, update_mask]) + has_flattened_params = any([parent, audience]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -8229,28 +6892,26 @@ def sample_update_custom_metric(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateCustomMetricRequest. + # in a analytics_admin.CreateAudienceRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateCustomMetricRequest): - request = analytics_admin.UpdateCustomMetricRequest(request) + if not isinstance(request, analytics_admin.CreateAudienceRequest): + request = analytics_admin.CreateAudienceRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if custom_metric is not None: - request.custom_metric = custom_metric - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent + if audience is not None: + request.audience = audience # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_custom_metric] + rpc = self._transport._wrapped_methods[self._transport.create_audience] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("custom_metric.name", request.custom_metric.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -8264,53 +6925,38 @@ def sample_update_custom_metric(): # Done; return the response. return response - def list_custom_metrics( + def update_audience( self, - request: Optional[Union[analytics_admin.ListCustomMetricsRequest, dict]] = None, + request: Optional[Union[analytics_admin.UpdateAudienceRequest, dict]] = None, *, - parent: Optional[str] = None, + audience: Optional[gaa_audience.Audience] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCustomMetricsPager: - r"""Lists CustomMetrics on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_custom_metrics(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListCustomMetricsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_custom_metrics(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> gaa_audience.Audience: + r"""Updates an Audience on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.ListCustomMetricsRequest, dict]): - The request object. Request message for ListCustomMetrics + request (Union[google.analytics.admin_v1alpha.types.UpdateAudienceRequest, dict]): + The request object. Request message for UpdateAudience RPC. - parent (str): - Required. Example format: - properties/1234 + audience (google.analytics.admin_v1alpha.types.Audience): + Required. The audience to update. The audience's + ``name`` field is used to identify the audience to be + updated. - This corresponds to the ``parent`` field + This corresponds to the ``audience`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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, @@ -8320,18 +6966,15 @@ def sample_list_custom_metrics(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomMetricsPager: - Response message for - ListCustomMetrics RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.Audience: + A resource message representing a GA4 + Audience. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([audience, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -8339,24 +6982,28 @@ def sample_list_custom_metrics(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListCustomMetricsRequest. + # in a analytics_admin.UpdateAudienceRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListCustomMetricsRequest): - request = analytics_admin.ListCustomMetricsRequest(request) + if not isinstance(request, analytics_admin.UpdateAudienceRequest): + request = analytics_admin.UpdateAudienceRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - + if audience is not None: + request.audience = audience + if update_mask is not None: + request.update_mask = update_mask + # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_custom_metrics] + rpc = self._transport._wrapped_methods[self._transport.update_audience] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata( + (("audience.name", request.audience.name),) + ), ) # Send the request. @@ -8367,66 +7014,23 @@ def sample_list_custom_metrics(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCustomMetricsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - def archive_custom_metric( + def archive_audience( self, - request: Optional[ - Union[analytics_admin.ArchiveCustomMetricRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.ArchiveAudienceRequest, dict]] = None, *, - name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: - r"""Archives a CustomMetric on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_archive_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ArchiveCustomMetricRequest( - name="name_value", - ) - - # Make the request - client.archive_custom_metric(request=request) + r"""Archives an Audience on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.ArchiveCustomMetricRequest, dict]): - The request object. Request message for - ArchiveCustomMetric RPC. - name (str): - Required. The name of the - CustomMetric to archive. Example format: - properties/1234/customMetrics/5678 - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + request (Union[google.analytics.admin_v1alpha.types.ArchiveAudienceRequest, dict]): + The request object. Request message for ArchiveAudience + RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -8434,29 +7038,16 @@ def sample_archive_custom_metric(): sent along with the request as metadata. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - 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 analytics_admin.ArchiveCustomMetricRequest. + # in a analytics_admin.ArchiveAudienceRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ArchiveCustomMetricRequest): - request = analytics_admin.ArchiveCustomMetricRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name + if not isinstance(request, analytics_admin.ArchiveAudienceRequest): + request = analytics_admin.ArchiveAudienceRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.archive_custom_metric] + rpc = self._transport._wrapped_methods[self._transport.archive_audience] # Certain fields should be provided within the metadata header; # add these here. @@ -8472,51 +7063,27 @@ def sample_archive_custom_metric(): metadata=metadata, ) - def get_custom_metric( + def get_search_ads360_link( self, - request: Optional[Union[analytics_admin.GetCustomMetricRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.GetSearchAds360LinkRequest, dict] + ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomMetric: - r"""Lookup for a single CustomMetric. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetCustomMetricRequest( - name="name_value", - ) - - # Make the request - response = client.get_custom_metric(request=request) - - # Handle the response - print(response) + ) -> resources.SearchAds360Link: + r"""Look up a single SearchAds360Link Args: - request (Union[google.analytics.admin_v1alpha.types.GetCustomMetricRequest, dict]): - The request object. Request message for GetCustomMetric - RPC. + request (Union[google.analytics.admin_v1alpha.types.GetSearchAds360LinkRequest, dict]): + The request object. Request message for + GetSearchAds360Link RPC. name (str): Required. The name of the - CustomMetric to get. Example format: - properties/1234/customMetrics/5678 + SearchAds360Link to get. Example format: + properties/1234/SearchAds360Link/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -8528,8 +7095,10 @@ def sample_get_custom_metric(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomMetric: - A definition for a custom metric. + google.analytics.admin_v1alpha.types.SearchAds360Link: + A link between a GA4 property and a + Search Ads 360 entity. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -8542,11 +7111,11 @@ def sample_get_custom_metric(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetCustomMetricRequest. + # in a analytics_admin.GetSearchAds360LinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetCustomMetricRequest): - request = analytics_admin.GetCustomMetricRequest(request) + if not isinstance(request, analytics_admin.GetSearchAds360LinkRequest): + request = analytics_admin.GetSearchAds360LinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -8554,7 +7123,7 @@ def sample_get_custom_metric(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_custom_metric] + rpc = self._transport._wrapped_methods[self._transport.get_search_ads360_link] # Certain fields should be provided within the metadata header; # add these here. @@ -8573,59 +7142,28 @@ def sample_get_custom_metric(): # Done; return the response. return response - def get_data_retention_settings( + def list_search_ads360_links( self, request: Optional[ - Union[analytics_admin.GetDataRetentionSettingsRequest, dict] + Union[analytics_admin.ListSearchAds360LinksRequest, dict] ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DataRetentionSettings: - r"""Returns the singleton data retention settings for - this property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_data_retention_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDataRetentionSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.get_data_retention_settings(request=request) - - # Handle the response - print(response) + ) -> pagers.ListSearchAds360LinksPager: + r"""Lists all SearchAds360Links on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.GetDataRetentionSettingsRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ListSearchAds360LinksRequest, dict]): The request object. Request message for - GetDataRetentionSettings RPC. - name (str): - Required. The name of the settings to - lookup. Format: - - properties/{property}/dataRetentionSettings - Example: - "properties/1000/dataRetentionSettings" + ListSearchAds360Links RPC. + parent (str): + Required. Example format: + properties/1234 - This corresponds to the ``name`` field + This corresponds to the ``parent`` 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, @@ -8635,15 +7173,18 @@ def sample_get_data_retention_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DataRetentionSettings: - Settings values for data retention. - This is a singleton resource. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSearchAds360LinksPager: + Response message for + ListSearchAds360Links RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -8651,26 +7192,24 @@ def sample_get_data_retention_settings(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetDataRetentionSettingsRequest. + # in a analytics_admin.ListSearchAds360LinksRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetDataRetentionSettingsRequest): - request = analytics_admin.GetDataRetentionSettingsRequest(request) + if not isinstance(request, analytics_admin.ListSearchAds360LinksRequest): + request = analytics_admin.ListSearchAds360LinksRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_data_retention_settings - ] + rpc = self._transport._wrapped_methods[self._transport.list_search_ads360_links] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -8681,68 +7220,48 @@ def sample_get_data_retention_settings(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListSearchAds360LinksPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - def update_data_retention_settings( + def create_search_ads360_link( self, request: Optional[ - Union[analytics_admin.UpdateDataRetentionSettingsRequest, dict] + Union[analytics_admin.CreateSearchAds360LinkRequest, dict] ] = None, *, - data_retention_settings: Optional[resources.DataRetentionSettings] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, + search_ads_360_link: Optional[resources.SearchAds360Link] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DataRetentionSettings: - r"""Updates the singleton data retention settings for - this property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_data_retention_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateDataRetentionSettingsRequest( - ) - - # Make the request - response = client.update_data_retention_settings(request=request) - - # Handle the response - print(response) + ) -> resources.SearchAds360Link: + r"""Creates a SearchAds360Link. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateDataRetentionSettingsRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.CreateSearchAds360LinkRequest, dict]): The request object. Request message for - UpdateDataRetentionSettings RPC. - data_retention_settings (google.analytics.admin_v1alpha.types.DataRetentionSettings): - Required. The settings to update. The ``name`` field is - used to identify the settings to be updated. + CreateSearchAds360Link RPC. + parent (str): + Required. Example format: + properties/1234 - This corresponds to the ``data_retention_settings`` field + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + search_ads_360_link (google.analytics.admin_v1alpha.types.SearchAds360Link): + Required. The SearchAds360Link to + create. - This corresponds to the ``update_mask`` field + This corresponds to the ``search_ads_360_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, @@ -8752,15 +7271,15 @@ def sample_update_data_retention_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DataRetentionSettings: - Settings values for data retention. - This is a singleton resource. + google.analytics.admin_v1alpha.types.SearchAds360Link: + A link between a GA4 property and a + Search Ads 360 entity. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([data_retention_settings, update_mask]) + has_flattened_params = any([parent, search_ads_360_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -8768,35 +7287,28 @@ def sample_update_data_retention_settings(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateDataRetentionSettingsRequest. + # in a analytics_admin.CreateSearchAds360LinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateDataRetentionSettingsRequest): - request = analytics_admin.UpdateDataRetentionSettingsRequest(request) + if not isinstance(request, analytics_admin.CreateSearchAds360LinkRequest): + request = analytics_admin.CreateSearchAds360LinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if data_retention_settings is not None: - request.data_retention_settings = data_retention_settings - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent + if search_ads_360_link is not None: + request.search_ads_360_link = search_ads_360_link # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.update_data_retention_settings + self._transport.create_search_ads360_link ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "data_retention_settings.name", - request.data_retention_settings.name, - ), - ) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -8810,62 +7322,109 @@ def sample_update_data_retention_settings(): # Done; return the response. return response - def create_data_stream( + def delete_search_ads360_link( self, - request: Optional[Union[analytics_admin.CreateDataStreamRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.DeleteSearchAds360LinkRequest, dict] + ] = None, *, - parent: Optional[str] = None, - data_stream: Optional[resources.DataStream] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DataStream: - r"""Creates a DataStream. + ) -> None: + r"""Deletes a SearchAds360Link on a property. - .. code-block:: python + Args: + request (Union[google.analytics.admin_v1alpha.types.DeleteSearchAds360LinkRequest, dict]): + The request object. Request message for + DeleteSearchAds360Link RPC. + name (str): + Required. The name of the + SearchAds360Link to delete. Example + format: + properties/1234/SearchAds360Links/5678 - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha + This corresponds to the ``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. + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) - def sample_create_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.DeleteSearchAds360LinkRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.DeleteSearchAds360LinkRequest): + request = analytics_admin.DeleteSearchAds360LinkRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name - # Initialize request argument(s) - data_stream = admin_v1alpha.DataStream() - data_stream.type_ = "IOS_APP_DATA_STREAM" + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.delete_search_ads360_link + ] - request = admin_v1alpha.CreateDataStreamRequest( - parent="parent_value", - data_stream=data_stream, - ) + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) - # Make the request - response = client.create_data_stream(request=request) + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) - # Handle the response - print(response) + def update_search_ads360_link( + self, + request: Optional[ + Union[analytics_admin.UpdateSearchAds360LinkRequest, dict] + ] = None, + *, + search_ads_360_link: Optional[resources.SearchAds360Link] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.SearchAds360Link: + r"""Updates a SearchAds360Link on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateDataStreamRequest, dict]): - The request object. Request message for CreateDataStream - RPC. - parent (str): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field + request (Union[google.analytics.admin_v1alpha.types.UpdateSearchAds360LinkRequest, dict]): + The request object. Request message for + UpdateSearchAds360Link RPC. + search_ads_360_link (google.analytics.admin_v1alpha.types.SearchAds360Link): + The SearchAds360Link to update + This corresponds to the ``search_ads_360_link`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - data_stream (google.analytics.admin_v1alpha.types.DataStream): - Required. The DataStream to create. - This corresponds to the ``data_stream`` field + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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, @@ -8875,15 +7434,15 @@ def sample_create_data_stream(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DataStream: - A resource message representing a - data stream. + google.analytics.admin_v1alpha.types.SearchAds360Link: + A link between a GA4 property and a + Search Ads 360 entity. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, data_stream]) + has_flattened_params = any([search_ads_360_link, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -8891,26 +7450,30 @@ def sample_create_data_stream(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateDataStreamRequest. + # in a analytics_admin.UpdateSearchAds360LinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateDataStreamRequest): - request = analytics_admin.CreateDataStreamRequest(request) + if not isinstance(request, analytics_admin.UpdateSearchAds360LinkRequest): + request = analytics_admin.UpdateSearchAds360LinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if data_stream is not None: - request.data_stream = data_stream + if search_ads_360_link is not None: + request.search_ads_360_link = search_ads_360_link + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_data_stream] + rpc = self._transport._wrapped_methods[ + self._transport.update_search_ads360_link + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata( + (("search_ads_360_link.name", request.search_ads_360_link.name),) + ), ) # Send the request. @@ -8924,48 +7487,27 @@ def sample_create_data_stream(): # Done; return the response. return response - def delete_data_stream( + def get_attribution_settings( self, - request: Optional[Union[analytics_admin.DeleteDataStreamRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.GetAttributionSettingsRequest, dict] + ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a DataStream on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteDataStreamRequest( - name="name_value", - ) - - # Make the request - client.delete_data_stream(request=request) + ) -> resources.AttributionSettings: + r"""Lookup for a AttributionSettings singleton. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteDataStreamRequest, dict]): - The request object. Request message for DeleteDataStream - RPC. + request (Union[google.analytics.admin_v1alpha.types.GetAttributionSettingsRequest, dict]): + The request object. Request message for + GetAttributionSettings RPC. name (str): - Required. The name of the DataStream - to delete. Example format: - properties/1234/dataStreams/5678 + Required. The name of the attribution + settings to retrieve. Format: + properties/{property}/attributionSettings This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -8975,6 +7517,13 @@ def sample_delete_data_stream(): 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.analytics.admin_v1alpha.types.AttributionSettings: + The attribution settings used for a + given property. This is a singleton + resource. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -8987,11 +7536,11 @@ def sample_delete_data_stream(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteDataStreamRequest. + # in a analytics_admin.GetAttributionSettingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.DeleteDataStreamRequest): - request = analytics_admin.DeleteDataStreamRequest(request) + if not isinstance(request, analytics_admin.GetAttributionSettingsRequest): + request = analytics_admin.GetAttributionSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -8999,7 +7548,7 @@ def sample_delete_data_stream(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_data_stream] + rpc = self._transport._wrapped_methods[self._transport.get_attribution_settings] # Certain fields should be provided within the metadata header; # add these here. @@ -9008,61 +7557,45 @@ def sample_delete_data_stream(): ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def update_data_stream( + # Done; return the response. + return response + + def update_attribution_settings( self, - request: Optional[Union[analytics_admin.UpdateDataStreamRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.UpdateAttributionSettingsRequest, dict] + ] = None, *, - data_stream: Optional[resources.DataStream] = None, + attribution_settings: Optional[resources.AttributionSettings] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DataStream: - r"""Updates a DataStream on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateDataStreamRequest( - ) - - # Make the request - response = client.update_data_stream(request=request) - - # Handle the response - print(response) + ) -> resources.AttributionSettings: + r"""Updates attribution settings on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateDataStreamRequest, dict]): - The request object. Request message for UpdateDataStream - RPC. - data_stream (google.analytics.admin_v1alpha.types.DataStream): - The DataStream to update - This corresponds to the ``data_stream`` field + request (Union[google.analytics.admin_v1alpha.types.UpdateAttributionSettingsRequest, dict]): + The request object. Request message for + UpdateAttributionSettings RPC + attribution_settings (google.analytics.admin_v1alpha.types.AttributionSettings): + Required. The attribution settings to update. The + ``name`` field is used to identify the settings to be + updated. + + This corresponds to the ``attribution_settings`` field on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Omitted + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted fields will not be updated. To replace the entire entity, use one path with the string "*" to match all fields. @@ -9077,15 +7610,16 @@ def sample_update_data_stream(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DataStream: - A resource message representing a - data stream. + google.analytics.admin_v1alpha.types.AttributionSettings: + The attribution settings used for a + given property. This is a singleton + resource. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([data_stream, update_mask]) + has_flattened_params = any([attribution_settings, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -9093,27 +7627,29 @@ def sample_update_data_stream(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateDataStreamRequest. + # in a analytics_admin.UpdateAttributionSettingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateDataStreamRequest): - request = analytics_admin.UpdateDataStreamRequest(request) + if not isinstance(request, analytics_admin.UpdateAttributionSettingsRequest): + request = analytics_admin.UpdateAttributionSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if data_stream is not None: - request.data_stream = data_stream + if attribution_settings is not None: + request.attribution_settings = attribution_settings if update_mask is not None: request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_data_stream] + rpc = self._transport._wrapped_methods[ + self._transport.update_attribution_settings + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata( - (("data_stream.name", request.data_stream.name),) + (("attribution_settings.name", request.attribution_settings.name),) ), ) @@ -9128,55 +7664,34 @@ def sample_update_data_stream(): # Done; return the response. return response - def list_data_streams( + def run_access_report( self, - request: Optional[Union[analytics_admin.ListDataStreamsRequest, dict]] = None, + request: Optional[Union[analytics_admin.RunAccessReportRequest, dict]] = None, *, - parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListDataStreamsPager: - r"""Lists DataStreams on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_data_streams(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListDataStreamsRequest( - parent="parent_value", - ) + ) -> analytics_admin.RunAccessReportResponse: + r"""Returns a customized report of data access records. The report + provides records of each time a user reads Google Analytics + reporting data. Access records are retained for up to 2 years. - # Make the request - page_result = client.list_data_streams(request=request) + Data Access Reports can be requested for a property. The + property must be in Google Analytics 360. This method is only + available to Administrators. - # Handle the response - for response in page_result: - print(response) + These data access records include GA4 UI Reporting, GA4 UI + Explorations, GA4 Data API, and other products like Firebase & + Admob that can retrieve data from Google Analytics through a + linkage. These records don't include property configuration + changes like adding a stream or changing a property's time zone. + For configuration change history, see + `searchChangeHistoryEvents `__. Args: - request (Union[google.analytics.admin_v1alpha.types.ListDataStreamsRequest, dict]): - The request object. Request message for ListDataStreams - RPC. - parent (str): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + request (Union[google.analytics.admin_v1alpha.types.RunAccessReportRequest, dict]): + The request object. The request for a Data Access Record + Report. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -9184,43 +7699,27 @@ def sample_list_data_streams(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDataStreamsPager: - Response message for ListDataStreams - RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.RunAccessReportResponse: + The customized Data Access Record + Report response. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - 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 analytics_admin.ListDataStreamsRequest. + # in a analytics_admin.RunAccessReportRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListDataStreamsRequest): - request = analytics_admin.ListDataStreamsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent + if not isinstance(request, analytics_admin.RunAccessReportRequest): + request = analytics_admin.RunAccessReportRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_data_streams] + rpc = self._transport._wrapped_methods[self._transport.run_access_report] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("entity", request.entity),)), ) # Send the request. @@ -9231,65 +7730,41 @@ def sample_list_data_streams(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListDataStreamsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - def get_data_stream( + def create_access_binding( self, - request: Optional[Union[analytics_admin.GetDataStreamRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.CreateAccessBindingRequest, dict] + ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, + access_binding: Optional[resources.AccessBinding] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DataStream: - r"""Lookup for a single DataStream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDataStreamRequest( - name="name_value", - ) + ) -> resources.AccessBinding: + r"""Creates an access binding on an account or property. - # Make the request - response = client.get_data_stream(request=request) + Args: + request (Union[google.analytics.admin_v1alpha.types.CreateAccessBindingRequest, dict]): + The request object. Request message for + CreateAccessBinding RPC. + parent (str): + Required. Formats: - # Handle the response - print(response) + - accounts/{account} + - properties/{property} - Args: - request (Union[google.analytics.admin_v1alpha.types.GetDataStreamRequest, dict]): - The request object. Request message for GetDataStream - RPC. - name (str): - Required. The name of the DataStream - to get. Example format: - properties/1234/dataStreams/5678 + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + access_binding (google.analytics.admin_v1alpha.types.AccessBinding): + Required. The access binding to + create. - This corresponds to the ``name`` field + This corresponds to the ``access_binding`` 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, @@ -9299,15 +7774,15 @@ def sample_get_data_stream(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.DataStream: - A resource message representing a - data stream. + google.analytics.admin_v1alpha.types.AccessBinding: + A binding of a user to a set of + roles. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent, access_binding]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -9315,24 +7790,26 @@ def sample_get_data_stream(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetDataStreamRequest. + # in a analytics_admin.CreateAccessBindingRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetDataStreamRequest): - request = analytics_admin.GetDataStreamRequest(request) + if not isinstance(request, analytics_admin.CreateAccessBindingRequest): + request = analytics_admin.CreateAccessBindingRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent + if access_binding is not None: + request.access_binding = access_binding # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_data_stream] + rpc = self._transport._wrapped_methods[self._transport.create_access_binding] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -9346,52 +7823,29 @@ def sample_get_data_stream(): # Done; return the response. return response - def get_audience( + def get_access_binding( self, - request: Optional[Union[analytics_admin.GetAudienceRequest, dict]] = None, + request: Optional[Union[analytics_admin.GetAccessBindingRequest, dict]] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> audience.Audience: - r"""Lookup for a single Audience. - Audiences created before 2020 may not be supported. - Default audiences will not show filter definitions. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAudienceRequest( - name="name_value", - ) - - # Make the request - response = client.get_audience(request=request) - - # Handle the response - print(response) + ) -> resources.AccessBinding: + r"""Gets information about an access binding. Args: - request (Union[google.analytics.admin_v1alpha.types.GetAudienceRequest, dict]): - The request object. Request message for GetAudience RPC. + request (Union[google.analytics.admin_v1alpha.types.GetAccessBindingRequest, dict]): + The request object. Request message for GetAccessBinding + RPC. name (str): - Required. The name of the Audience to - get. Example format: - properties/1234/audiences/5678 + Required. The name of the access + binding to retrieve. Formats: + + - + accounts/{account}/accessBindings/{accessBinding} + - + properties/{property}/accessBindings/{accessBinding} This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -9403,9 +7857,9 @@ def sample_get_audience(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.Audience: - A resource message representing a GA4 - Audience. + google.analytics.admin_v1alpha.types.AccessBinding: + A binding of a user to a set of + roles. """ # Create or coerce a protobuf request object. @@ -9419,11 +7873,11 @@ def sample_get_audience(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetAudienceRequest. + # in a analytics_admin.GetAccessBindingRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetAudienceRequest): - request = analytics_admin.GetAudienceRequest(request) + if not isinstance(request, analytics_admin.GetAccessBindingRequest): + request = analytics_admin.GetAccessBindingRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -9431,7 +7885,7 @@ def sample_get_audience(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_audience] + rpc = self._transport._wrapped_methods[self._transport.get_access_binding] # Certain fields should be provided within the metadata header; # add these here. @@ -9450,55 +7904,28 @@ def sample_get_audience(): # Done; return the response. return response - def list_audiences( + def update_access_binding( self, - request: Optional[Union[analytics_admin.ListAudiencesRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.UpdateAccessBindingRequest, dict] + ] = None, *, - parent: Optional[str] = None, + access_binding: Optional[resources.AccessBinding] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListAudiencesPager: - r"""Lists Audiences on a property. - Audiences created before 2020 may not be supported. - Default audiences will not show filter definitions. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_audiences(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAudiencesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_audiences(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> resources.AccessBinding: + r"""Updates an access binding on an account or property. Args: - request (Union[google.analytics.admin_v1alpha.types.ListAudiencesRequest, dict]): - The request object. Request message for ListAudiences - RPC. - parent (str): - Required. Example format: - properties/1234 + request (Union[google.analytics.admin_v1alpha.types.UpdateAccessBindingRequest, dict]): + The request object. Request message for + UpdateAccessBinding RPC. + access_binding (google.analytics.admin_v1alpha.types.AccessBinding): + Required. The access binding to + update. - This corresponds to the ``parent`` field + This corresponds to the ``access_binding`` 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, @@ -9508,18 +7935,15 @@ def sample_list_audiences(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAudiencesPager: - Response message for ListAudiences - RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.AccessBinding: + A binding of a user to a set of + roles. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([access_binding]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -9527,24 +7951,26 @@ def sample_list_audiences(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListAudiencesRequest. + # in a analytics_admin.UpdateAccessBindingRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListAudiencesRequest): - request = analytics_admin.ListAudiencesRequest(request) + if not isinstance(request, analytics_admin.UpdateAccessBindingRequest): + request = analytics_admin.UpdateAccessBindingRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if access_binding is not None: + request.access_binding = access_binding # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_audiences] + rpc = self._transport._wrapped_methods[self._transport.update_access_binding] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata( + (("access_binding.name", request.access_binding.name),) + ), ) # Send the request. @@ -9555,78 +7981,35 @@ def sample_list_audiences(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListAudiencesPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - def create_audience( + def delete_access_binding( self, - request: Optional[Union[analytics_admin.CreateAudienceRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.DeleteAccessBindingRequest, dict] + ] = None, *, - parent: Optional[str] = None, - audience: Optional[gaa_audience.Audience] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> gaa_audience.Audience: - r"""Creates an Audience. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - audience = admin_v1alpha.Audience() - audience.display_name = "display_name_value" - audience.description = "description_value" - audience.membership_duration_days = 2561 - audience.filter_clauses.simple_filter.scope = "AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS" - audience.filter_clauses.clause_type = "EXCLUDE" - - request = admin_v1alpha.CreateAudienceRequest( - parent="parent_value", - audience=audience, - ) - - # Make the request - response = client.create_audience(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes an access binding on an account or property. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateAudienceRequest, dict]): - The request object. Request message for CreateAudience - RPC. - parent (str): - Required. Example format: - properties/1234 + request (Union[google.analytics.admin_v1alpha.types.DeleteAccessBindingRequest, dict]): + The request object. Request message for + DeleteAccessBinding RPC. + name (str): + Required. Formats: - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - audience (google.analytics.admin_v1alpha.types.Audience): - Required. The audience to create. - This corresponds to the ``audience`` field + - + accounts/{account}/accessBindings/{accessBinding} + - + properties/{property}/accessBindings/{accessBinding} + + This corresponds to the ``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, @@ -9634,17 +8017,11 @@ def sample_create_audience(): 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.analytics.admin_v1alpha.types.Audience: - A resource message representing a GA4 - Audience. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, audience]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -9652,104 +8029,58 @@ def sample_create_audience(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateAudienceRequest. + # in a analytics_admin.DeleteAccessBindingRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateAudienceRequest): - request = analytics_admin.CreateAudienceRequest(request) + if not isinstance(request, analytics_admin.DeleteAccessBindingRequest): + request = analytics_admin.DeleteAccessBindingRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if audience is not None: - request.audience = audience + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_audience] + rpc = self._transport._wrapped_methods[self._transport.delete_access_binding] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = rpc( + rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - def update_audience( + def list_access_bindings( self, - request: Optional[Union[analytics_admin.UpdateAudienceRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.ListAccessBindingsRequest, dict] + ] = None, *, - audience: Optional[gaa_audience.Audience] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> gaa_audience.Audience: - r"""Updates an Audience on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - audience = admin_v1alpha.Audience() - audience.display_name = "display_name_value" - audience.description = "description_value" - audience.membership_duration_days = 2561 - audience.filter_clauses.simple_filter.scope = "AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS" - audience.filter_clauses.clause_type = "EXCLUDE" - - request = admin_v1alpha.UpdateAudienceRequest( - audience=audience, - ) - - # Make the request - response = client.update_audience(request=request) - - # Handle the response - print(response) + ) -> pagers.ListAccessBindingsPager: + r"""Lists all access bindings on an account or property. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateAudienceRequest, dict]): - The request object. Request message for UpdateAudience - RPC. - audience (google.analytics.admin_v1alpha.types.Audience): - Required. The audience to update. The audience's - ``name`` field is used to identify the audience to be - updated. + request (Union[google.analytics.admin_v1alpha.types.ListAccessBindingsRequest, dict]): + The request object. Request message for + ListAccessBindings RPC. + parent (str): + Required. Formats: - This corresponds to the ``audience`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + - accounts/{account} + - properties/{property} - This corresponds to the ``update_mask`` field + This corresponds to the ``parent`` 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, @@ -9759,15 +8090,18 @@ def sample_update_audience(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.Audience: - A resource message representing a GA4 - Audience. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccessBindingsPager: + Response message for + ListAccessBindings RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([audience, update_mask]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -9775,28 +8109,24 @@ def sample_update_audience(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateAudienceRequest. + # in a analytics_admin.ListAccessBindingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateAudienceRequest): - request = analytics_admin.UpdateAudienceRequest(request) + if not isinstance(request, analytics_admin.ListAccessBindingsRequest): + request = analytics_admin.ListAccessBindingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if audience is not None: - request.audience = audience - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_audience] + rpc = self._transport._wrapped_methods[self._transport.list_access_bindings] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("audience.name", request.audience.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -9807,129 +8137,99 @@ def sample_update_audience(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListAccessBindingsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - def archive_audience( + def batch_create_access_bindings( self, - request: Optional[Union[analytics_admin.ArchiveAudienceRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.BatchCreateAccessBindingsRequest, dict] + ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Archives an Audience on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_archive_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ArchiveAudienceRequest( - name="name_value", - ) + ) -> analytics_admin.BatchCreateAccessBindingsResponse: + r"""Creates information about multiple access bindings to + an account or property. - # Make the request - client.archive_audience(request=request) + This method is transactional. If any AccessBinding + cannot be created, none of the AccessBindings will be + created. Args: - request (Union[google.analytics.admin_v1alpha.types.ArchiveAudienceRequest, dict]): - The request object. Request message for ArchiveAudience - RPC. + request (Union[google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsRequest, dict]): + The request object. Request message for + BatchCreateAccessBindings RPC. 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.analytics.admin_v1alpha.types.BatchCreateAccessBindingsResponse: + Response message for + BatchCreateAccessBindings RPC. + """ # Create or coerce a protobuf request object. # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ArchiveAudienceRequest. + # in a analytics_admin.BatchCreateAccessBindingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ArchiveAudienceRequest): - request = analytics_admin.ArchiveAudienceRequest(request) + if not isinstance(request, analytics_admin.BatchCreateAccessBindingsRequest): + request = analytics_admin.BatchCreateAccessBindingsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.archive_audience] + rpc = self._transport._wrapped_methods[ + self._transport.batch_create_access_bindings + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def get_search_ads360_link( + # Done; return the response. + return response + + def batch_get_access_bindings( self, request: Optional[ - Union[analytics_admin.GetSearchAds360LinkRequest, dict] + Union[analytics_admin.BatchGetAccessBindingsRequest, dict] ] = None, *, - name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SearchAds360Link: - r"""Look up a single SearchAds360Link - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetSearchAds360LinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_search_ads360_link(request=request) - - # Handle the response - print(response) + ) -> analytics_admin.BatchGetAccessBindingsResponse: + r"""Gets information about multiple access bindings to an + account or property. Args: - request (Union[google.analytics.admin_v1alpha.types.GetSearchAds360LinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.BatchGetAccessBindingsRequest, dict]): The request object. Request message for - GetSearchAds360Link RPC. - name (str): - Required. The name of the - SearchAds360Link to get. Example format: - properties/1234/SearchAds360Link/5678 - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + BatchGetAccessBindings RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -9937,40 +8237,29 @@ def sample_get_search_ads360_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.SearchAds360Link: - A link between a GA4 property and a - Search Ads 360 entity. + google.analytics.admin_v1alpha.types.BatchGetAccessBindingsResponse: + Response message for + BatchGetAccessBindings RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - 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 analytics_admin.GetSearchAds360LinkRequest. + # in a analytics_admin.BatchGetAccessBindingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetSearchAds360LinkRequest): - request = analytics_admin.GetSearchAds360LinkRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name + if not isinstance(request, analytics_admin.BatchGetAccessBindingsRequest): + request = analytics_admin.BatchGetAccessBindingsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_search_ads360_link] + rpc = self._transport._wrapped_methods[ + self._transport.batch_get_access_bindings + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -9984,57 +8273,23 @@ def sample_get_search_ads360_link(): # Done; return the response. return response - def list_search_ads360_links( + def batch_update_access_bindings( self, request: Optional[ - Union[analytics_admin.ListSearchAds360LinksRequest, dict] + Union[analytics_admin.BatchUpdateAccessBindingsRequest, dict] ] = None, *, - parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListSearchAds360LinksPager: - r"""Lists all SearchAds360Links on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_search_ads360_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListSearchAds360LinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_search_ads360_links(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> analytics_admin.BatchUpdateAccessBindingsResponse: + r"""Updates information about multiple access bindings to + an account or property. Args: - request (Union[google.analytics.admin_v1alpha.types.ListSearchAds360LinksRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsRequest, dict]): The request object. Request message for - ListSearchAds360Links RPC. - parent (str): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + BatchUpdateAccessBindings RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -10042,38 +8297,24 @@ def sample_list_search_ads360_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSearchAds360LinksPager: + google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsResponse: Response message for - ListSearchAds360Links RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + BatchUpdateAccessBindings RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - 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 analytics_admin.ListSearchAds360LinksRequest. + # in a analytics_admin.BatchUpdateAccessBindingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListSearchAds360LinksRequest): - request = analytics_admin.ListSearchAds360LinksRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent + if not isinstance(request, analytics_admin.BatchUpdateAccessBindingsRequest): + request = analytics_admin.BatchUpdateAccessBindingsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_search_ads360_links] + rpc = self._transport._wrapped_methods[ + self._transport.batch_update_access_bindings + ] # Certain fields should be provided within the metadata header; # add these here. @@ -10089,115 +8330,44 @@ def sample_list_search_ads360_links(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListSearchAds360LinksPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - def create_search_ads360_link( + def batch_delete_access_bindings( self, request: Optional[ - Union[analytics_admin.CreateSearchAds360LinkRequest, dict] + Union[analytics_admin.BatchDeleteAccessBindingsRequest, dict] ] = None, *, - parent: Optional[str] = None, - search_ads_360_link: Optional[resources.SearchAds360Link] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SearchAds360Link: - r"""Creates a SearchAds360Link. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateSearchAds360LinkRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_search_ads360_link(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes information about multiple users' links to an + account or property. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateSearchAds360LinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.BatchDeleteAccessBindingsRequest, dict]): The request object. Request message for - CreateSearchAds360Link RPC. - parent (str): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - search_ads_360_link (google.analytics.admin_v1alpha.types.SearchAds360Link): - Required. The SearchAds360Link to - create. - - This corresponds to the ``search_ads_360_link`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + BatchDeleteAccessBindings RPC. 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.analytics.admin_v1alpha.types.SearchAds360Link: - A link between a GA4 property and a - Search Ads 360 entity. - """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, search_ads_360_link]) - if request is not None and has_flattened_params: - 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 analytics_admin.CreateSearchAds360LinkRequest. + # in a analytics_admin.BatchDeleteAccessBindingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateSearchAds360LinkRequest): - request = analytics_admin.CreateSearchAds360LinkRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if search_ads_360_link is not None: - request.search_ads_360_link = search_ads_360_link + if not isinstance(request, analytics_admin.BatchDeleteAccessBindingsRequest): + request = analytics_admin.BatchDeleteAccessBindingsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.create_search_ads360_link + self._transport.batch_delete_access_bindings ] # Certain fields should be provided within the metadata header; @@ -10207,61 +8377,34 @@ def sample_create_search_ads360_link(): ) # Send the request. - response = rpc( + rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - def delete_search_ads360_link( + def get_expanded_data_set( self, request: Optional[ - Union[analytics_admin.DeleteSearchAds360LinkRequest, dict] + Union[analytics_admin.GetExpandedDataSetRequest, dict] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a SearchAds360Link on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteSearchAds360LinkRequest( - name="name_value", - ) - - # Make the request - client.delete_search_ads360_link(request=request) + ) -> expanded_data_set.ExpandedDataSet: + r"""Lookup for a single ExpandedDataSet. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteSearchAds360LinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.GetExpandedDataSetRequest, dict]): The request object. Request message for - DeleteSearchAds360Link RPC. + GetExpandedDataSet RPC. name (str): Required. The name of the - SearchAds360Link to delete. Example - format: - properties/1234/SearchAds360Links/5678 + ExpandedDataSet to get. Example format: + properties/1234/expandedDataSets/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -10271,6 +8414,12 @@ def sample_delete_search_ads360_link(): 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.analytics.admin_v1alpha.types.ExpandedDataSet: + A resource message representing a GA4 + ExpandedDataSet. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -10283,11 +8432,11 @@ def sample_delete_search_ads360_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteSearchAds360LinkRequest. + # in a analytics_admin.GetExpandedDataSetRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.DeleteSearchAds360LinkRequest): - request = analytics_admin.DeleteSearchAds360LinkRequest(request) + if not isinstance(request, analytics_admin.GetExpandedDataSetRequest): + request = analytics_admin.GetExpandedDataSetRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -10295,9 +8444,7 @@ def sample_delete_search_ads360_link(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.delete_search_ads360_link - ] + rpc = self._transport._wrapped_methods[self._transport.get_expanded_data_set] # Certain fields should be provided within the metadata header; # add these here. @@ -10306,68 +8453,38 @@ def sample_delete_search_ads360_link(): ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def update_search_ads360_link( + # Done; return the response. + return response + + def list_expanded_data_sets( self, request: Optional[ - Union[analytics_admin.UpdateSearchAds360LinkRequest, dict] + Union[analytics_admin.ListExpandedDataSetsRequest, dict] ] = None, *, - search_ads_360_link: Optional[resources.SearchAds360Link] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SearchAds360Link: - r"""Updates a SearchAds360Link on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateSearchAds360LinkRequest( - ) - - # Make the request - response = client.update_search_ads360_link(request=request) - - # Handle the response - print(response) + ) -> pagers.ListExpandedDataSetsPager: + r"""Lists ExpandedDataSets on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateSearchAds360LinkRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ListExpandedDataSetsRequest, dict]): The request object. Request message for - UpdateSearchAds360Link RPC. - search_ads_360_link (google.analytics.admin_v1alpha.types.SearchAds360Link): - The SearchAds360Link to update - This corresponds to the ``search_ads_360_link`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + ListExpandedDataSets RPC. + parent (str): + Required. Example format: + properties/1234 - This corresponds to the ``update_mask`` field + This corresponds to the ``parent`` 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, @@ -10377,15 +8494,18 @@ def sample_update_search_ads360_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.SearchAds360Link: - A link between a GA4 property and a - Search Ads 360 entity. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListExpandedDataSetsPager: + Response message for + ListExpandedDataSets RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([search_ads_360_link, update_mask]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -10393,30 +8513,24 @@ def sample_update_search_ads360_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateSearchAds360LinkRequest. + # in a analytics_admin.ListExpandedDataSetsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateSearchAds360LinkRequest): - request = analytics_admin.UpdateSearchAds360LinkRequest(request) + if not isinstance(request, analytics_admin.ListExpandedDataSetsRequest): + request = analytics_admin.ListExpandedDataSetsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if search_ads_360_link is not None: - request.search_ads_360_link = search_ads_360_link - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.update_search_ads360_link - ] + rpc = self._transport._wrapped_methods[self._transport.list_expanded_data_sets] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("search_ads_360_link.name", request.search_ads_360_link.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -10427,58 +8541,48 @@ def sample_update_search_ads360_link(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListExpandedDataSetsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - def get_attribution_settings( + def create_expanded_data_set( self, request: Optional[ - Union[analytics_admin.GetAttributionSettingsRequest, dict] + Union[analytics_admin.CreateExpandedDataSetRequest, dict] ] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, + expanded_data_set: Optional[gaa_expanded_data_set.ExpandedDataSet] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AttributionSettings: - r"""Lookup for a AttributionSettings singleton. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_attribution_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAttributionSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.get_attribution_settings(request=request) - - # Handle the response - print(response) + ) -> gaa_expanded_data_set.ExpandedDataSet: + r"""Creates a ExpandedDataSet. Args: - request (Union[google.analytics.admin_v1alpha.types.GetAttributionSettingsRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.CreateExpandedDataSetRequest, dict]): The request object. Request message for - GetAttributionSettings RPC. - name (str): - Required. The name of the attribution - settings to retrieve. Format: - properties/{property}/attributionSettings + CreateExpandedDataSet RPC. + parent (str): + Required. Example format: + properties/1234 - This corresponds to the ``name`` field + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + expanded_data_set (google.analytics.admin_v1alpha.types.ExpandedDataSet): + Required. The ExpandedDataSet to + create. + + This corresponds to the ``expanded_data_set`` 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, @@ -10488,16 +8592,15 @@ def sample_get_attribution_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AttributionSettings: - The attribution settings used for a - given property. This is a singleton - resource. + google.analytics.admin_v1alpha.types.ExpandedDataSet: + A resource message representing a GA4 + ExpandedDataSet. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent, expanded_data_set]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -10505,24 +8608,26 @@ def sample_get_attribution_settings(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetAttributionSettingsRequest. + # in a analytics_admin.CreateExpandedDataSetRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetAttributionSettingsRequest): - request = analytics_admin.GetAttributionSettingsRequest(request) + if not isinstance(request, analytics_admin.CreateExpandedDataSetRequest): + request = analytics_admin.CreateExpandedDataSetRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent + if expanded_data_set is not None: + request.expanded_data_set = expanded_data_set # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_attribution_settings] + rpc = self._transport._wrapped_methods[self._transport.create_expanded_data_set] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -10536,62 +8641,30 @@ def sample_get_attribution_settings(): # Done; return the response. return response - def update_attribution_settings( + def update_expanded_data_set( self, request: Optional[ - Union[analytics_admin.UpdateAttributionSettingsRequest, dict] + Union[analytics_admin.UpdateExpandedDataSetRequest, dict] ] = None, *, - attribution_settings: Optional[resources.AttributionSettings] = None, + expanded_data_set: Optional[gaa_expanded_data_set.ExpandedDataSet] = None, update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AttributionSettings: - r"""Updates attribution settings on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_attribution_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - attribution_settings = admin_v1alpha.AttributionSettings() - attribution_settings.acquisition_conversion_event_lookback_window = "ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS" - attribution_settings.other_conversion_event_lookback_window = "OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_90_DAYS" - attribution_settings.reporting_attribution_model = "GOOGLE_PAID_CHANNELS_LAST_CLICK" - attribution_settings.ads_web_conversion_data_export_scope = "GOOGLE_PAID_CHANNELS" - - request = admin_v1alpha.UpdateAttributionSettingsRequest( - attribution_settings=attribution_settings, - ) - - # Make the request - response = client.update_attribution_settings(request=request) - - # Handle the response - print(response) + ) -> gaa_expanded_data_set.ExpandedDataSet: + r"""Updates a ExpandedDataSet on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateAttributionSettingsRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.UpdateExpandedDataSetRequest, dict]): The request object. Request message for - UpdateAttributionSettings RPC - attribution_settings (google.analytics.admin_v1alpha.types.AttributionSettings): - Required. The attribution settings to update. The - ``name`` field is used to identify the settings to be - updated. + UpdateExpandedDataSet RPC. + expanded_data_set (google.analytics.admin_v1alpha.types.ExpandedDataSet): + Required. The ExpandedDataSet to update. The resource's + ``name`` field is used to identify the ExpandedDataSet + to be updated. - This corresponds to the ``attribution_settings`` field + This corresponds to the ``expanded_data_set`` field on the ``request`` instance; if ``request`` is provided, this should not be set. update_mask (google.protobuf.field_mask_pb2.FieldMask): @@ -10611,16 +8684,15 @@ def sample_update_attribution_settings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AttributionSettings: - The attribution settings used for a - given property. This is a singleton - resource. + google.analytics.admin_v1alpha.types.ExpandedDataSet: + A resource message representing a GA4 + ExpandedDataSet. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([attribution_settings, update_mask]) + has_flattened_params = any([expanded_data_set, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -10628,29 +8700,27 @@ def sample_update_attribution_settings(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateAttributionSettingsRequest. + # in a analytics_admin.UpdateExpandedDataSetRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateAttributionSettingsRequest): - request = analytics_admin.UpdateAttributionSettingsRequest(request) + if not isinstance(request, analytics_admin.UpdateExpandedDataSetRequest): + request = analytics_admin.UpdateExpandedDataSetRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if attribution_settings is not None: - request.attribution_settings = attribution_settings + if expanded_data_set is not None: + request.expanded_data_set = expanded_data_set if update_mask is not None: request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.update_attribution_settings - ] + rpc = self._transport._wrapped_methods[self._transport.update_expanded_data_set] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata( - (("attribution_settings.name", request.attribution_settings.name),) + (("expanded_data_set.name", request.expanded_data_set.name),) ), ) @@ -10665,162 +8735,96 @@ def sample_update_attribution_settings(): # Done; return the response. return response - def run_access_report( + def delete_expanded_data_set( self, - request: Optional[Union[analytics_admin.RunAccessReportRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.DeleteExpandedDataSetRequest, dict] + ] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.RunAccessReportResponse: - r"""Returns a customized report of data access records. The report - provides records of each time a user reads Google Analytics - reporting data. Access records are retained for up to 2 years. - - Data Access Reports can be requested for a property. The - property must be in Google Analytics 360. This method is only - available to Administrators. - - These data access records include GA4 UI Reporting, GA4 UI - Explorations, GA4 Data API, and other products like Firebase & - Admob that can retrieve data from Google Analytics through a - linkage. These records don't include property configuration - changes like adding a stream or changing a property's time zone. - For configuration change history, see - `searchChangeHistoryEvents `__. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_run_access_report(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.RunAccessReportRequest( - ) - - # Make the request - response = client.run_access_report(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a ExpandedDataSet on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.RunAccessReportRequest, dict]): - The request object. The request for a Data Access Record - Report. + request (Union[google.analytics.admin_v1alpha.types.DeleteExpandedDataSetRequest, dict]): + The request object. Request message for + DeleteExpandedDataSet RPC. + name (str): + Required. Example format: + properties/1234/expandedDataSets/5678 + + This corresponds to the ``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.analytics.admin_v1alpha.types.RunAccessReportResponse: - The customized Data Access Record - Report response. - """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + 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 analytics_admin.RunAccessReportRequest. + # in a analytics_admin.DeleteExpandedDataSetRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.RunAccessReportRequest): - request = analytics_admin.RunAccessReportRequest(request) + if not isinstance(request, analytics_admin.DeleteExpandedDataSetRequest): + request = analytics_admin.DeleteExpandedDataSetRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.run_access_report] + rpc = self._transport._wrapped_methods[self._transport.delete_expanded_data_set] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("entity", request.entity),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = rpc( + rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - def create_access_binding( + def get_channel_group( self, - request: Optional[ - Union[analytics_admin.CreateAccessBindingRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.GetChannelGroupRequest, dict]] = None, *, - parent: Optional[str] = None, - access_binding: Optional[resources.AccessBinding] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AccessBinding: - r"""Creates an access binding on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - access_binding = admin_v1alpha.AccessBinding() - access_binding.user = "user_value" - - request = admin_v1alpha.CreateAccessBindingRequest( - parent="parent_value", - access_binding=access_binding, - ) - - # Make the request - response = client.create_access_binding(request=request) - - # Handle the response - print(response) + ) -> channel_group.ChannelGroup: + r"""Lookup for a single ChannelGroup. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateAccessBindingRequest, dict]): - The request object. Request message for - CreateAccessBinding RPC. - parent (str): - Required. Formats: - - - accounts/{account} - - properties/{property} - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - access_binding (google.analytics.admin_v1alpha.types.AccessBinding): - Required. The access binding to - create. + request (Union[google.analytics.admin_v1alpha.types.GetChannelGroupRequest, dict]): + The request object. Request message for GetChannelGroup + RPC. + name (str): + Required. The ChannelGroup to get. + Example format: + properties/1234/channelGroups/5678 - This corresponds to the ``access_binding`` field + This corresponds to the ``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, @@ -10830,15 +8834,15 @@ def sample_create_access_binding(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AccessBinding: - A binding of a user to a set of - roles. + google.analytics.admin_v1alpha.types.ChannelGroup: + A resource message representing a + Channel Group. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, access_binding]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -10846,26 +8850,24 @@ def sample_create_access_binding(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateAccessBindingRequest. + # in a analytics_admin.GetChannelGroupRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateAccessBindingRequest): - request = analytics_admin.CreateAccessBindingRequest(request) + if not isinstance(request, analytics_admin.GetChannelGroupRequest): + request = analytics_admin.GetChannelGroupRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if access_binding is not None: - request.access_binding = access_binding + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_access_binding] + rpc = self._transport._wrapped_methods[self._transport.get_channel_group] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -10879,57 +8881,27 @@ def sample_create_access_binding(): # Done; return the response. return response - def get_access_binding( + def list_channel_groups( self, - request: Optional[Union[analytics_admin.GetAccessBindingRequest, dict]] = None, + request: Optional[Union[analytics_admin.ListChannelGroupsRequest, dict]] = None, *, - name: Optional[str] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AccessBinding: - r"""Gets information about an access binding. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAccessBindingRequest( - name="name_value", - ) - - # Make the request - response = client.get_access_binding(request=request) - - # Handle the response - print(response) + ) -> pagers.ListChannelGroupsPager: + r"""Lists ChannelGroups on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.GetAccessBindingRequest, dict]): - The request object. Request message for GetAccessBinding + request (Union[google.analytics.admin_v1alpha.types.ListChannelGroupsRequest, dict]): + The request object. Request message for ListChannelGroups RPC. - name (str): - Required. The name of the access - binding to retrieve. Formats: - - - - accounts/{account}/accessBindings/{accessBinding} - - - properties/{property}/accessBindings/{accessBinding} + parent (str): + Required. The property for which to + list ChannelGroups. Example format: + properties/1234 - This corresponds to the ``name`` field + This corresponds to the ``parent`` 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, @@ -10939,15 +8911,18 @@ def sample_get_access_binding(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AccessBinding: - A binding of a user to a set of - roles. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListChannelGroupsPager: + Response message for + ListChannelGroups RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -10955,24 +8930,24 @@ def sample_get_access_binding(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetAccessBindingRequest. + # in a analytics_admin.ListChannelGroupsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetAccessBindingRequest): - request = analytics_admin.GetAccessBindingRequest(request) + if not isinstance(request, analytics_admin.ListChannelGroupsRequest): + request = analytics_admin.ListChannelGroupsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_access_binding] + rpc = self._transport._wrapped_methods[self._transport.list_channel_groups] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -10983,60 +8958,47 @@ def sample_get_access_binding(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListChannelGroupsPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - def update_access_binding( + def create_channel_group( self, request: Optional[ - Union[analytics_admin.UpdateAccessBindingRequest, dict] + Union[analytics_admin.CreateChannelGroupRequest, dict] ] = None, *, - access_binding: Optional[resources.AccessBinding] = None, + parent: Optional[str] = None, + channel_group: Optional[gaa_channel_group.ChannelGroup] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AccessBinding: - r"""Updates an access binding on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - access_binding = admin_v1alpha.AccessBinding() - access_binding.user = "user_value" - - request = admin_v1alpha.UpdateAccessBindingRequest( - access_binding=access_binding, - ) - - # Make the request - response = client.update_access_binding(request=request) - - # Handle the response - print(response) + ) -> gaa_channel_group.ChannelGroup: + r"""Creates a ChannelGroup. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateAccessBindingRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.CreateChannelGroupRequest, dict]): The request object. Request message for - UpdateAccessBinding RPC. - access_binding (google.analytics.admin_v1alpha.types.AccessBinding): - Required. The access binding to - update. + CreateChannelGroup RPC. + parent (str): + Required. The property for which to + create a ChannelGroup. Example format: + properties/1234 - This corresponds to the ``access_binding`` field + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + channel_group (google.analytics.admin_v1alpha.types.ChannelGroup): + Required. The ChannelGroup to create. + This corresponds to the ``channel_group`` 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, @@ -11046,15 +9008,15 @@ def sample_update_access_binding(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AccessBinding: - A binding of a user to a set of - roles. + google.analytics.admin_v1alpha.types.ChannelGroup: + A resource message representing a + Channel Group. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([access_binding]) + has_flattened_params = any([parent, channel_group]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -11062,26 +9024,26 @@ def sample_update_access_binding(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateAccessBindingRequest. + # in a analytics_admin.CreateChannelGroupRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateAccessBindingRequest): - request = analytics_admin.UpdateAccessBindingRequest(request) + if not isinstance(request, analytics_admin.CreateChannelGroupRequest): + request = analytics_admin.CreateChannelGroupRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if access_binding is not None: - request.access_binding = access_binding + if parent is not None: + request.parent = parent + if channel_group is not None: + request.channel_group = channel_group # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_access_binding] + rpc = self._transport._wrapped_methods[self._transport.create_channel_group] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("access_binding.name", request.access_binding.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -11095,55 +9057,40 @@ def sample_update_access_binding(): # Done; return the response. return response - def delete_access_binding( + def update_channel_group( self, request: Optional[ - Union[analytics_admin.DeleteAccessBindingRequest, dict] + Union[analytics_admin.UpdateChannelGroupRequest, dict] ] = None, *, - name: Optional[str] = None, + channel_group: Optional[gaa_channel_group.ChannelGroup] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes an access binding on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteAccessBindingRequest( - name="name_value", - ) - - # Make the request - client.delete_access_binding(request=request) + ) -> gaa_channel_group.ChannelGroup: + r"""Updates a ChannelGroup. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteAccessBindingRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.UpdateChannelGroupRequest, dict]): The request object. Request message for - DeleteAccessBinding RPC. - name (str): - Required. Formats: + UpdateChannelGroup RPC. + channel_group (google.analytics.admin_v1alpha.types.ChannelGroup): + Required. The ChannelGroup to update. The resource's + ``name`` field is used to identify the ChannelGroup to + be updated. - - - accounts/{account}/accessBindings/{accessBinding} - - - properties/{property}/accessBindings/{accessBinding} + This corresponds to the ``channel_group`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. - This corresponds to the ``name`` field + This corresponds to the ``update_mask`` 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, @@ -11151,11 +9098,17 @@ def sample_delete_access_binding(): 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.analytics.admin_v1alpha.types.ChannelGroup: + A resource message representing a + Channel Group. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([channel_group, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -11163,85 +9116,64 @@ def sample_delete_access_binding(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteAccessBindingRequest. + # in a analytics_admin.UpdateChannelGroupRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.DeleteAccessBindingRequest): - request = analytics_admin.DeleteAccessBindingRequest(request) + if not isinstance(request, analytics_admin.UpdateChannelGroupRequest): + request = analytics_admin.UpdateChannelGroupRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if channel_group is not None: + request.channel_group = channel_group + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_access_binding] + rpc = self._transport._wrapped_methods[self._transport.update_channel_group] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + (("channel_group.name", request.channel_group.name),) + ), ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def list_access_bindings( + # Done; return the response. + return response + + def delete_channel_group( self, request: Optional[ - Union[analytics_admin.ListAccessBindingsRequest, dict] + Union[analytics_admin.DeleteChannelGroupRequest, dict] ] = None, *, - parent: Optional[str] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListAccessBindingsPager: - r"""Lists all access bindings on an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAccessBindingsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_access_bindings(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> None: + r"""Deletes a ChannelGroup on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.ListAccessBindingsRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.DeleteChannelGroupRequest, dict]): The request object. Request message for - ListAccessBindings RPC. - parent (str): - Required. Formats: - - - accounts/{account} - - properties/{property} + DeleteChannelGroup RPC. + name (str): + Required. The ChannelGroup to delete. + Example format: + properties/1234/channelGroups/5678 - This corresponds to the ``parent`` field + This corresponds to the ``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, @@ -11249,20 +9181,11 @@ def sample_list_access_bindings(): 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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccessBindingsPager: - Response message for - ListAccessBindings RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -11270,98 +9193,53 @@ def sample_list_access_bindings(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListAccessBindingsRequest. + # in a analytics_admin.DeleteChannelGroupRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListAccessBindingsRequest): - request = analytics_admin.ListAccessBindingsRequest(request) + if not isinstance(request, analytics_admin.DeleteChannelGroupRequest): + request = analytics_admin.DeleteChannelGroupRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_access_bindings] + rpc = self._transport._wrapped_methods[self._transport.delete_channel_group] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = rpc( + 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.ListAccessBindingsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def batch_create_access_bindings( + def set_automated_ga4_configuration_opt_out( self, request: Optional[ - Union[analytics_admin.BatchCreateAccessBindingsRequest, dict] + Union[analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, dict] ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchCreateAccessBindingsResponse: - r"""Creates information about multiple access bindings to - an account or property. - - This method is transactional. If any AccessBinding - cannot be created, none of the AccessBindings will be - created. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_batch_create_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - requests = admin_v1alpha.CreateAccessBindingRequest() - requests.parent = "parent_value" - requests.access_binding.user = "user_value" - - request = admin_v1alpha.BatchCreateAccessBindingsRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - response = client.batch_create_access_bindings(request=request) - - # Handle the response - print(response) + ) -> analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse: + r"""Sets the opt out status for the automated GA4 setup + process for a UA property. + Note: this has no effect on GA4 property. Args: - request (Union[google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsRequest, dict]): - The request object. Request message for - BatchCreateAccessBindings RPC. + request (Union[google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutRequest, dict]): + The request object. Request for setting the opt out + status for the automated GA4 setup + process. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -11369,31 +9247,28 @@ def sample_batch_create_access_bindings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsResponse: - Response message for - BatchCreateAccessBindings RPC. + google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutResponse: + Response message for setting the opt + out status for the automated GA4 setup + process. """ # Create or coerce a protobuf request object. # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.BatchCreateAccessBindingsRequest. + # in a analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.BatchCreateAccessBindingsRequest): - request = analytics_admin.BatchCreateAccessBindingsRequest(request) + if not isinstance( + request, analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest + ): + request = analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.batch_create_access_bindings + self._transport.set_automated_ga4_configuration_opt_out ] - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - # Send the request. response = rpc( request, @@ -11405,50 +9280,25 @@ def sample_batch_create_access_bindings(): # Done; return the response. return response - def batch_get_access_bindings( + def fetch_automated_ga4_configuration_opt_out( self, request: Optional[ - Union[analytics_admin.BatchGetAccessBindingsRequest, dict] + Union[analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, dict] ] = None, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchGetAccessBindingsResponse: - r"""Gets information about multiple access bindings to an - account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_batch_get_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.BatchGetAccessBindingsRequest( - parent="parent_value", - names=['names_value1', 'names_value2'], - ) - - # Make the request - response = client.batch_get_access_bindings(request=request) - - # Handle the response - print(response) + ) -> analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse: + r"""Fetches the opt out status for the automated GA4 + setup process for a UA property. + Note: this has no effect on GA4 property. Args: - request (Union[google.analytics.admin_v1alpha.types.BatchGetAccessBindingsRequest, dict]): - The request object. Request message for - BatchGetAccessBindings RPC. + request (Union[google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutRequest, dict]): + The request object. Request for fetching the opt out + status for the automated GA4 setup + process. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -11456,31 +9306,30 @@ def sample_batch_get_access_bindings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.BatchGetAccessBindingsResponse: - Response message for - BatchGetAccessBindings RPC. + google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutResponse: + Response message for fetching the opt + out status for the automated GA4 setup + process. """ # Create or coerce a protobuf request object. # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.BatchGetAccessBindingsRequest. + # in a analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.BatchGetAccessBindingsRequest): - request = analytics_admin.BatchGetAccessBindingsRequest(request) + if not isinstance( + request, analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest + ): + request = analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest( + request + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = self._transport._wrapped_methods[ - self._transport.batch_get_access_bindings + self._transport.fetch_automated_ga4_configuration_opt_out ] - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - # Send the request. response = rpc( request, @@ -11492,53 +9341,30 @@ def sample_batch_get_access_bindings(): # Done; return the response. return response - def batch_update_access_bindings( + def get_big_query_link( self, - request: Optional[ - Union[analytics_admin.BatchUpdateAccessBindingsRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.GetBigQueryLinkRequest, dict]] = None, *, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchUpdateAccessBindingsResponse: - r"""Updates information about multiple access bindings to - an account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_batch_update_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - requests = admin_v1alpha.UpdateAccessBindingRequest() - requests.access_binding.user = "user_value" - - request = admin_v1alpha.BatchUpdateAccessBindingsRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - response = client.batch_update_access_bindings(request=request) - - # Handle the response - print(response) + ) -> resources.BigQueryLink: + r"""Lookup for a single BigQuery Link. Args: - request (Union[google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsRequest, dict]): - The request object. Request message for - BatchUpdateAccessBindings RPC. + request (Union[google.analytics.admin_v1alpha.types.GetBigQueryLinkRequest, dict]): + The request object. Request message for GetBigQueryLink + RPC. + name (str): + Required. The name of the BigQuery link to lookup. + Format: + properties/{property_id}/bigQueryLinks/{bigquery_link_id} + Example: properties/123/bigQueryLinks/456 + + This corresponds to the ``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. @@ -11546,29 +9372,40 @@ def sample_batch_update_access_bindings(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsResponse: - Response message for - BatchUpdateAccessBindings RPC. + google.analytics.admin_v1alpha.types.BigQueryLink: + A link between a GA4 Property and + BigQuery project. """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + 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 analytics_admin.BatchUpdateAccessBindingsRequest. + # in a analytics_admin.GetBigQueryLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.BatchUpdateAccessBindingsRequest): - request = analytics_admin.BatchUpdateAccessBindingsRequest(request) + if not isinstance(request, analytics_admin.GetBigQueryLinkRequest): + request = analytics_admin.GetBigQueryLinkRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.batch_update_access_bindings - ] + rpc = self._transport._wrapped_methods[self._transport.get_big_query_link] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -11582,69 +9419,68 @@ def sample_batch_update_access_bindings(): # Done; return the response. return response - def batch_delete_access_bindings( + def list_big_query_links( self, - request: Optional[ - Union[analytics_admin.BatchDeleteAccessBindingsRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.ListBigQueryLinksRequest, dict]] = None, *, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes information about multiple users' links to an - account or property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_batch_delete_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - requests = admin_v1alpha.DeleteAccessBindingRequest() - requests.name = "name_value" - - request = admin_v1alpha.BatchDeleteAccessBindingsRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - client.batch_delete_access_bindings(request=request) + ) -> pagers.ListBigQueryLinksPager: + r"""Lists BigQuery Links on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.BatchDeleteAccessBindingsRequest, dict]): - The request object. Request message for - BatchDeleteAccessBindings RPC. + request (Union[google.analytics.admin_v1alpha.types.ListBigQueryLinksRequest, dict]): + The request object. Request message for ListBigQueryLinks + RPC. + parent (str): + Required. The name of the property to list BigQuery + links under. Format: properties/{property_id} Example: + properties/1234 + + This corresponds to the ``parent`` 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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListBigQueryLinksPager: + Response message for + ListBigQueryLinks RPC + Iterating over this object will yield + results and resolve additional pages + automatically. + """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + 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 analytics_admin.BatchDeleteAccessBindingsRequest. + # in a analytics_admin.ListBigQueryLinksRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.BatchDeleteAccessBindingsRequest): - request = analytics_admin.BatchDeleteAccessBindingsRequest(request) + if not isinstance(request, analytics_admin.ListBigQueryLinksRequest): + request = analytics_admin.ListBigQueryLinksRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.batch_delete_access_bindings - ] + rpc = self._transport._wrapped_methods[self._transport.list_big_query_links] # Certain fields should be provided within the metadata header; # add these here. @@ -11653,60 +9489,49 @@ def sample_batch_delete_access_bindings(): ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def get_expanded_data_set( + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListBigQueryLinksPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + + # Done; return the response. + return response + + def get_enhanced_measurement_settings( self, request: Optional[ - Union[analytics_admin.GetExpandedDataSetRequest, dict] + Union[analytics_admin.GetEnhancedMeasurementSettingsRequest, dict] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> expanded_data_set.ExpandedDataSet: - r"""Lookup for a single ExpandedDataSet. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetExpandedDataSetRequest( - name="name_value", - ) - - # Make the request - response = client.get_expanded_data_set(request=request) - - # Handle the response - print(response) + ) -> resources.EnhancedMeasurementSettings: + r"""Returns the enhanced measurement settings for this + data stream. Note that the stream must enable enhanced + measurement for these settings to take effect. Args: - request (Union[google.analytics.admin_v1alpha.types.GetExpandedDataSetRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.GetEnhancedMeasurementSettingsRequest, dict]): The request object. Request message for - GetExpandedDataSet RPC. + GetEnhancedMeasurementSettings RPC. name (str): - Required. The name of the - ExpandedDataSet to get. Example format: - properties/1234/expandedDataSets/5678 + Required. The name of the settings to lookup. Format: + properties/{property}/dataStreams/{data_stream}/enhancedMeasurementSettings + Example: + "properties/1000/dataStreams/2000/enhancedMeasurementSettings" This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -11718,9 +9543,11 @@ def sample_get_expanded_data_set(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ExpandedDataSet: - A resource message representing a GA4 - ExpandedDataSet. + google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings: + Singleton resource under a web + DataStream, configuring measurement of + additional site interactions and + content. """ # Create or coerce a protobuf request object. @@ -11734,11 +9561,13 @@ def sample_get_expanded_data_set(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetExpandedDataSetRequest. + # in a analytics_admin.GetEnhancedMeasurementSettingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetExpandedDataSetRequest): - request = analytics_admin.GetExpandedDataSetRequest(request) + if not isinstance( + request, analytics_admin.GetEnhancedMeasurementSettingsRequest + ): + request = analytics_admin.GetEnhancedMeasurementSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -11746,7 +9575,9 @@ def sample_get_expanded_data_set(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_expanded_data_set] + rpc = self._transport._wrapped_methods[ + self._transport.get_enhanced_measurement_settings + ] # Certain fields should be provided within the metadata header; # add these here. @@ -11765,55 +9596,43 @@ def sample_get_expanded_data_set(): # Done; return the response. return response - def list_expanded_data_sets( + def update_enhanced_measurement_settings( self, request: Optional[ - Union[analytics_admin.ListExpandedDataSetsRequest, dict] + Union[analytics_admin.UpdateEnhancedMeasurementSettingsRequest, dict] ] = None, *, - parent: Optional[str] = None, + enhanced_measurement_settings: Optional[ + resources.EnhancedMeasurementSettings + ] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListExpandedDataSetsPager: - r"""Lists ExpandedDataSets on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_expanded_data_sets(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListExpandedDataSetsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_expanded_data_sets(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> resources.EnhancedMeasurementSettings: + r"""Updates the enhanced measurement settings for this + data stream. Note that the stream must enable enhanced + measurement for these settings to take effect. Args: - request (Union[google.analytics.admin_v1alpha.types.ListExpandedDataSetsRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.UpdateEnhancedMeasurementSettingsRequest, dict]): The request object. Request message for - ListExpandedDataSets RPC. - parent (str): - Required. Example format: - properties/1234 + UpdateEnhancedMeasurementSettings RPC. + enhanced_measurement_settings (google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings): + Required. The settings to update. The ``name`` field is + used to identify the settings to be updated. - This corresponds to the ``parent`` field + This corresponds to the ``enhanced_measurement_settings`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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, @@ -11823,18 +9642,17 @@ def sample_list_expanded_data_sets(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListExpandedDataSetsPager: - Response message for - ListExpandedDataSets RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings: + Singleton resource under a web + DataStream, configuring measurement of + additional site interactions and + content. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([enhanced_measurement_settings, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -11842,24 +9660,37 @@ def sample_list_expanded_data_sets(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListExpandedDataSetsRequest. + # in a analytics_admin.UpdateEnhancedMeasurementSettingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListExpandedDataSetsRequest): - request = analytics_admin.ListExpandedDataSetsRequest(request) + if not isinstance( + request, analytics_admin.UpdateEnhancedMeasurementSettingsRequest + ): + request = analytics_admin.UpdateEnhancedMeasurementSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent + if enhanced_measurement_settings is not None: + request.enhanced_measurement_settings = enhanced_measurement_settings + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_expanded_data_sets] + rpc = self._transport._wrapped_methods[ + self._transport.update_enhanced_measurement_settings + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "enhanced_measurement_settings.name", + request.enhanced_measurement_settings.name, + ), + ) + ), ) # Send the request. @@ -11870,80 +9701,28 @@ def sample_list_expanded_data_sets(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListExpandedDataSetsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - def create_expanded_data_set( + def create_connected_site_tag( self, request: Optional[ - Union[analytics_admin.CreateExpandedDataSetRequest, dict] + Union[analytics_admin.CreateConnectedSiteTagRequest, dict] ] = None, *, - parent: Optional[str] = None, - expanded_data_set: Optional[gaa_expanded_data_set.ExpandedDataSet] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> gaa_expanded_data_set.ExpandedDataSet: - r"""Creates a ExpandedDataSet. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - expanded_data_set = admin_v1alpha.ExpandedDataSet() - expanded_data_set.display_name = "display_name_value" - - request = admin_v1alpha.CreateExpandedDataSetRequest( - parent="parent_value", - expanded_data_set=expanded_data_set, - ) - - # Make the request - response = client.create_expanded_data_set(request=request) - - # Handle the response - print(response) + ) -> analytics_admin.CreateConnectedSiteTagResponse: + r"""Creates a connected site tag for a Universal + Analytics property. You can create a maximum of 20 + connected site tags per property. Note: This API cannot + be used on GA4 properties. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateExpandedDataSetRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.CreateConnectedSiteTagRequest, dict]): The request object. Request message for - CreateExpandedDataSet RPC. - parent (str): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - expanded_data_set (google.analytics.admin_v1alpha.types.ExpandedDataSet): - Required. The ExpandedDataSet to - create. - - This corresponds to the ``expanded_data_set`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + CreateConnectedSiteTag RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -11951,43 +9730,24 @@ def sample_create_expanded_data_set(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ExpandedDataSet: - A resource message representing a GA4 - ExpandedDataSet. + google.analytics.admin_v1alpha.types.CreateConnectedSiteTagResponse: + Response message for + CreateConnectedSiteTag RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, expanded_data_set]) - if request is not None and has_flattened_params: - 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 analytics_admin.CreateExpandedDataSetRequest. + # in a analytics_admin.CreateConnectedSiteTagRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateExpandedDataSetRequest): - request = analytics_admin.CreateExpandedDataSetRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - if expanded_data_set is not None: - request.expanded_data_set = expanded_data_set + if not isinstance(request, analytics_admin.CreateConnectedSiteTagRequest): + request = analytics_admin.CreateConnectedSiteTagRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_expanded_data_set] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) + rpc = self._transport._wrapped_methods[ + self._transport.create_connected_site_tag + ] # Send the request. response = rpc( @@ -12000,71 +9760,71 @@ def sample_create_expanded_data_set(): # Done; return the response. return response - def update_expanded_data_set( + def delete_connected_site_tag( self, request: Optional[ - Union[analytics_admin.UpdateExpandedDataSetRequest, dict] + Union[analytics_admin.DeleteConnectedSiteTagRequest, dict] ] = None, *, - expanded_data_set: Optional[gaa_expanded_data_set.ExpandedDataSet] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> gaa_expanded_data_set.ExpandedDataSet: - r"""Updates a ExpandedDataSet on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - expanded_data_set = admin_v1alpha.ExpandedDataSet() - expanded_data_set.display_name = "display_name_value" - - request = admin_v1alpha.UpdateExpandedDataSetRequest( - expanded_data_set=expanded_data_set, - ) - - # Make the request - response = client.update_expanded_data_set(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a connected site tag for a Universal + Analytics property. Note: this has no effect on GA4 + properties. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateExpandedDataSetRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.DeleteConnectedSiteTagRequest, dict]): The request object. Request message for - UpdateExpandedDataSet RPC. - expanded_data_set (google.analytics.admin_v1alpha.types.ExpandedDataSet): - Required. The ExpandedDataSet to update. The resource's - ``name`` field is used to identify the ExpandedDataSet - to be updated. + DeleteConnectedSiteTag RPC. + 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. + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.DeleteConnectedSiteTagRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.DeleteConnectedSiteTagRequest): + request = analytics_admin.DeleteConnectedSiteTagRequest(request) - This corresponds to the ``expanded_data_set`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.delete_connected_site_tag + ] - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + def list_connected_site_tags( + self, + request: Optional[ + Union[analytics_admin.ListConnectedSiteTagsRequest, dict] + ] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> analytics_admin.ListConnectedSiteTagsResponse: + r"""Lists the connected site tags for a Universal + Analytics property. A maximum of 20 connected site tags + will be returned. Note: this has no effect on GA4 + property. + + Args: + request (Union[google.analytics.admin_v1alpha.types.ListConnectedSiteTagsRequest, dict]): + The request object. Request message for + ListConnectedSiteTags RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -12072,45 +9832,22 @@ def sample_update_expanded_data_set(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ExpandedDataSet: - A resource message representing a GA4 - ExpandedDataSet. + google.analytics.admin_v1alpha.types.ListConnectedSiteTagsResponse: + Response message for + ListConnectedSiteTags RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([expanded_data_set, update_mask]) - if request is not None and has_flattened_params: - 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 analytics_admin.UpdateExpandedDataSetRequest. + # in a analytics_admin.ListConnectedSiteTagsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateExpandedDataSetRequest): - request = analytics_admin.UpdateExpandedDataSetRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if expanded_data_set is not None: - request.expanded_data_set = expanded_data_set - if update_mask is not None: - request.update_mask = update_mask + if not isinstance(request, analytics_admin.ListConnectedSiteTagsRequest): + request = analytics_admin.ListConnectedSiteTagsRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_expanded_data_set] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("expanded_data_set.name", request.expanded_data_set.name),) - ), - ) + rpc = self._transport._wrapped_methods[self._transport.list_connected_site_tags] # Send the request. response = rpc( @@ -12123,143 +9860,82 @@ def sample_update_expanded_data_set(): # Done; return the response. return response - def delete_expanded_data_set( + def fetch_connected_ga4_property( self, request: Optional[ - Union[analytics_admin.DeleteExpandedDataSetRequest, dict] + Union[analytics_admin.FetchConnectedGa4PropertyRequest, dict] ] = None, *, - name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a ExpandedDataSet on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteExpandedDataSetRequest( - name="name_value", - ) - - # Make the request - client.delete_expanded_data_set(request=request) + ) -> analytics_admin.FetchConnectedGa4PropertyResponse: + r"""Given a specified UA property, looks up the GA4 + property connected to it. Note: this cannot be used with + GA4 properties. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteExpandedDataSetRequest, dict]): - The request object. Request message for - DeleteExpandedDataSet RPC. - name (str): - Required. Example format: - properties/1234/expandedDataSets/5678 - - This corresponds to the ``name`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + request (Union[google.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyRequest, dict]): + The request object. Request for looking up GA4 property + connected to a UA property. 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.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyResponse: + Response for looking up GA4 property + connected to a UA property. + """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - 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 analytics_admin.DeleteExpandedDataSetRequest. + # in a analytics_admin.FetchConnectedGa4PropertyRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.DeleteExpandedDataSetRequest): - request = analytics_admin.DeleteExpandedDataSetRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name + if not isinstance(request, analytics_admin.FetchConnectedGa4PropertyRequest): + request = analytics_admin.FetchConnectedGa4PropertyRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_expanded_data_set] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) + rpc = self._transport._wrapped_methods[ + self._transport.fetch_connected_ga4_property + ] # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def get_channel_group( + # Done; return the response. + return response + + def get_ad_sense_link( self, - request: Optional[Union[analytics_admin.GetChannelGroupRequest, dict]] = None, + request: Optional[Union[analytics_admin.GetAdSenseLinkRequest, dict]] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> channel_group.ChannelGroup: - r"""Lookup for a single ChannelGroup. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetChannelGroupRequest( - name="name_value", - ) - - # Make the request - response = client.get_channel_group(request=request) - - # Handle the response - print(response) + ) -> resources.AdSenseLink: + r"""Looks up a single AdSenseLink. Args: - request (Union[google.analytics.admin_v1alpha.types.GetChannelGroupRequest, dict]): - The request object. Request message for GetChannelGroup - RPC. + request (Union[google.analytics.admin_v1alpha.types.GetAdSenseLinkRequest, dict]): + The request object. Request message to be passed to + GetAdSenseLink method. name (str): - Required. The ChannelGroup to get. - Example format: - properties/1234/channelGroups/5678 + Required. Unique identifier for the + AdSense Link requested. Format: + properties/{propertyId}/adSenseLinks/{linkId} + Example: + properties/1234/adSenseLinks/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -12271,9 +9947,9 @@ def sample_get_channel_group(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ChannelGroup: - A resource message representing a - Channel Group. + google.analytics.admin_v1alpha.types.AdSenseLink: + A link between a GA4 Property and an + AdSense for Content ad client. """ # Create or coerce a protobuf request object. @@ -12287,11 +9963,11 @@ def sample_get_channel_group(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetChannelGroupRequest. + # in a analytics_admin.GetAdSenseLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetChannelGroupRequest): - request = analytics_admin.GetChannelGroupRequest(request) + if not isinstance(request, analytics_admin.GetAdSenseLinkRequest): + request = analytics_admin.GetAdSenseLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -12299,7 +9975,7 @@ def sample_get_channel_group(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_channel_group] + rpc = self._transport._wrapped_methods[self._transport.get_ad_sense_link] # Certain fields should be provided within the metadata header; # add these here. @@ -12318,56 +9994,36 @@ def sample_get_channel_group(): # Done; return the response. return response - def list_channel_groups( + def create_ad_sense_link( self, - request: Optional[Union[analytics_admin.ListChannelGroupsRequest, dict]] = None, + request: Optional[Union[analytics_admin.CreateAdSenseLinkRequest, dict]] = None, *, parent: Optional[str] = None, + adsense_link: Optional[resources.AdSenseLink] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListChannelGroupsPager: - r"""Lists ChannelGroups on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_channel_groups(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListChannelGroupsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_channel_groups(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> resources.AdSenseLink: + r"""Creates an AdSenseLink. Args: - request (Union[google.analytics.admin_v1alpha.types.ListChannelGroupsRequest, dict]): - The request object. Request message for ListChannelGroups - RPC. + request (Union[google.analytics.admin_v1alpha.types.CreateAdSenseLinkRequest, dict]): + The request object. Request message to be passed to + CreateAdSenseLink method. parent (str): Required. The property for which to - list ChannelGroups. Example format: + create an AdSense Link. Format: + properties/{propertyId} Example: properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. + adsense_link (google.analytics.admin_v1alpha.types.AdSenseLink): + Required. The AdSense Link to create + This corresponds to the ``adsense_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. @@ -12375,18 +10031,15 @@ def sample_list_channel_groups(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListChannelGroupsPager: - Response message for - ListChannelGroups RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.AdSenseLink: + A link between a GA4 Property and an + AdSense for Content ad client. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([parent, adsense_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -12394,19 +10047,21 @@ def sample_list_channel_groups(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListChannelGroupsRequest. + # in a analytics_admin.CreateAdSenseLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListChannelGroupsRequest): - request = analytics_admin.ListChannelGroupsRequest(request) + if not isinstance(request, analytics_admin.CreateAdSenseLinkRequest): + request = analytics_admin.CreateAdSenseLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent + if adsense_link is not None: + request.adsense_link = adsense_link # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_channel_groups] + rpc = self._transport._wrapped_methods[self._transport.create_ad_sense_link] # Certain fields should be provided within the metadata header; # add these here. @@ -12422,78 +10077,32 @@ def sample_list_channel_groups(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListChannelGroupsPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - def create_channel_group( + def delete_ad_sense_link( self, - request: Optional[ - Union[analytics_admin.CreateChannelGroupRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.DeleteAdSenseLinkRequest, dict]] = None, *, - parent: Optional[str] = None, - channel_group: Optional[gaa_channel_group.ChannelGroup] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> gaa_channel_group.ChannelGroup: - r"""Creates a ChannelGroup. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - channel_group = admin_v1alpha.ChannelGroup() - channel_group.display_name = "display_name_value" - channel_group.grouping_rule.display_name = "display_name_value" - - request = admin_v1alpha.CreateChannelGroupRequest( - parent="parent_value", - channel_group=channel_group, - ) - - # Make the request - response = client.create_channel_group(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes an AdSenseLink. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateChannelGroupRequest, dict]): - The request object. Request message for - CreateChannelGroup RPC. - parent (str): - Required. The property for which to - create a ChannelGroup. Example format: - properties/1234 + request (Union[google.analytics.admin_v1alpha.types.DeleteAdSenseLinkRequest, dict]): + The request object. Request message to be passed to + DeleteAdSenseLink method. + name (str): + Required. Unique identifier for the + AdSense Link to be deleted. Format: + properties/{propertyId}/adSenseLinks/{linkId} + Example: + properties/1234/adSenseLinks/5678 - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - channel_group (google.analytics.admin_v1alpha.types.ChannelGroup): - Required. The ChannelGroup to create. - This corresponds to the ``channel_group`` field + This corresponds to the ``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, @@ -12501,17 +10110,11 @@ def sample_create_channel_group(): 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.analytics.admin_v1alpha.types.ChannelGroup: - A resource message representing a - Channel Group. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, channel_group]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -12519,103 +10122,56 @@ def sample_create_channel_group(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateChannelGroupRequest. + # in a analytics_admin.DeleteAdSenseLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateChannelGroupRequest): - request = analytics_admin.CreateChannelGroupRequest(request) + if not isinstance(request, analytics_admin.DeleteAdSenseLinkRequest): + request = analytics_admin.DeleteAdSenseLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if channel_group is not None: - request.channel_group = channel_group + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_channel_group] + rpc = self._transport._wrapped_methods[self._transport.delete_ad_sense_link] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. - response = rpc( + rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - def update_channel_group( + def list_ad_sense_links( self, - request: Optional[ - Union[analytics_admin.UpdateChannelGroupRequest, dict] - ] = None, + request: Optional[Union[analytics_admin.ListAdSenseLinksRequest, dict]] = None, *, - channel_group: Optional[gaa_channel_group.ChannelGroup] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> gaa_channel_group.ChannelGroup: - r"""Updates a ChannelGroup. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - channel_group = admin_v1alpha.ChannelGroup() - channel_group.display_name = "display_name_value" - channel_group.grouping_rule.display_name = "display_name_value" - - request = admin_v1alpha.UpdateChannelGroupRequest( - channel_group=channel_group, - ) - - # Make the request - response = client.update_channel_group(request=request) - - # Handle the response - print(response) + ) -> pagers.ListAdSenseLinksPager: + r"""Lists AdSenseLinks on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateChannelGroupRequest, dict]): - The request object. Request message for - UpdateChannelGroup RPC. - channel_group (google.analytics.admin_v1alpha.types.ChannelGroup): - Required. The ChannelGroup to update. The resource's - ``name`` field is used to identify the ChannelGroup to - be updated. - - This corresponds to the ``channel_group`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + request (Union[google.analytics.admin_v1alpha.types.ListAdSenseLinksRequest, dict]): + The request object. Request message to be passed to + ListAdSenseLinks method. + parent (str): + Required. Resource name of the parent + property. Format: + properties/{propertyId} + Example: properties/1234 - This corresponds to the ``update_mask`` field + This corresponds to the ``parent`` 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, @@ -12625,15 +10181,18 @@ def sample_update_channel_group(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.ChannelGroup: - A resource message representing a - Channel Group. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAdSenseLinksPager: + Response message for ListAdSenseLinks + method. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([channel_group, update_mask]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -12641,28 +10200,24 @@ def sample_update_channel_group(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateChannelGroupRequest. + # in a analytics_admin.ListAdSenseLinksRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateChannelGroupRequest): - request = analytics_admin.UpdateChannelGroupRequest(request) + if not isinstance(request, analytics_admin.ListAdSenseLinksRequest): + request = analytics_admin.ListAdSenseLinksRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if channel_group is not None: - request.channel_group = channel_group - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_channel_group] + rpc = self._transport._wrapped_methods[self._transport.list_ad_sense_links] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("channel_group.name", request.channel_group.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. @@ -12673,53 +10228,39 @@ def sample_update_channel_group(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListAdSenseLinksPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - def delete_channel_group( + def get_event_create_rule( self, request: Optional[ - Union[analytics_admin.DeleteChannelGroupRequest, dict] + Union[analytics_admin.GetEventCreateRuleRequest, dict] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a ChannelGroup on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteChannelGroupRequest( - name="name_value", - ) - - # Make the request - client.delete_channel_group(request=request) + ) -> event_create_and_edit.EventCreateRule: + r"""Lookup for a single EventCreateRule. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteChannelGroupRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.GetEventCreateRuleRequest, dict]): The request object. Request message for - DeleteChannelGroup RPC. + GetEventCreateRule RPC. name (str): - Required. The ChannelGroup to delete. - Example format: - properties/1234/channelGroups/5678 + Required. The name of the + EventCreateRule to get. Example format: + properties/123/dataStreams/456/eventCreateRules/789 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -12729,6 +10270,24 @@ def sample_delete_channel_group(): 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.analytics.admin_v1alpha.types.EventCreateRule: + An Event Create Rule defines + conditions that will trigger the + creation of an entirely new event based + upon matched criteria of a source event. + Additional mutations of the parameters + from the source event can be defined. + + Unlike Event Edit rules, Event Creation + Rules have no defined order. They will + all be run independently. + + Event Edit and Event Create rules can't + be used to modify an event created from + an Event Create rule. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -12741,11 +10300,11 @@ def sample_delete_channel_group(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteChannelGroupRequest. + # in a analytics_admin.GetEventCreateRuleRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.DeleteChannelGroupRequest): - request = analytics_admin.DeleteChannelGroupRequest(request) + if not isinstance(request, analytics_admin.GetEventCreateRuleRequest): + request = analytics_admin.GetEventCreateRuleRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -12753,7 +10312,7 @@ def sample_delete_channel_group(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_channel_group] + rpc = self._transport._wrapped_methods[self._transport.get_event_create_rule] # Certain fields should be provided within the metadata header; # add these here. @@ -12762,58 +10321,40 @@ def sample_delete_channel_group(): ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def set_automated_ga4_configuration_opt_out( + # Done; return the response. + return response + + def list_event_create_rules( self, request: Optional[ - Union[analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, dict] + Union[analytics_admin.ListEventCreateRulesRequest, dict] ] = None, *, + parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse: - r"""Sets the opt out status for the automated GA4 setup - process for a UA property. - Note: this has no effect on GA4 property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_set_automated_ga4_configuration_opt_out(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.SetAutomatedGa4ConfigurationOptOutRequest( - property="property_value", - ) - - # Make the request - response = client.set_automated_ga4_configuration_opt_out(request=request) - - # Handle the response - print(response) + ) -> pagers.ListEventCreateRulesPager: + r"""Lists EventCreateRules on a web data stream. Args: - request (Union[google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutRequest, dict]): - The request object. Request for setting the opt out - status for the automated GA4 setup - process. + request (Union[google.analytics.admin_v1alpha.types.ListEventCreateRulesRequest, dict]): + The request object. Request message for + ListEventCreateRules RPC. + parent (str): + Required. Example format: + properties/123/dataStreams/456 + + This corresponds to the ``parent`` 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. @@ -12821,27 +10362,44 @@ def sample_set_automated_ga4_configuration_opt_out(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutResponse: - Response message for setting the opt - out status for the automated GA4 setup - process. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListEventCreateRulesPager: + Response message for + ListEventCreateRules RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + 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 analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest. + # in a analytics_admin.ListEventCreateRulesRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest - ): - request = analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest(request) + if not isinstance(request, analytics_admin.ListEventCreateRulesRequest): + request = analytics_admin.ListEventCreateRulesRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.set_automated_ga4_configuration_opt_out - ] + rpc = self._transport._wrapped_methods[self._transport.list_event_create_rules] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) # Send the request. response = rpc( @@ -12851,54 +10409,50 @@ def sample_set_automated_ga4_configuration_opt_out(): metadata=metadata, ) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListEventCreateRulesPager( + method=rpc, + request=request, + response=response, + metadata=metadata, + ) + # Done; return the response. return response - def fetch_automated_ga4_configuration_opt_out( + def create_event_create_rule( self, request: Optional[ - Union[analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, dict] + Union[analytics_admin.CreateEventCreateRuleRequest, dict] ] = None, *, + parent: Optional[str] = None, + event_create_rule: Optional[event_create_and_edit.EventCreateRule] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse: - r"""Fetches the opt out status for the automated GA4 - setup process for a UA property. - Note: this has no effect on GA4 property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_fetch_automated_ga4_configuration_opt_out(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.FetchAutomatedGa4ConfigurationOptOutRequest( - property="property_value", - ) + ) -> event_create_and_edit.EventCreateRule: + r"""Creates an EventCreateRule. - # Make the request - response = client.fetch_automated_ga4_configuration_opt_out(request=request) + Args: + request (Union[google.analytics.admin_v1alpha.types.CreateEventCreateRuleRequest, dict]): + The request object. Request message for + CreateEventCreateRule RPC. + parent (str): + Required. Example format: + properties/123/dataStreams/456 - # Handle the response - print(response) + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + event_create_rule (google.analytics.admin_v1alpha.types.EventCreateRule): + Required. The EventCreateRule to + create. - Args: - request (Union[google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutRequest, dict]): - The request object. Request for fetching the opt out - status for the automated GA4 setup - process. + This corresponds to the ``event_create_rule`` 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. @@ -12906,29 +10460,55 @@ def sample_fetch_automated_ga4_configuration_opt_out(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutResponse: - Response message for fetching the opt - out status for the automated GA4 setup - process. + google.analytics.admin_v1alpha.types.EventCreateRule: + An Event Create Rule defines + conditions that will trigger the + creation of an entirely new event based + upon matched criteria of a source event. + Additional mutations of the parameters + from the source event can be defined. + + Unlike Event Edit rules, Event Creation + Rules have no defined order. They will + all be run independently. + + Event Edit and Event Create rules can't + be used to modify an event created from + an Event Create rule. """ # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, event_create_rule]) + if request is not None and has_flattened_params: + 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 analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest. + # in a analytics_admin.CreateEventCreateRuleRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance( - request, analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest - ): - request = analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest( - request - ) + if not isinstance(request, analytics_admin.CreateEventCreateRuleRequest): + request = analytics_admin.CreateEventCreateRuleRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if event_create_rule is not None: + request.event_create_rule = event_create_rule # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.fetch_automated_ga4_configuration_opt_out - ] + rpc = self._transport._wrapped_methods[self._transport.create_event_create_rule] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) # Send the request. response = rpc( @@ -12941,54 +10521,40 @@ def sample_fetch_automated_ga4_configuration_opt_out(): # Done; return the response. return response - def get_big_query_link( + def update_event_create_rule( self, - request: Optional[Union[analytics_admin.GetBigQueryLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.UpdateEventCreateRuleRequest, dict] + ] = None, *, - name: Optional[str] = None, + event_create_rule: Optional[event_create_and_edit.EventCreateRule] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.BigQueryLink: - r"""Lookup for a single BigQuery Link. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_big_query_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetBigQueryLinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_big_query_link(request=request) - - # Handle the response - print(response) + ) -> event_create_and_edit.EventCreateRule: + r"""Updates an EventCreateRule. Args: - request (Union[google.analytics.admin_v1alpha.types.GetBigQueryLinkRequest, dict]): - The request object. Request message for GetBigQueryLink - RPC. - name (str): - Required. The name of the BigQuery link to lookup. - Format: - properties/{property_id}/bigQueryLinks/{bigquery_link_id} - Example: properties/123/bigQueryLinks/456 + request (Union[google.analytics.admin_v1alpha.types.UpdateEventCreateRuleRequest, dict]): + The request object. Request message for + UpdateEventCreateRule RPC. + event_create_rule (google.analytics.admin_v1alpha.types.EventCreateRule): + Required. The EventCreateRule to update. The resource's + ``name`` field is used to identify the EventCreateRule + to be updated. - This corresponds to the ``name`` field + This corresponds to the ``event_create_rule`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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, @@ -12998,15 +10564,27 @@ def sample_get_big_query_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.BigQueryLink: - A link between a GA4 Property and - BigQuery project. + google.analytics.admin_v1alpha.types.EventCreateRule: + An Event Create Rule defines + conditions that will trigger the + creation of an entirely new event based + upon matched criteria of a source event. + Additional mutations of the parameters + from the source event can be defined. + + Unlike Event Edit rules, Event Creation + Rules have no defined order. They will + all be run independently. + + Event Edit and Event Create rules can't + be used to modify an event created from + an Event Create rule. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([event_create_rule, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -13014,24 +10592,28 @@ def sample_get_big_query_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetBigQueryLinkRequest. + # in a analytics_admin.UpdateEventCreateRuleRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetBigQueryLinkRequest): - request = analytics_admin.GetBigQueryLinkRequest(request) + if not isinstance(request, analytics_admin.UpdateEventCreateRuleRequest): + request = analytics_admin.UpdateEventCreateRuleRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if event_create_rule is not None: + request.event_create_rule = event_create_rule + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_big_query_link] + rpc = self._transport._wrapped_methods[self._transport.update_event_create_rule] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + (("event_create_rule.name", request.event_create_rule.name),) + ), ) # Send the request. @@ -13045,734 +10627,27 @@ def sample_get_big_query_link(): # Done; return the response. return response - def list_big_query_links( + def delete_event_create_rule( self, - request: Optional[Union[analytics_admin.ListBigQueryLinksRequest, dict]] = None, - *, - parent: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListBigQueryLinksPager: - r"""Lists BigQuery Links on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_big_query_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListBigQueryLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_big_query_links(request=request) - - # Handle the response - for response in page_result: - print(response) - - Args: - request (Union[google.analytics.admin_v1alpha.types.ListBigQueryLinksRequest, dict]): - The request object. Request message for ListBigQueryLinks - RPC. - parent (str): - Required. The name of the property to list BigQuery - links under. Format: properties/{property_id} Example: - properties/1234 - - This corresponds to the ``parent`` 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.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListBigQueryLinksPager: - Response message for - ListBigQueryLinks RPC - Iterating over this object will yield - results and resolve additional pages - automatically. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - 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 analytics_admin.ListBigQueryLinksRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, analytics_admin.ListBigQueryLinksRequest): - request = analytics_admin.ListBigQueryLinksRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_big_query_links] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) - - # 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.ListBigQueryLinksPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_enhanced_measurement_settings( - self, - request: Optional[ - Union[analytics_admin.GetEnhancedMeasurementSettingsRequest, dict] - ] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.EnhancedMeasurementSettings: - r"""Returns the enhanced measurement settings for this - data stream. Note that the stream must enable enhanced - measurement for these settings to take effect. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_enhanced_measurement_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetEnhancedMeasurementSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.get_enhanced_measurement_settings(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.analytics.admin_v1alpha.types.GetEnhancedMeasurementSettingsRequest, dict]): - The request object. Request message for - GetEnhancedMeasurementSettings RPC. - name (str): - Required. The name of the settings to lookup. Format: - properties/{property}/dataStreams/{data_stream}/enhancedMeasurementSettings - Example: - "properties/1000/dataStreams/2000/enhancedMeasurementSettings" - - This corresponds to the ``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.analytics.admin_v1alpha.types.EnhancedMeasurementSettings: - Singleton resource under a web - DataStream, configuring measurement of - additional site interactions and - content. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) - if request is not None and has_flattened_params: - 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 analytics_admin.GetEnhancedMeasurementSettingsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, analytics_admin.GetEnhancedMeasurementSettingsRequest - ): - request = analytics_admin.GetEnhancedMeasurementSettingsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if name is not None: - request.name = name - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.get_enhanced_measurement_settings - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def update_enhanced_measurement_settings( - self, - request: Optional[ - Union[analytics_admin.UpdateEnhancedMeasurementSettingsRequest, dict] - ] = None, - *, - enhanced_measurement_settings: Optional[ - resources.EnhancedMeasurementSettings - ] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.EnhancedMeasurementSettings: - r"""Updates the enhanced measurement settings for this - data stream. Note that the stream must enable enhanced - measurement for these settings to take effect. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_enhanced_measurement_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - enhanced_measurement_settings = admin_v1alpha.EnhancedMeasurementSettings() - enhanced_measurement_settings.search_query_parameter = "search_query_parameter_value" - - request = admin_v1alpha.UpdateEnhancedMeasurementSettingsRequest( - enhanced_measurement_settings=enhanced_measurement_settings, - ) - - # Make the request - response = client.update_enhanced_measurement_settings(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateEnhancedMeasurementSettingsRequest, dict]): - The request object. Request message for - UpdateEnhancedMeasurementSettings RPC. - enhanced_measurement_settings (google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings): - Required. The settings to update. The ``name`` field is - used to identify the settings to be updated. - - This corresponds to the ``enhanced_measurement_settings`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. - - This corresponds to the ``update_mask`` 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.analytics.admin_v1alpha.types.EnhancedMeasurementSettings: - Singleton resource under a web - DataStream, configuring measurement of - additional site interactions and - content. - - """ - # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([enhanced_measurement_settings, update_mask]) - if request is not None and has_flattened_params: - 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 analytics_admin.UpdateEnhancedMeasurementSettingsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance( - request, analytics_admin.UpdateEnhancedMeasurementSettingsRequest - ): - request = analytics_admin.UpdateEnhancedMeasurementSettingsRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if enhanced_measurement_settings is not None: - request.enhanced_measurement_settings = enhanced_measurement_settings - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.update_enhanced_measurement_settings - ] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - ( - ( - "enhanced_measurement_settings.name", - request.enhanced_measurement_settings.name, - ), - ) - ), - ) - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def create_connected_site_tag( - self, - request: Optional[ - Union[analytics_admin.CreateConnectedSiteTagRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.CreateConnectedSiteTagResponse: - r"""Creates a connected site tag for a Universal - Analytics property. You can create a maximum of 20 - connected site tags per property. Note: This API cannot - be used on GA4 properties. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_connected_site_tag(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - connected_site_tag = admin_v1alpha.ConnectedSiteTag() - connected_site_tag.display_name = "display_name_value" - connected_site_tag.tag_id = "tag_id_value" - - request = admin_v1alpha.CreateConnectedSiteTagRequest( - connected_site_tag=connected_site_tag, - ) - - # Make the request - response = client.create_connected_site_tag(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.analytics.admin_v1alpha.types.CreateConnectedSiteTagRequest, dict]): - The request object. Request message for - CreateConnectedSiteTag RPC. - 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.analytics.admin_v1alpha.types.CreateConnectedSiteTagResponse: - Response message for - CreateConnectedSiteTag RPC. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateConnectedSiteTagRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateConnectedSiteTagRequest): - request = analytics_admin.CreateConnectedSiteTagRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.create_connected_site_tag - ] - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def delete_connected_site_tag( - self, - request: Optional[ - Union[analytics_admin.DeleteConnectedSiteTagRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes a connected site tag for a Universal - Analytics property. Note: this has no effect on GA4 - properties. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_connected_site_tag(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteConnectedSiteTagRequest( - ) - - # Make the request - client.delete_connected_site_tag(request=request) - - Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteConnectedSiteTagRequest, dict]): - The request object. Request message for - DeleteConnectedSiteTag RPC. - 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. - # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteConnectedSiteTagRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, analytics_admin.DeleteConnectedSiteTagRequest): - request = analytics_admin.DeleteConnectedSiteTagRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.delete_connected_site_tag - ] - - # Send the request. - rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - def list_connected_site_tags( - self, - request: Optional[ - Union[analytics_admin.ListConnectedSiteTagsRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.ListConnectedSiteTagsResponse: - r"""Lists the connected site tags for a Universal - Analytics property. A maximum of 20 connected site tags - will be returned. Note: this has no effect on GA4 - property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_connected_site_tags(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListConnectedSiteTagsRequest( - ) - - # Make the request - response = client.list_connected_site_tags(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.analytics.admin_v1alpha.types.ListConnectedSiteTagsRequest, dict]): - The request object. Request message for - ListConnectedSiteTags RPC. - 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.analytics.admin_v1alpha.types.ListConnectedSiteTagsResponse: - Response message for - ListConnectedSiteTags RPC. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListConnectedSiteTagsRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, analytics_admin.ListConnectedSiteTagsRequest): - request = analytics_admin.ListConnectedSiteTagsRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_connected_site_tags] - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def fetch_connected_ga4_property( - self, - request: Optional[ - Union[analytics_admin.FetchConnectedGa4PropertyRequest, dict] - ] = None, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.FetchConnectedGa4PropertyResponse: - r"""Given a specified UA property, looks up the GA4 - property connected to it. Note: this cannot be used with - GA4 properties. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_fetch_connected_ga4_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.FetchConnectedGa4PropertyRequest( - property="property_value", - ) - - # Make the request - response = client.fetch_connected_ga4_property(request=request) - - # Handle the response - print(response) - - Args: - request (Union[google.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyRequest, dict]): - The request object. Request for looking up GA4 property - connected to a UA property. - 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.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyResponse: - Response for looking up GA4 property - connected to a UA property. - - """ - # Create or coerce a protobuf request object. - # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.FetchConnectedGa4PropertyRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, analytics_admin.FetchConnectedGa4PropertyRequest): - request = analytics_admin.FetchConnectedGa4PropertyRequest(request) - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[ - self._transport.fetch_connected_ga4_property - ] - - # Send the request. - response = rpc( - request, - retry=retry, - timeout=timeout, - metadata=metadata, - ) - - # Done; return the response. - return response - - def get_ad_sense_link( - self, - request: Optional[Union[analytics_admin.GetAdSenseLinkRequest, dict]] = None, - *, - name: Optional[str] = None, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Union[float, object] = gapic_v1.method.DEFAULT, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AdSenseLink: - r"""Looks up a single AdSenseLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_ad_sense_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAdSenseLinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_ad_sense_link(request=request) - - # Handle the response - print(response) + request: Optional[ + Union[analytics_admin.DeleteEventCreateRuleRequest, dict] + ] = None, + *, + name: Optional[str] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes an EventCreateRule. Args: - request (Union[google.analytics.admin_v1alpha.types.GetAdSenseLinkRequest, dict]): - The request object. Request message to be passed to - GetAdSenseLink method. + request (Union[google.analytics.admin_v1alpha.types.DeleteEventCreateRuleRequest, dict]): + The request object. Request message for + DeleteEventCreateRule RPC. name (str): - Required. Unique identifier for the - AdSense Link requested. Format: - properties/{propertyId}/adSenseLinks/{linkId} - Example: - properties/1234/adSenseLinks/5678 + Required. Example format: + + properties/123/dataStreams/456/eventCreateRules/789 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -13782,12 +10657,6 @@ def sample_get_ad_sense_link(): 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.analytics.admin_v1alpha.types.AdSenseLink: - A link between a GA4 Property and an - AdSense for Content ad client. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -13800,11 +10669,11 @@ def sample_get_ad_sense_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetAdSenseLinkRequest. + # in a analytics_admin.DeleteEventCreateRuleRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetAdSenseLinkRequest): - request = analytics_admin.GetAdSenseLinkRequest(request) + if not isinstance(request, analytics_admin.DeleteEventCreateRuleRequest): + request = analytics_admin.DeleteEventCreateRuleRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -13812,7 +10681,7 @@ def sample_get_ad_sense_link(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_ad_sense_link] + rpc = self._transport._wrapped_methods[self._transport.delete_event_create_rule] # Certain fields should be provided within the metadata header; # add these here. @@ -13821,70 +10690,46 @@ def sample_get_ad_sense_link(): ) # Send the request. - response = rpc( + rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - # Done; return the response. - return response - - def create_ad_sense_link( + def update_data_redaction_settings( self, - request: Optional[Union[analytics_admin.CreateAdSenseLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.UpdateDataRedactionSettingsRequest, dict] + ] = None, *, - parent: Optional[str] = None, - adsense_link: Optional[resources.AdSenseLink] = None, + data_redaction_settings: Optional[resources.DataRedactionSettings] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.AdSenseLink: - r"""Creates an AdSenseLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_ad_sense_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateAdSenseLinkRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_ad_sense_link(request=request) - - # Handle the response - print(response) + ) -> resources.DataRedactionSettings: + r"""Updates a DataRedactionSettings on a property. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateAdSenseLinkRequest, dict]): - The request object. Request message to be passed to - CreateAdSenseLink method. - parent (str): - Required. The property for which to - create an AdSense Link. Format: - properties/{propertyId} Example: - properties/1234 + request (Union[google.analytics.admin_v1alpha.types.UpdateDataRedactionSettingsRequest, dict]): + The request object. Request message for + UpdateDataRedactionSettings RPC. + data_redaction_settings (google.analytics.admin_v1alpha.types.DataRedactionSettings): + Required. The settings to update. The ``name`` field is + used to identify the settings to be updated. - This corresponds to the ``parent`` field + This corresponds to the ``data_redaction_settings`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - adsense_link (google.analytics.admin_v1alpha.types.AdSenseLink): - Required. The AdSense Link to create - This corresponds to the ``adsense_link`` field + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` 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, @@ -13894,15 +10739,16 @@ def sample_create_ad_sense_link(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.AdSenseLink: - A link between a GA4 Property and an - AdSense for Content ad client. + google.analytics.admin_v1alpha.types.DataRedactionSettings: + Settings for client-side data + redaction. Singleton resource under a + Web Stream. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, adsense_link]) + has_flattened_params = any([data_redaction_settings, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -13910,26 +10756,35 @@ def sample_create_ad_sense_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateAdSenseLinkRequest. + # in a analytics_admin.UpdateDataRedactionSettingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateAdSenseLinkRequest): - request = analytics_admin.CreateAdSenseLinkRequest(request) + if not isinstance(request, analytics_admin.UpdateDataRedactionSettingsRequest): + request = analytics_admin.UpdateDataRedactionSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if adsense_link is not None: - request.adsense_link = adsense_link + if data_redaction_settings is not None: + request.data_redaction_settings = data_redaction_settings + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_ad_sense_link] + rpc = self._transport._wrapped_methods[ + self._transport.update_data_redaction_settings + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "data_redaction_settings.name", + request.data_redaction_settings.name, + ), + ) + ), ) # Send the request. @@ -13943,50 +10798,28 @@ def sample_create_ad_sense_link(): # Done; return the response. return response - def delete_ad_sense_link( + def get_data_redaction_settings( self, - request: Optional[Union[analytics_admin.DeleteAdSenseLinkRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.GetDataRedactionSettingsRequest, dict] + ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> None: - r"""Deletes an AdSenseLink. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_ad_sense_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteAdSenseLinkRequest( - name="name_value", - ) - - # Make the request - client.delete_ad_sense_link(request=request) + ) -> resources.DataRedactionSettings: + r"""Lookup for a single DataRedactionSettings. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteAdSenseLinkRequest, dict]): - The request object. Request message to be passed to - DeleteAdSenseLink method. + request (Union[google.analytics.admin_v1alpha.types.GetDataRedactionSettingsRequest, dict]): + The request object. Request message for + GetDataRedactionSettings RPC. name (str): - Required. Unique identifier for the - AdSense Link to be deleted. Format: - properties/{propertyId}/adSenseLinks/{linkId} + Required. The name of the settings to lookup. Format: + properties/{property}/dataStreams/{data_stream}/dataRedactionSettings Example: - properties/1234/adSenseLinks/5678 + "properties/1000/dataStreams/2000/dataRedactionSettings" This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -13996,6 +10829,13 @@ def sample_delete_ad_sense_link(): 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.analytics.admin_v1alpha.types.DataRedactionSettings: + Settings for client-side data + redaction. Singleton resource under a + Web Stream. + """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have @@ -14008,11 +10848,11 @@ def sample_delete_ad_sense_link(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteAdSenseLinkRequest. + # in a analytics_admin.GetDataRedactionSettingsRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.DeleteAdSenseLinkRequest): - request = analytics_admin.DeleteAdSenseLinkRequest(request) + if not isinstance(request, analytics_admin.GetDataRedactionSettingsRequest): + request = analytics_admin.GetDataRedactionSettingsRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -14020,7 +10860,9 @@ def sample_delete_ad_sense_link(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_ad_sense_link] + rpc = self._transport._wrapped_methods[ + self._transport.get_data_redaction_settings + ] # Certain fields should be provided within the metadata header; # add these here. @@ -14029,64 +10871,33 @@ def sample_delete_ad_sense_link(): ) # Send the request. - rpc( + response = rpc( request, retry=retry, timeout=timeout, metadata=metadata, ) - def list_ad_sense_links( + # Done; return the response. + return response + + def create_rollup_property( self, - request: Optional[Union[analytics_admin.ListAdSenseLinksRequest, dict]] = None, + request: Optional[ + Union[analytics_admin.CreateRollupPropertyRequest, dict] + ] = None, *, - parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListAdSenseLinksPager: - r"""Lists AdSenseLinks on a property. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_ad_sense_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAdSenseLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_ad_sense_links(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> analytics_admin.CreateRollupPropertyResponse: + r"""Create a roll-up property and all roll-up property + source links. Args: - request (Union[google.analytics.admin_v1alpha.types.ListAdSenseLinksRequest, dict]): - The request object. Request message to be passed to - ListAdSenseLinks method. - parent (str): - Required. Resource name of the parent - property. Format: - properties/{propertyId} - Example: properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. + request (Union[google.analytics.admin_v1alpha.types.CreateRollupPropertyRequest, dict]): + The request object. Request message for + CreateRollupProperty RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -14094,44 +10905,22 @@ def sample_list_ad_sense_links(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAdSenseLinksPager: - Response message for ListAdSenseLinks - method. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.CreateRollupPropertyResponse: + Response message for + CreateRollupProperty RPC. """ # Create or coerce a protobuf request object. - # Quick check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) - if request is not None and has_flattened_params: - 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 analytics_admin.ListAdSenseLinksRequest. + # in a analytics_admin.CreateRollupPropertyRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListAdSenseLinksRequest): - request = analytics_admin.ListAdSenseLinksRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if parent is not None: - request.parent = parent + if not isinstance(request, analytics_admin.CreateRollupPropertyRequest): + request = analytics_admin.CreateRollupPropertyRequest(request) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_ad_sense_links] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), - ) + rpc = self._transport._wrapped_methods[self._transport.create_rollup_property] # Send the request. response = rpc( @@ -14141,65 +10930,34 @@ def sample_list_ad_sense_links(): metadata=metadata, ) - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListAdSenseLinksPager( - method=rpc, - request=request, - response=response, - metadata=metadata, - ) - # Done; return the response. return response - def get_event_create_rule( + def get_rollup_property_source_link( self, request: Optional[ - Union[analytics_admin.GetEventCreateRuleRequest, dict] + Union[analytics_admin.GetRollupPropertySourceLinkRequest, dict] ] = None, *, name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> event_create_and_edit.EventCreateRule: - r"""Lookup for a single EventCreateRule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_get_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetEventCreateRuleRequest( - name="name_value", - ) - - # Make the request - response = client.get_event_create_rule(request=request) - - # Handle the response - print(response) + ) -> resources.RollupPropertySourceLink: + r"""Lookup for a single roll-up property source Link. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. Args: - request (Union[google.analytics.admin_v1alpha.types.GetEventCreateRuleRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.GetRollupPropertySourceLinkRequest, dict]): The request object. Request message for - GetEventCreateRule RPC. + GetRollupPropertySourceLink RPC. name (str): - Required. The name of the - EventCreateRule to get. Example format: - properties/123/dataStreams/456/eventCreateRules/789 + Required. The name of the roll-up property source link + to lookup. Format: + properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link_id} + Example: properties/123/rollupPropertySourceLinks/456 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -14211,21 +10969,10 @@ def sample_get_event_create_rule(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.EventCreateRule: - An Event Create Rule defines - conditions that will trigger the - creation of an entirely new event based - upon matched criteria of a source event. - Additional mutations of the parameters - from the source event can be defined. - - Unlike Event Edit rules, Event Creation - Rules have no defined order. They will - all be run independently. - - Event Edit and Event Create rules can't - be used to modify an event created from - an Event Create rule. + google.analytics.admin_v1alpha.types.RollupPropertySourceLink: + A link that references a source + property under the parent rollup + property. """ # Create or coerce a protobuf request object. @@ -14239,11 +10986,11 @@ def sample_get_event_create_rule(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.GetEventCreateRuleRequest. + # in a analytics_admin.GetRollupPropertySourceLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.GetEventCreateRuleRequest): - request = analytics_admin.GetEventCreateRuleRequest(request) + if not isinstance(request, analytics_admin.GetRollupPropertySourceLinkRequest): + request = analytics_admin.GetRollupPropertySourceLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -14251,7 +10998,9 @@ def sample_get_event_create_rule(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.get_event_create_rule] + rpc = self._transport._wrapped_methods[ + self._transport.get_rollup_property_source_link + ] # Certain fields should be provided within the metadata header; # add these here. @@ -14270,53 +11019,30 @@ def sample_get_event_create_rule(): # Done; return the response. return response - def list_event_create_rules( + def list_rollup_property_source_links( self, request: Optional[ - Union[analytics_admin.ListEventCreateRulesRequest, dict] + Union[analytics_admin.ListRollupPropertySourceLinksRequest, dict] ] = None, *, parent: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListEventCreateRulesPager: - r"""Lists EventCreateRules on a web data stream. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_list_event_create_rules(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListEventCreateRulesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_event_create_rules(request=request) - - # Handle the response - for response in page_result: - print(response) + ) -> pagers.ListRollupPropertySourceLinksPager: + r"""Lists roll-up property source Links on a property. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. Args: - request (Union[google.analytics.admin_v1alpha.types.ListEventCreateRulesRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.ListRollupPropertySourceLinksRequest, dict]): The request object. Request message for - ListEventCreateRules RPC. + ListRollupPropertySourceLinks RPC. parent (str): - Required. Example format: - properties/123/dataStreams/456 + Required. The name of the roll-up property to list + roll-up property source links under. Format: + properties/{property_id} Example: properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this @@ -14328,9 +11054,9 @@ def sample_list_event_create_rules(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListEventCreateRulesPager: + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListRollupPropertySourceLinksPager: Response message for - ListEventCreateRules RPC. + ListRollupPropertySourceLinks RPC. Iterating over this object will yield results and resolve additional pages automatically. @@ -14347,11 +11073,13 @@ def sample_list_event_create_rules(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListEventCreateRulesRequest. + # in a analytics_admin.ListRollupPropertySourceLinksRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListEventCreateRulesRequest): - request = analytics_admin.ListEventCreateRulesRequest(request) + if not isinstance( + request, analytics_admin.ListRollupPropertySourceLinksRequest + ): + request = analytics_admin.ListRollupPropertySourceLinksRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: @@ -14359,7 +11087,9 @@ def sample_list_event_create_rules(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_event_create_rules] + rpc = self._transport._wrapped_methods[ + self._transport.list_rollup_property_source_links + ] # Certain fields should be provided within the metadata header; # add these here. @@ -14377,7 +11107,7 @@ def sample_list_event_create_rules(): # This method is paged; wrap the response in a pager, which provides # an `__iter__` convenience method. - response = pagers.ListEventCreateRulesPager( + response = pagers.ListRollupPropertySourceLinksPager( method=rpc, request=request, response=response, @@ -14387,69 +11117,41 @@ def sample_list_event_create_rules(): # Done; return the response. return response - def create_event_create_rule( + def create_rollup_property_source_link( self, request: Optional[ - Union[analytics_admin.CreateEventCreateRuleRequest, dict] + Union[analytics_admin.CreateRollupPropertySourceLinkRequest, dict] ] = None, *, parent: Optional[str] = None, - event_create_rule: Optional[event_create_and_edit.EventCreateRule] = None, + rollup_property_source_link: Optional[ + resources.RollupPropertySourceLink + ] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> event_create_and_edit.EventCreateRule: - r"""Creates an EventCreateRule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_create_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - event_create_rule = admin_v1alpha.EventCreateRule() - event_create_rule.destination_event = "destination_event_value" - event_create_rule.event_conditions.field = "field_value" - event_create_rule.event_conditions.comparison_type = "REGULAR_EXPRESSION_CASE_INSENSITIVE" - event_create_rule.event_conditions.value = "value_value" - - request = admin_v1alpha.CreateEventCreateRuleRequest( - parent="parent_value", - event_create_rule=event_create_rule, - ) - - # Make the request - response = client.create_event_create_rule(request=request) - - # Handle the response - print(response) + ) -> resources.RollupPropertySourceLink: + r"""Creates a roll-up property source link. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. Args: - request (Union[google.analytics.admin_v1alpha.types.CreateEventCreateRuleRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.CreateRollupPropertySourceLinkRequest, dict]): The request object. Request message for - CreateEventCreateRule RPC. + CreateRollupPropertySourceLink RPC. parent (str): - Required. Example format: - properties/123/dataStreams/456 + Required. Format: properties/{property_id} Example: + properties/1234 This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. - event_create_rule (google.analytics.admin_v1alpha.types.EventCreateRule): - Required. The EventCreateRule to - create. + rollup_property_source_link (google.analytics.admin_v1alpha.types.RollupPropertySourceLink): + Required. The roll-up property source + link to create. - This corresponds to the ``event_create_rule`` field + This corresponds to the ``rollup_property_source_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, @@ -14459,27 +11161,16 @@ def sample_create_event_create_rule(): sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.EventCreateRule: - An Event Create Rule defines - conditions that will trigger the - creation of an entirely new event based - upon matched criteria of a source event. - Additional mutations of the parameters - from the source event can be defined. - - Unlike Event Edit rules, Event Creation - Rules have no defined order. They will - all be run independently. - - Event Edit and Event Create rules can't - be used to modify an event created from - an Event Create rule. + google.analytics.admin_v1alpha.types.RollupPropertySourceLink: + A link that references a source + property under the parent rollup + property. """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, event_create_rule]) + has_flattened_params = any([parent, rollup_property_source_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -14487,21 +11178,25 @@ def sample_create_event_create_rule(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateEventCreateRuleRequest. + # in a analytics_admin.CreateRollupPropertySourceLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateEventCreateRuleRequest): - request = analytics_admin.CreateEventCreateRuleRequest(request) + if not isinstance( + request, analytics_admin.CreateRollupPropertySourceLinkRequest + ): + request = analytics_admin.CreateRollupPropertySourceLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent - if event_create_rule is not None: - request.event_create_rule = event_create_rule + if rollup_property_source_link is not None: + request.rollup_property_source_link = rollup_property_source_link # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_event_create_rule] + rpc = self._transport._wrapped_methods[ + self._transport.create_rollup_property_source_link + ] # Certain fields should be provided within the metadata header; # add these here. @@ -14520,72 +11215,32 @@ def sample_create_event_create_rule(): # Done; return the response. return response - def update_event_create_rule( + def delete_rollup_property_source_link( self, request: Optional[ - Union[analytics_admin.UpdateEventCreateRuleRequest, dict] + Union[analytics_admin.DeleteRollupPropertySourceLinkRequest, dict] ] = None, *, - event_create_rule: Optional[event_create_and_edit.EventCreateRule] = None, - update_mask: Optional[field_mask_pb2.FieldMask] = None, + name: Optional[str] = None, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), - ) -> event_create_and_edit.EventCreateRule: - r"""Updates an EventCreateRule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_update_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - event_create_rule = admin_v1alpha.EventCreateRule() - event_create_rule.destination_event = "destination_event_value" - event_create_rule.event_conditions.field = "field_value" - event_create_rule.event_conditions.comparison_type = "REGULAR_EXPRESSION_CASE_INSENSITIVE" - event_create_rule.event_conditions.value = "value_value" - - request = admin_v1alpha.UpdateEventCreateRuleRequest( - event_create_rule=event_create_rule, - ) - - # Make the request - response = client.update_event_create_rule(request=request) - - # Handle the response - print(response) + ) -> None: + r"""Deletes a roll-up property source link. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. Args: - request (Union[google.analytics.admin_v1alpha.types.UpdateEventCreateRuleRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.DeleteRollupPropertySourceLinkRequest, dict]): The request object. Request message for - UpdateEventCreateRule RPC. - event_create_rule (google.analytics.admin_v1alpha.types.EventCreateRule): - Required. The EventCreateRule to update. The resource's - ``name`` field is used to identify the EventCreateRule - to be updated. - - This corresponds to the ``event_create_rule`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + DeleteRollupPropertySourceLink RPC. + name (str): + Required. Format: + properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link_id} + Example: properties/1234/rollupPropertySourceLinks/5678 - This corresponds to the ``update_mask`` field + This corresponds to the ``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, @@ -14593,29 +11248,11 @@ def sample_update_event_create_rule(): 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.analytics.admin_v1alpha.types.EventCreateRule: - An Event Create Rule defines - conditions that will trigger the - creation of an entirely new event based - upon matched criteria of a source event. - Additional mutations of the parameters - from the source event can be defined. - - Unlike Event Edit rules, Event Creation - Rules have no defined order. They will - all be run independently. - - Event Edit and Event Create rules can't - be used to modify an event created from - an Event Create rule. - """ # Create or coerce a protobuf request object. # Quick check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([event_create_rule, update_mask]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -14623,30 +11260,77 @@ def sample_update_event_create_rule(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateEventCreateRuleRequest. + # in a analytics_admin.DeleteRollupPropertySourceLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateEventCreateRuleRequest): - request = analytics_admin.UpdateEventCreateRuleRequest(request) + if not isinstance( + request, analytics_admin.DeleteRollupPropertySourceLinkRequest + ): + request = analytics_admin.DeleteRollupPropertySourceLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if event_create_rule is not None: - request.event_create_rule = event_create_rule - if update_mask is not None: - request.update_mask = update_mask + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_event_create_rule] + rpc = self._transport._wrapped_methods[ + self._transport.delete_rollup_property_source_link + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("event_create_rule.name", request.event_create_rule.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, ) + def create_subproperty( + self, + request: Optional[Union[analytics_admin.CreateSubpropertyRequest, dict]] = None, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> analytics_admin.CreateSubpropertyResponse: + r"""Create a subproperty and a subproperty event filter + that applies to the created subproperty. + + Args: + request (Union[google.analytics.admin_v1alpha.types.CreateSubpropertyRequest, dict]): + The request object. Request message for CreateSubproperty + RPC. + 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.analytics.admin_v1alpha.types.CreateSubpropertyResponse: + Response message for + CreateSubproperty RPC. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.CreateSubpropertyRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.CreateSubpropertyRequest): + request = analytics_admin.CreateSubpropertyRequest(request) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_subproperty] + # Send the request. response = rpc( request, @@ -14658,10 +11342,10 @@ def sample_update_event_create_rule(): # Done; return the response. return response - def delete_event_create_rule( + def delete_subproperty_event_filter( self, request: Optional[ - Union[analytics_admin.DeleteEventCreateRuleRequest, dict] + Union[analytics_admin.DeleteSubpropertyEventFilterRequest, dict] ] = None, *, name: Optional[str] = None, @@ -14669,39 +11353,17 @@ def delete_event_create_rule( timeout: Union[float, object] = gapic_v1.method.DEFAULT, metadata: Sequence[Tuple[str, str]] = (), ) -> None: - r"""Deletes an EventCreateRule. - - .. code-block:: python - - # This snippet has been automatically generated and should be regarded as a - # code template only. - # It will require modifications to work: - # - It may require correct/in-range values for request initialization. - # - It may require specifying regional endpoints when creating the service - # client as shown in: - # https://googleapis.dev/python/google-api-core/latest/client_options.html - from google.analytics import admin_v1alpha - - def sample_delete_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteEventCreateRuleRequest( - name="name_value", - ) - - # Make the request - client.delete_event_create_rule(request=request) + r"""Deletes a subproperty event filter. Args: - request (Union[google.analytics.admin_v1alpha.types.DeleteEventCreateRuleRequest, dict]): + request (Union[google.analytics.admin_v1alpha.types.DeleteSubpropertyEventFilterRequest, dict]): The request object. Request message for - DeleteEventCreateRule RPC. + DeleteSubpropertyEventFilter RPC. name (str): - Required. Example format: - - properties/123/dataStreams/456/eventCreateRules/789 + Required. Resource name of the subproperty event filter + to delete. Format: + properties/property_id/subpropertyEventFilters/subproperty_event_filter + Example: properties/123/subpropertyEventFilters/456 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -14723,11 +11385,11 @@ def sample_delete_event_create_rule(): ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.DeleteEventCreateRuleRequest. + # in a analytics_admin.DeleteSubpropertyEventFilterRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.DeleteEventCreateRuleRequest): - request = analytics_admin.DeleteEventCreateRuleRequest(request) + if not isinstance(request, analytics_admin.DeleteSubpropertyEventFilterRequest): + request = analytics_admin.DeleteSubpropertyEventFilterRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -14735,7 +11397,9 @@ def sample_delete_event_create_rule(): # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.delete_event_create_rule] + rpc = self._transport._wrapped_methods[ + self._transport.delete_subproperty_event_filter + ] # Certain fields should be provided within the metadata header; # add these here. @@ -14751,6 +11415,99 @@ def sample_delete_event_create_rule(): metadata=metadata, ) + def create_subproperty_event_filter( + self, + request: Optional[ + Union[analytics_admin.CreateSubpropertyEventFilterRequest, dict] + ] = None, + *, + parent: Optional[str] = None, + subproperty_event_filter: Optional[ + gaa_subproperty_event_filter.SubpropertyEventFilter + ] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gaa_subproperty_event_filter.SubpropertyEventFilter: + r"""Creates a subproperty Event Filter. + + Args: + request (Union[google.analytics.admin_v1alpha.types.CreateSubpropertyEventFilterRequest, dict]): + The request object. Request message for + CreateSubpropertyEventFilter RPC. + parent (str): + Required. The ordinary property for which to create a + subproperty event filter. Format: properties/property_id + Example: properties/123 + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + subproperty_event_filter (google.analytics.admin_v1alpha.types.SubpropertyEventFilter): + Required. The subproperty event + filter to create. + + This corresponds to the ``subproperty_event_filter`` 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.analytics.admin_v1alpha.types.SubpropertyEventFilter: + A resource message representing a GA4 + Subproperty event filter. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, subproperty_event_filter]) + if request is not None and has_flattened_params: + 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 analytics_admin.CreateSubpropertyEventFilterRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.CreateSubpropertyEventFilterRequest): + request = analytics_admin.CreateSubpropertyEventFilterRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if subproperty_event_filter is not None: + request.subproperty_event_filter = subproperty_event_filter + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.create_subproperty_event_filter + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + def __enter__(self) -> "AnalyticsAdminServiceClient": return self diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/pagers.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/pagers.py index 6e63132e..38075c2e 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/pagers.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/pagers.py @@ -420,262 +420,6 @@ def __repr__(self) -> str: return "{0}<{1!r}>".format(self.__class__.__name__, self._response) -class ListUserLinksPager: - """A pager for iterating through ``list_user_links`` requests. - - This class thinly wraps an initial - :class:`google.analytics.admin_v1alpha.types.ListUserLinksResponse` object, and - provides an ``__iter__`` method to iterate through its - ``user_links`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``ListUserLinks`` requests and continue to iterate - through the ``user_links`` field on the - corresponding responses. - - All the usual :class:`google.analytics.admin_v1alpha.types.ListUserLinksResponse` - 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[..., analytics_admin.ListUserLinksResponse], - request: analytics_admin.ListUserLinksRequest, - response: analytics_admin.ListUserLinksResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.analytics.admin_v1alpha.types.ListUserLinksRequest): - The initial request object. - response (google.analytics.admin_v1alpha.types.ListUserLinksResponse): - 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 = analytics_admin.ListUserLinksRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[analytics_admin.ListUserLinksResponse]: - 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) -> Iterator[resources.UserLink]: - for page in self.pages: - yield from page.user_links - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) - - -class ListUserLinksAsyncPager: - """A pager for iterating through ``list_user_links`` requests. - - This class thinly wraps an initial - :class:`google.analytics.admin_v1alpha.types.ListUserLinksResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``user_links`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``ListUserLinks`` requests and continue to iterate - through the ``user_links`` field on the - corresponding responses. - - All the usual :class:`google.analytics.admin_v1alpha.types.ListUserLinksResponse` - 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[..., Awaitable[analytics_admin.ListUserLinksResponse]], - request: analytics_admin.ListUserLinksRequest, - response: analytics_admin.ListUserLinksResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.analytics.admin_v1alpha.types.ListUserLinksRequest): - The initial request object. - response (google.analytics.admin_v1alpha.types.ListUserLinksResponse): - 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 = analytics_admin.ListUserLinksRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[analytics_admin.ListUserLinksResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - - def __aiter__(self) -> AsyncIterator[resources.UserLink]: - async def async_generator(): - async for page in self.pages: - for response in page.user_links: - yield response - - return async_generator() - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) - - -class AuditUserLinksPager: - """A pager for iterating through ``audit_user_links`` requests. - - This class thinly wraps an initial - :class:`google.analytics.admin_v1alpha.types.AuditUserLinksResponse` object, and - provides an ``__iter__`` method to iterate through its - ``user_links`` field. - - If there are more pages, the ``__iter__`` method will make additional - ``AuditUserLinks`` requests and continue to iterate - through the ``user_links`` field on the - corresponding responses. - - All the usual :class:`google.analytics.admin_v1alpha.types.AuditUserLinksResponse` - 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[..., analytics_admin.AuditUserLinksResponse], - request: analytics_admin.AuditUserLinksRequest, - response: analytics_admin.AuditUserLinksResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiate the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.analytics.admin_v1alpha.types.AuditUserLinksRequest): - The initial request object. - response (google.analytics.admin_v1alpha.types.AuditUserLinksResponse): - 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 = analytics_admin.AuditUserLinksRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - def pages(self) -> Iterator[analytics_admin.AuditUserLinksResponse]: - 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) -> Iterator[resources.AuditUserLink]: - for page in self.pages: - yield from page.user_links - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) - - -class AuditUserLinksAsyncPager: - """A pager for iterating through ``audit_user_links`` requests. - - This class thinly wraps an initial - :class:`google.analytics.admin_v1alpha.types.AuditUserLinksResponse` object, and - provides an ``__aiter__`` method to iterate through its - ``user_links`` field. - - If there are more pages, the ``__aiter__`` method will make additional - ``AuditUserLinks`` requests and continue to iterate - through the ``user_links`` field on the - corresponding responses. - - All the usual :class:`google.analytics.admin_v1alpha.types.AuditUserLinksResponse` - 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[..., Awaitable[analytics_admin.AuditUserLinksResponse]], - request: analytics_admin.AuditUserLinksRequest, - response: analytics_admin.AuditUserLinksResponse, - *, - metadata: Sequence[Tuple[str, str]] = () - ): - """Instantiates the pager. - - Args: - method (Callable): The method that was originally called, and - which instantiated this pager. - request (google.analytics.admin_v1alpha.types.AuditUserLinksRequest): - The initial request object. - response (google.analytics.admin_v1alpha.types.AuditUserLinksResponse): - 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 = analytics_admin.AuditUserLinksRequest(request) - self._response = response - self._metadata = metadata - - def __getattr__(self, name: str) -> Any: - return getattr(self._response, name) - - @property - async def pages(self) -> AsyncIterator[analytics_admin.AuditUserLinksResponse]: - yield self._response - while self._response.next_page_token: - self._request.page_token = self._response.next_page_token - self._response = await self._method(self._request, metadata=self._metadata) - yield self._response - - def __aiter__(self) -> AsyncIterator[resources.AuditUserLink]: - async def async_generator(): - async for page in self.pages: - for response in page.user_links: - yield response - - return async_generator() - - def __repr__(self) -> str: - return "{0}<{1!r}>".format(self.__class__.__name__, self._response) - - class ListFirebaseLinksPager: """A pager for iterating through ``list_firebase_links`` requests. @@ -3168,3 +2912,135 @@ async def async_generator(): def __repr__(self) -> str: return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListRollupPropertySourceLinksPager: + """A pager for iterating through ``list_rollup_property_source_links`` requests. + + This class thinly wraps an initial + :class:`google.analytics.admin_v1alpha.types.ListRollupPropertySourceLinksResponse` object, and + provides an ``__iter__`` method to iterate through its + ``rollup_property_source_links`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListRollupPropertySourceLinks`` requests and continue to iterate + through the ``rollup_property_source_links`` field on the + corresponding responses. + + All the usual :class:`google.analytics.admin_v1alpha.types.ListRollupPropertySourceLinksResponse` + 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[..., analytics_admin.ListRollupPropertySourceLinksResponse], + request: analytics_admin.ListRollupPropertySourceLinksRequest, + response: analytics_admin.ListRollupPropertySourceLinksResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.analytics.admin_v1alpha.types.ListRollupPropertySourceLinksRequest): + The initial request object. + response (google.analytics.admin_v1alpha.types.ListRollupPropertySourceLinksResponse): + 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 = analytics_admin.ListRollupPropertySourceLinksRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages(self) -> Iterator[analytics_admin.ListRollupPropertySourceLinksResponse]: + 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) -> Iterator[resources.RollupPropertySourceLink]: + for page in self.pages: + yield from page.rollup_property_source_links + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListRollupPropertySourceLinksAsyncPager: + """A pager for iterating through ``list_rollup_property_source_links`` requests. + + This class thinly wraps an initial + :class:`google.analytics.admin_v1alpha.types.ListRollupPropertySourceLinksResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``rollup_property_source_links`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListRollupPropertySourceLinks`` requests and continue to iterate + through the ``rollup_property_source_links`` field on the + corresponding responses. + + All the usual :class:`google.analytics.admin_v1alpha.types.ListRollupPropertySourceLinksResponse` + 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[ + ..., Awaitable[analytics_admin.ListRollupPropertySourceLinksResponse] + ], + request: analytics_admin.ListRollupPropertySourceLinksRequest, + response: analytics_admin.ListRollupPropertySourceLinksResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.analytics.admin_v1alpha.types.ListRollupPropertySourceLinksRequest): + The initial request object. + response (google.analytics.admin_v1alpha.types.ListRollupPropertySourceLinksResponse): + 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 = analytics_admin.ListRollupPropertySourceLinksRequest(request) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages( + self, + ) -> AsyncIterator[analytics_admin.ListRollupPropertySourceLinksResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterator[resources.RollupPropertySourceLink]: + async def async_generator(): + async for page in self.pages: + for response in page.rollup_property_source_links: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py index 08262bff..13fa5851 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py @@ -30,6 +30,9 @@ from google.analytics.admin_v1alpha.types import ( expanded_data_set as gaa_expanded_data_set, ) +from google.analytics.admin_v1alpha.types import ( + subproperty_event_filter as gaa_subproperty_event_filter, +) from google.analytics.admin_v1alpha.types import analytics_admin from google.analytics.admin_v1alpha.types import audience from google.analytics.admin_v1alpha.types import audience as gaa_audience @@ -193,56 +196,6 @@ def _prep_wrapped_messages(self, client_info): default_timeout=60.0, client_info=client_info, ), - self.get_user_link: gapic_v1.method.wrap_method( - self.get_user_link, - default_timeout=60.0, - client_info=client_info, - ), - self.batch_get_user_links: gapic_v1.method.wrap_method( - self.batch_get_user_links, - default_timeout=60.0, - client_info=client_info, - ), - self.list_user_links: gapic_v1.method.wrap_method( - self.list_user_links, - default_timeout=60.0, - client_info=client_info, - ), - self.audit_user_links: gapic_v1.method.wrap_method( - self.audit_user_links, - default_timeout=60.0, - client_info=client_info, - ), - self.create_user_link: gapic_v1.method.wrap_method( - self.create_user_link, - default_timeout=60.0, - client_info=client_info, - ), - self.batch_create_user_links: gapic_v1.method.wrap_method( - self.batch_create_user_links, - default_timeout=60.0, - client_info=client_info, - ), - self.update_user_link: gapic_v1.method.wrap_method( - self.update_user_link, - default_timeout=60.0, - client_info=client_info, - ), - self.batch_update_user_links: gapic_v1.method.wrap_method( - self.batch_update_user_links, - default_timeout=60.0, - client_info=client_info, - ), - self.delete_user_link: gapic_v1.method.wrap_method( - self.delete_user_link, - default_timeout=60.0, - client_info=client_info, - ), - self.batch_delete_user_links: gapic_v1.method.wrap_method( - self.batch_delete_user_links, - default_timeout=60.0, - client_info=client_info, - ), self.create_firebase_link: gapic_v1.method.wrap_method( self.create_firebase_link, default_timeout=60.0, @@ -778,6 +731,56 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.update_data_redaction_settings: gapic_v1.method.wrap_method( + self.update_data_redaction_settings, + default_timeout=None, + client_info=client_info, + ), + self.get_data_redaction_settings: gapic_v1.method.wrap_method( + self.get_data_redaction_settings, + default_timeout=None, + client_info=client_info, + ), + self.create_rollup_property: gapic_v1.method.wrap_method( + self.create_rollup_property, + default_timeout=None, + client_info=client_info, + ), + self.get_rollup_property_source_link: gapic_v1.method.wrap_method( + self.get_rollup_property_source_link, + default_timeout=None, + client_info=client_info, + ), + self.list_rollup_property_source_links: gapic_v1.method.wrap_method( + self.list_rollup_property_source_links, + default_timeout=None, + client_info=client_info, + ), + self.create_rollup_property_source_link: gapic_v1.method.wrap_method( + self.create_rollup_property_source_link, + default_timeout=None, + client_info=client_info, + ), + self.delete_rollup_property_source_link: gapic_v1.method.wrap_method( + self.delete_rollup_property_source_link, + default_timeout=None, + client_info=client_info, + ), + self.create_subproperty: gapic_v1.method.wrap_method( + self.create_subproperty, + default_timeout=None, + client_info=client_info, + ), + self.delete_subproperty_event_filter: gapic_v1.method.wrap_method( + self.delete_subproperty_event_filter, + default_timeout=None, + client_info=client_info, + ), + self.create_subproperty_event_filter: gapic_v1.method.wrap_method( + self.create_subproperty_event_filter, + default_timeout=None, + client_info=client_info, + ), } def close(self): @@ -900,111 +903,6 @@ def update_property( ]: raise NotImplementedError() - @property - def get_user_link( - self, - ) -> Callable[ - [analytics_admin.GetUserLinkRequest], - Union[resources.UserLink, Awaitable[resources.UserLink]], - ]: - raise NotImplementedError() - - @property - def batch_get_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchGetUserLinksRequest], - Union[ - analytics_admin.BatchGetUserLinksResponse, - Awaitable[analytics_admin.BatchGetUserLinksResponse], - ], - ]: - raise NotImplementedError() - - @property - def list_user_links( - self, - ) -> Callable[ - [analytics_admin.ListUserLinksRequest], - Union[ - analytics_admin.ListUserLinksResponse, - Awaitable[analytics_admin.ListUserLinksResponse], - ], - ]: - raise NotImplementedError() - - @property - def audit_user_links( - self, - ) -> Callable[ - [analytics_admin.AuditUserLinksRequest], - Union[ - analytics_admin.AuditUserLinksResponse, - Awaitable[analytics_admin.AuditUserLinksResponse], - ], - ]: - raise NotImplementedError() - - @property - def create_user_link( - self, - ) -> Callable[ - [analytics_admin.CreateUserLinkRequest], - Union[resources.UserLink, Awaitable[resources.UserLink]], - ]: - raise NotImplementedError() - - @property - def batch_create_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchCreateUserLinksRequest], - Union[ - analytics_admin.BatchCreateUserLinksResponse, - Awaitable[analytics_admin.BatchCreateUserLinksResponse], - ], - ]: - raise NotImplementedError() - - @property - def update_user_link( - self, - ) -> Callable[ - [analytics_admin.UpdateUserLinkRequest], - Union[resources.UserLink, Awaitable[resources.UserLink]], - ]: - raise NotImplementedError() - - @property - def batch_update_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchUpdateUserLinksRequest], - Union[ - analytics_admin.BatchUpdateUserLinksResponse, - Awaitable[analytics_admin.BatchUpdateUserLinksResponse], - ], - ]: - raise NotImplementedError() - - @property - def delete_user_link( - self, - ) -> Callable[ - [analytics_admin.DeleteUserLinkRequest], - Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], - ]: - raise NotImplementedError() - - @property - def batch_delete_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchDeleteUserLinksRequest], - Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], - ]: - raise NotImplementedError() - @property def create_firebase_link( self, @@ -2134,6 +2032,118 @@ def delete_event_create_rule( ]: raise NotImplementedError() + @property + def update_data_redaction_settings( + self, + ) -> Callable[ + [analytics_admin.UpdateDataRedactionSettingsRequest], + Union[ + resources.DataRedactionSettings, Awaitable[resources.DataRedactionSettings] + ], + ]: + raise NotImplementedError() + + @property + def get_data_redaction_settings( + self, + ) -> Callable[ + [analytics_admin.GetDataRedactionSettingsRequest], + Union[ + resources.DataRedactionSettings, Awaitable[resources.DataRedactionSettings] + ], + ]: + raise NotImplementedError() + + @property + def create_rollup_property( + self, + ) -> Callable[ + [analytics_admin.CreateRollupPropertyRequest], + Union[ + analytics_admin.CreateRollupPropertyResponse, + Awaitable[analytics_admin.CreateRollupPropertyResponse], + ], + ]: + raise NotImplementedError() + + @property + def get_rollup_property_source_link( + self, + ) -> Callable[ + [analytics_admin.GetRollupPropertySourceLinkRequest], + Union[ + resources.RollupPropertySourceLink, + Awaitable[resources.RollupPropertySourceLink], + ], + ]: + raise NotImplementedError() + + @property + def list_rollup_property_source_links( + self, + ) -> Callable[ + [analytics_admin.ListRollupPropertySourceLinksRequest], + Union[ + analytics_admin.ListRollupPropertySourceLinksResponse, + Awaitable[analytics_admin.ListRollupPropertySourceLinksResponse], + ], + ]: + raise NotImplementedError() + + @property + def create_rollup_property_source_link( + self, + ) -> Callable[ + [analytics_admin.CreateRollupPropertySourceLinkRequest], + Union[ + resources.RollupPropertySourceLink, + Awaitable[resources.RollupPropertySourceLink], + ], + ]: + raise NotImplementedError() + + @property + def delete_rollup_property_source_link( + self, + ) -> Callable[ + [analytics_admin.DeleteRollupPropertySourceLinkRequest], + Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], + ]: + raise NotImplementedError() + + @property + def create_subproperty( + self, + ) -> Callable[ + [analytics_admin.CreateSubpropertyRequest], + Union[ + analytics_admin.CreateSubpropertyResponse, + Awaitable[analytics_admin.CreateSubpropertyResponse], + ], + ]: + raise NotImplementedError() + + @property + def delete_subproperty_event_filter( + self, + ) -> Callable[ + [analytics_admin.DeleteSubpropertyEventFilterRequest], + Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], + ]: + raise NotImplementedError() + + @property + def create_subproperty_event_filter( + self, + ) -> Callable[ + [analytics_admin.CreateSubpropertyEventFilterRequest], + Union[ + gaa_subproperty_event_filter.SubpropertyEventFilter, + Awaitable[gaa_subproperty_event_filter.SubpropertyEventFilter], + ], + ]: + raise NotImplementedError() + @property def kind(self) -> str: raise NotImplementedError() diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py index 88158844..489eeaae 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py @@ -27,6 +27,9 @@ from google.analytics.admin_v1alpha.types import ( expanded_data_set as gaa_expanded_data_set, ) +from google.analytics.admin_v1alpha.types import ( + subproperty_event_filter as gaa_subproperty_event_filter, +) from google.analytics.admin_v1alpha.types import analytics_admin from google.analytics.admin_v1alpha.types import audience from google.analytics.admin_v1alpha.types import audience as gaa_audience @@ -312,8 +315,8 @@ def delete_account( If the accounts are not restored before the expiration time, the account and all child resources (eg: - Properties, GoogleAdsLinks, Streams, UserLinks) will be - permanently purged. + Properties, GoogleAdsLinks, Streams, AccessBindings) + will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found. @@ -522,8 +525,8 @@ def delete_property( If the properties are not restored before the expiration time, the Property and all child resources (eg: - GoogleAdsLinks, Streams, UserLinks) will be permanently - purged. + GoogleAdsLinks, Streams, AccessBindings) will be + permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found, or is not a @@ -573,301 +576,6 @@ def update_property( ) return self._stubs["update_property"] - @property - def get_user_link( - self, - ) -> Callable[[analytics_admin.GetUserLinkRequest], resources.UserLink]: - r"""Return a callable for the get user link method over gRPC. - - Gets information about a user's link to an account or - property. - - Returns: - Callable[[~.GetUserLinkRequest], - ~.UserLink]: - 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_link" not in self._stubs: - self._stubs["get_user_link"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/GetUserLink", - request_serializer=analytics_admin.GetUserLinkRequest.serialize, - response_deserializer=resources.UserLink.deserialize, - ) - return self._stubs["get_user_link"] - - @property - def batch_get_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchGetUserLinksRequest], - analytics_admin.BatchGetUserLinksResponse, - ]: - r"""Return a callable for the batch get user links method over gRPC. - - Gets information about multiple users' links to an - account or property. - - Returns: - Callable[[~.BatchGetUserLinksRequest], - ~.BatchGetUserLinksResponse]: - 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 "batch_get_user_links" not in self._stubs: - self._stubs["batch_get_user_links"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/BatchGetUserLinks", - request_serializer=analytics_admin.BatchGetUserLinksRequest.serialize, - response_deserializer=analytics_admin.BatchGetUserLinksResponse.deserialize, - ) - return self._stubs["batch_get_user_links"] - - @property - def list_user_links( - self, - ) -> Callable[ - [analytics_admin.ListUserLinksRequest], analytics_admin.ListUserLinksResponse - ]: - r"""Return a callable for the list user links method over gRPC. - - Lists all user links on an account or property. - - Returns: - Callable[[~.ListUserLinksRequest], - ~.ListUserLinksResponse]: - 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_user_links" not in self._stubs: - self._stubs["list_user_links"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/ListUserLinks", - request_serializer=analytics_admin.ListUserLinksRequest.serialize, - response_deserializer=analytics_admin.ListUserLinksResponse.deserialize, - ) - return self._stubs["list_user_links"] - - @property - def audit_user_links( - self, - ) -> Callable[ - [analytics_admin.AuditUserLinksRequest], analytics_admin.AuditUserLinksResponse - ]: - r"""Return a callable for the audit user links method over gRPC. - - Lists all user links on an account or property, - including implicit ones that come from effective - permissions granted by groups or organization admin - roles. - - If a returned user link does not have direct - permissions, they cannot be removed from the account or - property directly with the DeleteUserLink command. They - have to be removed from the group/etc that gives them - permissions, which is currently only usable/discoverable - in the GA or GMP UIs. - - Returns: - Callable[[~.AuditUserLinksRequest], - ~.AuditUserLinksResponse]: - 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 "audit_user_links" not in self._stubs: - self._stubs["audit_user_links"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/AuditUserLinks", - request_serializer=analytics_admin.AuditUserLinksRequest.serialize, - response_deserializer=analytics_admin.AuditUserLinksResponse.deserialize, - ) - return self._stubs["audit_user_links"] - - @property - def create_user_link( - self, - ) -> Callable[[analytics_admin.CreateUserLinkRequest], resources.UserLink]: - r"""Return a callable for the create user link method over gRPC. - - Creates a user link on an account or property. - - If the user with the specified email already has - permissions on the account or property, then the user's - existing permissions will be unioned with the - permissions specified in the new UserLink. - - Returns: - Callable[[~.CreateUserLinkRequest], - ~.UserLink]: - 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_user_link" not in self._stubs: - self._stubs["create_user_link"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateUserLink", - request_serializer=analytics_admin.CreateUserLinkRequest.serialize, - response_deserializer=resources.UserLink.deserialize, - ) - return self._stubs["create_user_link"] - - @property - def batch_create_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchCreateUserLinksRequest], - analytics_admin.BatchCreateUserLinksResponse, - ]: - r"""Return a callable for the batch create user links method over gRPC. - - Creates information about multiple users' links to an - account or property. - This method is transactional. If any UserLink cannot be - created, none of the UserLinks will be created. - - Returns: - Callable[[~.BatchCreateUserLinksRequest], - ~.BatchCreateUserLinksResponse]: - 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 "batch_create_user_links" not in self._stubs: - self._stubs["batch_create_user_links"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/BatchCreateUserLinks", - request_serializer=analytics_admin.BatchCreateUserLinksRequest.serialize, - response_deserializer=analytics_admin.BatchCreateUserLinksResponse.deserialize, - ) - return self._stubs["batch_create_user_links"] - - @property - def update_user_link( - self, - ) -> Callable[[analytics_admin.UpdateUserLinkRequest], resources.UserLink]: - r"""Return a callable for the update user link method over gRPC. - - Updates a user link on an account or property. - - Returns: - Callable[[~.UpdateUserLinkRequest], - ~.UserLink]: - 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 "update_user_link" not in self._stubs: - self._stubs["update_user_link"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateUserLink", - request_serializer=analytics_admin.UpdateUserLinkRequest.serialize, - response_deserializer=resources.UserLink.deserialize, - ) - return self._stubs["update_user_link"] - - @property - def batch_update_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchUpdateUserLinksRequest], - analytics_admin.BatchUpdateUserLinksResponse, - ]: - r"""Return a callable for the batch update user links method over gRPC. - - Updates information about multiple users' links to an - account or property. - - Returns: - Callable[[~.BatchUpdateUserLinksRequest], - ~.BatchUpdateUserLinksResponse]: - 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 "batch_update_user_links" not in self._stubs: - self._stubs["batch_update_user_links"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/BatchUpdateUserLinks", - request_serializer=analytics_admin.BatchUpdateUserLinksRequest.serialize, - response_deserializer=analytics_admin.BatchUpdateUserLinksResponse.deserialize, - ) - return self._stubs["batch_update_user_links"] - - @property - def delete_user_link( - self, - ) -> Callable[[analytics_admin.DeleteUserLinkRequest], empty_pb2.Empty]: - r"""Return a callable for the delete user link method over gRPC. - - Deletes a user link on an account or property. - - Returns: - Callable[[~.DeleteUserLinkRequest], - ~.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 "delete_user_link" not in self._stubs: - self._stubs["delete_user_link"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteUserLink", - request_serializer=analytics_admin.DeleteUserLinkRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs["delete_user_link"] - - @property - def batch_delete_user_links( - self, - ) -> Callable[[analytics_admin.BatchDeleteUserLinksRequest], empty_pb2.Empty]: - r"""Return a callable for the batch delete user links method over gRPC. - - Deletes information about multiple users' links to an - account or property. - - Returns: - Callable[[~.BatchDeleteUserLinksRequest], - ~.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 "batch_delete_user_links" not in self._stubs: - self._stubs["batch_delete_user_links"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/BatchDeleteUserLinks", - request_serializer=analytics_admin.BatchDeleteUserLinksRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs["batch_delete_user_links"] - @property def create_firebase_link( self, @@ -4022,6 +3730,328 @@ def delete_event_create_rule( ) return self._stubs["delete_event_create_rule"] + @property + def update_data_redaction_settings( + self, + ) -> Callable[ + [analytics_admin.UpdateDataRedactionSettingsRequest], + resources.DataRedactionSettings, + ]: + r"""Return a callable for the update data redaction settings method over gRPC. + + Updates a DataRedactionSettings on a property. + + Returns: + Callable[[~.UpdateDataRedactionSettingsRequest], + ~.DataRedactionSettings]: + 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 "update_data_redaction_settings" not in self._stubs: + self._stubs[ + "update_data_redaction_settings" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateDataRedactionSettings", + request_serializer=analytics_admin.UpdateDataRedactionSettingsRequest.serialize, + response_deserializer=resources.DataRedactionSettings.deserialize, + ) + return self._stubs["update_data_redaction_settings"] + + @property + def get_data_redaction_settings( + self, + ) -> Callable[ + [analytics_admin.GetDataRedactionSettingsRequest], + resources.DataRedactionSettings, + ]: + r"""Return a callable for the get data redaction settings method over gRPC. + + Lookup for a single DataRedactionSettings. + + Returns: + Callable[[~.GetDataRedactionSettingsRequest], + ~.DataRedactionSettings]: + 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_data_redaction_settings" not in self._stubs: + self._stubs["get_data_redaction_settings"] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/GetDataRedactionSettings", + request_serializer=analytics_admin.GetDataRedactionSettingsRequest.serialize, + response_deserializer=resources.DataRedactionSettings.deserialize, + ) + return self._stubs["get_data_redaction_settings"] + + @property + def create_rollup_property( + self, + ) -> Callable[ + [analytics_admin.CreateRollupPropertyRequest], + analytics_admin.CreateRollupPropertyResponse, + ]: + r"""Return a callable for the create rollup property method over gRPC. + + Create a roll-up property and all roll-up property + source links. + + Returns: + Callable[[~.CreateRollupPropertyRequest], + ~.CreateRollupPropertyResponse]: + 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_rollup_property" not in self._stubs: + self._stubs["create_rollup_property"] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateRollupProperty", + request_serializer=analytics_admin.CreateRollupPropertyRequest.serialize, + response_deserializer=analytics_admin.CreateRollupPropertyResponse.deserialize, + ) + return self._stubs["create_rollup_property"] + + @property + def get_rollup_property_source_link( + self, + ) -> Callable[ + [analytics_admin.GetRollupPropertySourceLinkRequest], + resources.RollupPropertySourceLink, + ]: + r"""Return a callable for the get rollup property source + link method over gRPC. + + Lookup for a single roll-up property source Link. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. + + Returns: + Callable[[~.GetRollupPropertySourceLinkRequest], + ~.RollupPropertySourceLink]: + 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_rollup_property_source_link" not in self._stubs: + self._stubs[ + "get_rollup_property_source_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/GetRollupPropertySourceLink", + request_serializer=analytics_admin.GetRollupPropertySourceLinkRequest.serialize, + response_deserializer=resources.RollupPropertySourceLink.deserialize, + ) + return self._stubs["get_rollup_property_source_link"] + + @property + def list_rollup_property_source_links( + self, + ) -> Callable[ + [analytics_admin.ListRollupPropertySourceLinksRequest], + analytics_admin.ListRollupPropertySourceLinksResponse, + ]: + r"""Return a callable for the list rollup property source + links method over gRPC. + + Lists roll-up property source Links on a property. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. + + Returns: + Callable[[~.ListRollupPropertySourceLinksRequest], + ~.ListRollupPropertySourceLinksResponse]: + 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_rollup_property_source_links" not in self._stubs: + self._stubs[ + "list_rollup_property_source_links" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/ListRollupPropertySourceLinks", + request_serializer=analytics_admin.ListRollupPropertySourceLinksRequest.serialize, + response_deserializer=analytics_admin.ListRollupPropertySourceLinksResponse.deserialize, + ) + return self._stubs["list_rollup_property_source_links"] + + @property + def create_rollup_property_source_link( + self, + ) -> Callable[ + [analytics_admin.CreateRollupPropertySourceLinkRequest], + resources.RollupPropertySourceLink, + ]: + r"""Return a callable for the create rollup property source + link method over gRPC. + + Creates a roll-up property source link. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. + + Returns: + Callable[[~.CreateRollupPropertySourceLinkRequest], + ~.RollupPropertySourceLink]: + 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_rollup_property_source_link" not in self._stubs: + self._stubs[ + "create_rollup_property_source_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateRollupPropertySourceLink", + request_serializer=analytics_admin.CreateRollupPropertySourceLinkRequest.serialize, + response_deserializer=resources.RollupPropertySourceLink.deserialize, + ) + return self._stubs["create_rollup_property_source_link"] + + @property + def delete_rollup_property_source_link( + self, + ) -> Callable[ + [analytics_admin.DeleteRollupPropertySourceLinkRequest], empty_pb2.Empty + ]: + r"""Return a callable for the delete rollup property source + link method over gRPC. + + Deletes a roll-up property source link. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. + + Returns: + Callable[[~.DeleteRollupPropertySourceLinkRequest], + ~.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 "delete_rollup_property_source_link" not in self._stubs: + self._stubs[ + "delete_rollup_property_source_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteRollupPropertySourceLink", + request_serializer=analytics_admin.DeleteRollupPropertySourceLinkRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["delete_rollup_property_source_link"] + + @property + def create_subproperty( + self, + ) -> Callable[ + [analytics_admin.CreateSubpropertyRequest], + analytics_admin.CreateSubpropertyResponse, + ]: + r"""Return a callable for the create subproperty method over gRPC. + + Create a subproperty and a subproperty event filter + that applies to the created subproperty. + + Returns: + Callable[[~.CreateSubpropertyRequest], + ~.CreateSubpropertyResponse]: + 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_subproperty" not in self._stubs: + self._stubs["create_subproperty"] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateSubproperty", + request_serializer=analytics_admin.CreateSubpropertyRequest.serialize, + response_deserializer=analytics_admin.CreateSubpropertyResponse.deserialize, + ) + return self._stubs["create_subproperty"] + + @property + def delete_subproperty_event_filter( + self, + ) -> Callable[ + [analytics_admin.DeleteSubpropertyEventFilterRequest], empty_pb2.Empty + ]: + r"""Return a callable for the delete subproperty event + filter method over gRPC. + + Deletes a subproperty event filter. + + Returns: + Callable[[~.DeleteSubpropertyEventFilterRequest], + ~.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 "delete_subproperty_event_filter" not in self._stubs: + self._stubs[ + "delete_subproperty_event_filter" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteSubpropertyEventFilter", + request_serializer=analytics_admin.DeleteSubpropertyEventFilterRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["delete_subproperty_event_filter"] + + @property + def create_subproperty_event_filter( + self, + ) -> Callable[ + [analytics_admin.CreateSubpropertyEventFilterRequest], + gaa_subproperty_event_filter.SubpropertyEventFilter, + ]: + r"""Return a callable for the create subproperty event + filter method over gRPC. + + Creates a subproperty Event Filter. + + Returns: + Callable[[~.CreateSubpropertyEventFilterRequest], + ~.SubpropertyEventFilter]: + 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_subproperty_event_filter" not in self._stubs: + self._stubs[ + "create_subproperty_event_filter" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateSubpropertyEventFilter", + request_serializer=analytics_admin.CreateSubpropertyEventFilterRequest.serialize, + response_deserializer=gaa_subproperty_event_filter.SubpropertyEventFilter.deserialize, + ) + return self._stubs["create_subproperty_event_filter"] + def close(self): self.grpc_channel.close() diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py index 33f4894b..a4aa1b4e 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py @@ -27,6 +27,9 @@ from google.analytics.admin_v1alpha.types import ( expanded_data_set as gaa_expanded_data_set, ) +from google.analytics.admin_v1alpha.types import ( + subproperty_event_filter as gaa_subproperty_event_filter, +) from google.analytics.admin_v1alpha.types import analytics_admin from google.analytics.admin_v1alpha.types import audience from google.analytics.admin_v1alpha.types import audience as gaa_audience @@ -316,8 +319,8 @@ def delete_account( If the accounts are not restored before the expiration time, the account and all child resources (eg: - Properties, GoogleAdsLinks, Streams, UserLinks) will be - permanently purged. + Properties, GoogleAdsLinks, Streams, AccessBindings) + will be permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found. @@ -531,8 +534,8 @@ def delete_property( If the properties are not restored before the expiration time, the Property and all child resources (eg: - GoogleAdsLinks, Streams, UserLinks) will be permanently - purged. + GoogleAdsLinks, Streams, AccessBindings) will be + permanently purged. https://support.google.com/analytics/answer/6154772 Returns an error if the target is not found, or is not a @@ -584,309 +587,6 @@ def update_property( ) return self._stubs["update_property"] - @property - def get_user_link( - self, - ) -> Callable[[analytics_admin.GetUserLinkRequest], Awaitable[resources.UserLink]]: - r"""Return a callable for the get user link method over gRPC. - - Gets information about a user's link to an account or - property. - - Returns: - Callable[[~.GetUserLinkRequest], - Awaitable[~.UserLink]]: - 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_link" not in self._stubs: - self._stubs["get_user_link"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/GetUserLink", - request_serializer=analytics_admin.GetUserLinkRequest.serialize, - response_deserializer=resources.UserLink.deserialize, - ) - return self._stubs["get_user_link"] - - @property - def batch_get_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchGetUserLinksRequest], - Awaitable[analytics_admin.BatchGetUserLinksResponse], - ]: - r"""Return a callable for the batch get user links method over gRPC. - - Gets information about multiple users' links to an - account or property. - - Returns: - Callable[[~.BatchGetUserLinksRequest], - Awaitable[~.BatchGetUserLinksResponse]]: - 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 "batch_get_user_links" not in self._stubs: - self._stubs["batch_get_user_links"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/BatchGetUserLinks", - request_serializer=analytics_admin.BatchGetUserLinksRequest.serialize, - response_deserializer=analytics_admin.BatchGetUserLinksResponse.deserialize, - ) - return self._stubs["batch_get_user_links"] - - @property - def list_user_links( - self, - ) -> Callable[ - [analytics_admin.ListUserLinksRequest], - Awaitable[analytics_admin.ListUserLinksResponse], - ]: - r"""Return a callable for the list user links method over gRPC. - - Lists all user links on an account or property. - - Returns: - Callable[[~.ListUserLinksRequest], - Awaitable[~.ListUserLinksResponse]]: - 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_user_links" not in self._stubs: - self._stubs["list_user_links"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/ListUserLinks", - request_serializer=analytics_admin.ListUserLinksRequest.serialize, - response_deserializer=analytics_admin.ListUserLinksResponse.deserialize, - ) - return self._stubs["list_user_links"] - - @property - def audit_user_links( - self, - ) -> Callable[ - [analytics_admin.AuditUserLinksRequest], - Awaitable[analytics_admin.AuditUserLinksResponse], - ]: - r"""Return a callable for the audit user links method over gRPC. - - Lists all user links on an account or property, - including implicit ones that come from effective - permissions granted by groups or organization admin - roles. - - If a returned user link does not have direct - permissions, they cannot be removed from the account or - property directly with the DeleteUserLink command. They - have to be removed from the group/etc that gives them - permissions, which is currently only usable/discoverable - in the GA or GMP UIs. - - Returns: - Callable[[~.AuditUserLinksRequest], - Awaitable[~.AuditUserLinksResponse]]: - 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 "audit_user_links" not in self._stubs: - self._stubs["audit_user_links"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/AuditUserLinks", - request_serializer=analytics_admin.AuditUserLinksRequest.serialize, - response_deserializer=analytics_admin.AuditUserLinksResponse.deserialize, - ) - return self._stubs["audit_user_links"] - - @property - def create_user_link( - self, - ) -> Callable[ - [analytics_admin.CreateUserLinkRequest], Awaitable[resources.UserLink] - ]: - r"""Return a callable for the create user link method over gRPC. - - Creates a user link on an account or property. - - If the user with the specified email already has - permissions on the account or property, then the user's - existing permissions will be unioned with the - permissions specified in the new UserLink. - - Returns: - Callable[[~.CreateUserLinkRequest], - Awaitable[~.UserLink]]: - 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_user_link" not in self._stubs: - self._stubs["create_user_link"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateUserLink", - request_serializer=analytics_admin.CreateUserLinkRequest.serialize, - response_deserializer=resources.UserLink.deserialize, - ) - return self._stubs["create_user_link"] - - @property - def batch_create_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchCreateUserLinksRequest], - Awaitable[analytics_admin.BatchCreateUserLinksResponse], - ]: - r"""Return a callable for the batch create user links method over gRPC. - - Creates information about multiple users' links to an - account or property. - This method is transactional. If any UserLink cannot be - created, none of the UserLinks will be created. - - Returns: - Callable[[~.BatchCreateUserLinksRequest], - Awaitable[~.BatchCreateUserLinksResponse]]: - 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 "batch_create_user_links" not in self._stubs: - self._stubs["batch_create_user_links"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/BatchCreateUserLinks", - request_serializer=analytics_admin.BatchCreateUserLinksRequest.serialize, - response_deserializer=analytics_admin.BatchCreateUserLinksResponse.deserialize, - ) - return self._stubs["batch_create_user_links"] - - @property - def update_user_link( - self, - ) -> Callable[ - [analytics_admin.UpdateUserLinkRequest], Awaitable[resources.UserLink] - ]: - r"""Return a callable for the update user link method over gRPC. - - Updates a user link on an account or property. - - Returns: - Callable[[~.UpdateUserLinkRequest], - Awaitable[~.UserLink]]: - 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 "update_user_link" not in self._stubs: - self._stubs["update_user_link"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateUserLink", - request_serializer=analytics_admin.UpdateUserLinkRequest.serialize, - response_deserializer=resources.UserLink.deserialize, - ) - return self._stubs["update_user_link"] - - @property - def batch_update_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchUpdateUserLinksRequest], - Awaitable[analytics_admin.BatchUpdateUserLinksResponse], - ]: - r"""Return a callable for the batch update user links method over gRPC. - - Updates information about multiple users' links to an - account or property. - - Returns: - Callable[[~.BatchUpdateUserLinksRequest], - Awaitable[~.BatchUpdateUserLinksResponse]]: - 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 "batch_update_user_links" not in self._stubs: - self._stubs["batch_update_user_links"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/BatchUpdateUserLinks", - request_serializer=analytics_admin.BatchUpdateUserLinksRequest.serialize, - response_deserializer=analytics_admin.BatchUpdateUserLinksResponse.deserialize, - ) - return self._stubs["batch_update_user_links"] - - @property - def delete_user_link( - self, - ) -> Callable[[analytics_admin.DeleteUserLinkRequest], Awaitable[empty_pb2.Empty]]: - r"""Return a callable for the delete user link method over gRPC. - - Deletes a user link on an account or property. - - Returns: - Callable[[~.DeleteUserLinkRequest], - Awaitable[~.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 "delete_user_link" not in self._stubs: - self._stubs["delete_user_link"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteUserLink", - request_serializer=analytics_admin.DeleteUserLinkRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs["delete_user_link"] - - @property - def batch_delete_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchDeleteUserLinksRequest], Awaitable[empty_pb2.Empty] - ]: - r"""Return a callable for the batch delete user links method over gRPC. - - Deletes information about multiple users' links to an - account or property. - - Returns: - Callable[[~.BatchDeleteUserLinksRequest], - Awaitable[~.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 "batch_delete_user_links" not in self._stubs: - self._stubs["batch_delete_user_links"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/BatchDeleteUserLinks", - request_serializer=analytics_admin.BatchDeleteUserLinksRequest.serialize, - response_deserializer=empty_pb2.Empty.FromString, - ) - return self._stubs["batch_delete_user_links"] - @property def create_firebase_link( self, @@ -4117,6 +3817,330 @@ def delete_event_create_rule( ) return self._stubs["delete_event_create_rule"] + @property + def update_data_redaction_settings( + self, + ) -> Callable[ + [analytics_admin.UpdateDataRedactionSettingsRequest], + Awaitable[resources.DataRedactionSettings], + ]: + r"""Return a callable for the update data redaction settings method over gRPC. + + Updates a DataRedactionSettings on a property. + + Returns: + Callable[[~.UpdateDataRedactionSettingsRequest], + Awaitable[~.DataRedactionSettings]]: + 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 "update_data_redaction_settings" not in self._stubs: + self._stubs[ + "update_data_redaction_settings" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateDataRedactionSettings", + request_serializer=analytics_admin.UpdateDataRedactionSettingsRequest.serialize, + response_deserializer=resources.DataRedactionSettings.deserialize, + ) + return self._stubs["update_data_redaction_settings"] + + @property + def get_data_redaction_settings( + self, + ) -> Callable[ + [analytics_admin.GetDataRedactionSettingsRequest], + Awaitable[resources.DataRedactionSettings], + ]: + r"""Return a callable for the get data redaction settings method over gRPC. + + Lookup for a single DataRedactionSettings. + + Returns: + Callable[[~.GetDataRedactionSettingsRequest], + Awaitable[~.DataRedactionSettings]]: + 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_data_redaction_settings" not in self._stubs: + self._stubs["get_data_redaction_settings"] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/GetDataRedactionSettings", + request_serializer=analytics_admin.GetDataRedactionSettingsRequest.serialize, + response_deserializer=resources.DataRedactionSettings.deserialize, + ) + return self._stubs["get_data_redaction_settings"] + + @property + def create_rollup_property( + self, + ) -> Callable[ + [analytics_admin.CreateRollupPropertyRequest], + Awaitable[analytics_admin.CreateRollupPropertyResponse], + ]: + r"""Return a callable for the create rollup property method over gRPC. + + Create a roll-up property and all roll-up property + source links. + + Returns: + Callable[[~.CreateRollupPropertyRequest], + Awaitable[~.CreateRollupPropertyResponse]]: + 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_rollup_property" not in self._stubs: + self._stubs["create_rollup_property"] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateRollupProperty", + request_serializer=analytics_admin.CreateRollupPropertyRequest.serialize, + response_deserializer=analytics_admin.CreateRollupPropertyResponse.deserialize, + ) + return self._stubs["create_rollup_property"] + + @property + def get_rollup_property_source_link( + self, + ) -> Callable[ + [analytics_admin.GetRollupPropertySourceLinkRequest], + Awaitable[resources.RollupPropertySourceLink], + ]: + r"""Return a callable for the get rollup property source + link method over gRPC. + + Lookup for a single roll-up property source Link. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. + + Returns: + Callable[[~.GetRollupPropertySourceLinkRequest], + Awaitable[~.RollupPropertySourceLink]]: + 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_rollup_property_source_link" not in self._stubs: + self._stubs[ + "get_rollup_property_source_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/GetRollupPropertySourceLink", + request_serializer=analytics_admin.GetRollupPropertySourceLinkRequest.serialize, + response_deserializer=resources.RollupPropertySourceLink.deserialize, + ) + return self._stubs["get_rollup_property_source_link"] + + @property + def list_rollup_property_source_links( + self, + ) -> Callable[ + [analytics_admin.ListRollupPropertySourceLinksRequest], + Awaitable[analytics_admin.ListRollupPropertySourceLinksResponse], + ]: + r"""Return a callable for the list rollup property source + links method over gRPC. + + Lists roll-up property source Links on a property. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. + + Returns: + Callable[[~.ListRollupPropertySourceLinksRequest], + Awaitable[~.ListRollupPropertySourceLinksResponse]]: + 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_rollup_property_source_links" not in self._stubs: + self._stubs[ + "list_rollup_property_source_links" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/ListRollupPropertySourceLinks", + request_serializer=analytics_admin.ListRollupPropertySourceLinksRequest.serialize, + response_deserializer=analytics_admin.ListRollupPropertySourceLinksResponse.deserialize, + ) + return self._stubs["list_rollup_property_source_links"] + + @property + def create_rollup_property_source_link( + self, + ) -> Callable[ + [analytics_admin.CreateRollupPropertySourceLinkRequest], + Awaitable[resources.RollupPropertySourceLink], + ]: + r"""Return a callable for the create rollup property source + link method over gRPC. + + Creates a roll-up property source link. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. + + Returns: + Callable[[~.CreateRollupPropertySourceLinkRequest], + Awaitable[~.RollupPropertySourceLink]]: + 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_rollup_property_source_link" not in self._stubs: + self._stubs[ + "create_rollup_property_source_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateRollupPropertySourceLink", + request_serializer=analytics_admin.CreateRollupPropertySourceLinkRequest.serialize, + response_deserializer=resources.RollupPropertySourceLink.deserialize, + ) + return self._stubs["create_rollup_property_source_link"] + + @property + def delete_rollup_property_source_link( + self, + ) -> Callable[ + [analytics_admin.DeleteRollupPropertySourceLinkRequest], + Awaitable[empty_pb2.Empty], + ]: + r"""Return a callable for the delete rollup property source + link method over gRPC. + + Deletes a roll-up property source link. + Only roll-up properties can have source links, so this + method will throw an error if used on other types of + properties. + + Returns: + Callable[[~.DeleteRollupPropertySourceLinkRequest], + Awaitable[~.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 "delete_rollup_property_source_link" not in self._stubs: + self._stubs[ + "delete_rollup_property_source_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteRollupPropertySourceLink", + request_serializer=analytics_admin.DeleteRollupPropertySourceLinkRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["delete_rollup_property_source_link"] + + @property + def create_subproperty( + self, + ) -> Callable[ + [analytics_admin.CreateSubpropertyRequest], + Awaitable[analytics_admin.CreateSubpropertyResponse], + ]: + r"""Return a callable for the create subproperty method over gRPC. + + Create a subproperty and a subproperty event filter + that applies to the created subproperty. + + Returns: + Callable[[~.CreateSubpropertyRequest], + Awaitable[~.CreateSubpropertyResponse]]: + 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_subproperty" not in self._stubs: + self._stubs["create_subproperty"] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateSubproperty", + request_serializer=analytics_admin.CreateSubpropertyRequest.serialize, + response_deserializer=analytics_admin.CreateSubpropertyResponse.deserialize, + ) + return self._stubs["create_subproperty"] + + @property + def delete_subproperty_event_filter( + self, + ) -> Callable[ + [analytics_admin.DeleteSubpropertyEventFilterRequest], + Awaitable[empty_pb2.Empty], + ]: + r"""Return a callable for the delete subproperty event + filter method over gRPC. + + Deletes a subproperty event filter. + + Returns: + Callable[[~.DeleteSubpropertyEventFilterRequest], + Awaitable[~.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 "delete_subproperty_event_filter" not in self._stubs: + self._stubs[ + "delete_subproperty_event_filter" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteSubpropertyEventFilter", + request_serializer=analytics_admin.DeleteSubpropertyEventFilterRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["delete_subproperty_event_filter"] + + @property + def create_subproperty_event_filter( + self, + ) -> Callable[ + [analytics_admin.CreateSubpropertyEventFilterRequest], + Awaitable[gaa_subproperty_event_filter.SubpropertyEventFilter], + ]: + r"""Return a callable for the create subproperty event + filter method over gRPC. + + Creates a subproperty Event Filter. + + Returns: + Callable[[~.CreateSubpropertyEventFilterRequest], + Awaitable[~.SubpropertyEventFilter]]: + 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_subproperty_event_filter" not in self._stubs: + self._stubs[ + "create_subproperty_event_filter" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateSubpropertyEventFilter", + request_serializer=analytics_admin.CreateSubpropertyEventFilterRequest.serialize, + response_deserializer=gaa_subproperty_event_filter.SubpropertyEventFilter.deserialize, + ) + return self._stubs["create_subproperty_event_filter"] + def close(self): return self.grpc_channel.close() diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/rest.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/rest.py index b327cd74..91c4fe8b 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/rest.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/rest.py @@ -42,6 +42,9 @@ from google.analytics.admin_v1alpha.types import ( expanded_data_set as gaa_expanded_data_set, ) +from google.analytics.admin_v1alpha.types import ( + subproperty_event_filter as gaa_subproperty_event_filter, +) from google.analytics.admin_v1alpha.types import analytics_admin from google.analytics.admin_v1alpha.types import audience from google.analytics.admin_v1alpha.types import audience as gaa_audience @@ -103,14 +106,6 @@ def pre_archive_custom_metric(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def pre_audit_user_links(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_audit_user_links(self, response): - logging.log(f"Received response: {response}") - return response - def pre_batch_create_access_bindings(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -119,22 +114,10 @@ def post_batch_create_access_bindings(self, response): logging.log(f"Received response: {response}") return response - def pre_batch_create_user_links(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_batch_create_user_links(self, response): - logging.log(f"Received response: {response}") - return response - def pre_batch_delete_access_bindings(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def pre_batch_delete_user_links(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - def pre_batch_get_access_bindings(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -143,14 +126,6 @@ def post_batch_get_access_bindings(self, response): logging.log(f"Received response: {response}") return response - def pre_batch_get_user_links(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_batch_get_user_links(self, response): - logging.log(f"Received response: {response}") - return response - def pre_batch_update_access_bindings(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -159,14 +134,6 @@ def post_batch_update_access_bindings(self, response): logging.log(f"Received response: {response}") return response - def pre_batch_update_user_links(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_batch_update_user_links(self, response): - logging.log(f"Received response: {response}") - return response - def pre_cancel_display_video360_advertiser_link_proposal(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -311,6 +278,22 @@ def post_create_property(self, response): logging.log(f"Received response: {response}") return response + def pre_create_rollup_property(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_create_rollup_property(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_create_rollup_property_source_link(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_create_rollup_property_source_link(self, response): + logging.log(f"Received response: {response}") + return response + def pre_create_search_ads360_link(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -327,11 +310,19 @@ def post_create_sk_ad_network_conversion_value_schema(self, response): logging.log(f"Received response: {response}") return response - def pre_create_user_link(self, request, metadata): + def pre_create_subproperty(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_create_subproperty(self, response): + logging.log(f"Received response: {response}") + return response + + def pre_create_subproperty_event_filter(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_create_user_link(self, response): + def post_create_subproperty_event_filter(self, response): logging.log(f"Received response: {response}") return response @@ -399,6 +390,10 @@ def post_delete_property(self, response): logging.log(f"Received response: {response}") return response + def pre_delete_rollup_property_source_link(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + def pre_delete_search_ads360_link(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -407,7 +402,7 @@ def pre_delete_sk_ad_network_conversion_value_schema(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def pre_delete_user_link(self, request, metadata): + def pre_delete_subproperty_event_filter(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -507,6 +502,14 @@ def post_get_custom_metric(self, response): logging.log(f"Received response: {response}") return response + def pre_get_data_redaction_settings(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_get_data_redaction_settings(self, response): + logging.log(f"Received response: {response}") + return response + def pre_get_data_retention_settings(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -603,27 +606,27 @@ def post_get_property(self, response): logging.log(f"Received response: {response}") return response - def pre_get_search_ads360_link(self, request, metadata): + def pre_get_rollup_property_source_link(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_get_search_ads360_link(self, response): + def post_get_rollup_property_source_link(self, response): logging.log(f"Received response: {response}") return response - def pre_get_sk_ad_network_conversion_value_schema(self, request, metadata): + def pre_get_search_ads360_link(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_get_sk_ad_network_conversion_value_schema(self, response): + def post_get_search_ads360_link(self, response): logging.log(f"Received response: {response}") return response - def pre_get_user_link(self, request, metadata): + def pre_get_sk_ad_network_conversion_value_schema(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_get_user_link(self, response): + def post_get_sk_ad_network_conversion_value_schema(self, response): logging.log(f"Received response: {response}") return response @@ -787,27 +790,27 @@ def post_list_properties(self, response): logging.log(f"Received response: {response}") return response - def pre_list_search_ads360_links(self, request, metadata): + def pre_list_rollup_property_source_links(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_list_search_ads360_links(self, response): + def post_list_rollup_property_source_links(self, response): logging.log(f"Received response: {response}") return response - def pre_list_sk_ad_network_conversion_value_schemas(self, request, metadata): + def pre_list_search_ads360_links(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_list_sk_ad_network_conversion_value_schemas(self, response): + def post_list_search_ads360_links(self, response): logging.log(f"Received response: {response}") return response - def pre_list_user_links(self, request, metadata): + def pre_list_sk_ad_network_conversion_value_schemas(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata - def post_list_user_links(self, response): + def post_list_sk_ad_network_conversion_value_schemas(self, response): logging.log(f"Received response: {response}") return response @@ -907,6 +910,14 @@ def post_update_custom_metric(self, response): logging.log(f"Received response: {response}") return response + def pre_update_data_redaction_settings(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_update_data_redaction_settings(self, response): + logging.log(f"Received response: {response}") + return response + def pre_update_data_retention_settings(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -1003,14 +1014,6 @@ def post_update_sk_ad_network_conversion_value_schema(self, response): logging.log(f"Received response: {response}") return response - def pre_update_user_link(self, request, metadata): - logging.log(f"Received request: {request}") - return request, metadata - - def post_update_user_link(self, response): - logging.log(f"Received response: {response}") - return response - transport = AnalyticsAdminServiceRestTransport(interceptor=MyCustomAnalyticsAdminServiceInterceptor()) client = AnalyticsAdminServiceClient(transport=transport) @@ -1107,29 +1110,6 @@ def pre_archive_custom_metric( """ return request, metadata - def pre_audit_user_links( - self, - request: analytics_admin.AuditUserLinksRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[analytics_admin.AuditUserLinksRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for audit_user_links - - Override in a subclass to manipulate the request or metadata - before they are sent to the AnalyticsAdminService server. - """ - return request, metadata - - def post_audit_user_links( - self, response: analytics_admin.AuditUserLinksResponse - ) -> analytics_admin.AuditUserLinksResponse: - """Post-rpc interceptor for audit_user_links - - Override in a subclass to manipulate the response - after it is returned by the AnalyticsAdminService server but before - it is returned to user code. - """ - return response - def pre_batch_create_access_bindings( self, request: analytics_admin.BatchCreateAccessBindingsRequest, @@ -1155,29 +1135,6 @@ def post_batch_create_access_bindings( """ return response - def pre_batch_create_user_links( - self, - request: analytics_admin.BatchCreateUserLinksRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[analytics_admin.BatchCreateUserLinksRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for batch_create_user_links - - Override in a subclass to manipulate the request or metadata - before they are sent to the AnalyticsAdminService server. - """ - return request, metadata - - def post_batch_create_user_links( - self, response: analytics_admin.BatchCreateUserLinksResponse - ) -> analytics_admin.BatchCreateUserLinksResponse: - """Post-rpc interceptor for batch_create_user_links - - Override in a subclass to manipulate the response - after it is returned by the AnalyticsAdminService server but before - it is returned to user code. - """ - return response - def pre_batch_delete_access_bindings( self, request: analytics_admin.BatchDeleteAccessBindingsRequest, @@ -1192,18 +1149,6 @@ def pre_batch_delete_access_bindings( """ return request, metadata - def pre_batch_delete_user_links( - self, - request: analytics_admin.BatchDeleteUserLinksRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[analytics_admin.BatchDeleteUserLinksRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for batch_delete_user_links - - Override in a subclass to manipulate the request or metadata - before they are sent to the AnalyticsAdminService server. - """ - return request, metadata - def pre_batch_get_access_bindings( self, request: analytics_admin.BatchGetAccessBindingsRequest, @@ -1229,29 +1174,6 @@ def post_batch_get_access_bindings( """ return response - def pre_batch_get_user_links( - self, - request: analytics_admin.BatchGetUserLinksRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[analytics_admin.BatchGetUserLinksRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for batch_get_user_links - - Override in a subclass to manipulate the request or metadata - before they are sent to the AnalyticsAdminService server. - """ - return request, metadata - - def post_batch_get_user_links( - self, response: analytics_admin.BatchGetUserLinksResponse - ) -> analytics_admin.BatchGetUserLinksResponse: - """Post-rpc interceptor for batch_get_user_links - - Override in a subclass to manipulate the response - after it is returned by the AnalyticsAdminService server but before - it is returned to user code. - """ - return response - def pre_batch_update_access_bindings( self, request: analytics_admin.BatchUpdateAccessBindingsRequest, @@ -1277,29 +1199,6 @@ def post_batch_update_access_bindings( """ return response - def pre_batch_update_user_links( - self, - request: analytics_admin.BatchUpdateUserLinksRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[analytics_admin.BatchUpdateUserLinksRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for batch_update_user_links - - Override in a subclass to manipulate the request or metadata - before they are sent to the AnalyticsAdminService server. - """ - return request, metadata - - def post_batch_update_user_links( - self, response: analytics_admin.BatchUpdateUserLinksResponse - ) -> analytics_admin.BatchUpdateUserLinksResponse: - """Post-rpc interceptor for batch_update_user_links - - Override in a subclass to manipulate the response - after it is returned by the AnalyticsAdminService server but before - it is returned to user code. - """ - return response - def pre_cancel_display_video360_advertiser_link_proposal( self, request: analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, @@ -1726,6 +1625,54 @@ def post_create_property(self, response: resources.Property) -> resources.Proper """ return response + def pre_create_rollup_property( + self, + request: analytics_admin.CreateRollupPropertyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[analytics_admin.CreateRollupPropertyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for create_rollup_property + + Override in a subclass to manipulate the request or metadata + before they are sent to the AnalyticsAdminService server. + """ + return request, metadata + + def post_create_rollup_property( + self, response: analytics_admin.CreateRollupPropertyResponse + ) -> analytics_admin.CreateRollupPropertyResponse: + """Post-rpc interceptor for create_rollup_property + + Override in a subclass to manipulate the response + after it is returned by the AnalyticsAdminService server but before + it is returned to user code. + """ + return response + + def pre_create_rollup_property_source_link( + self, + request: analytics_admin.CreateRollupPropertySourceLinkRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + analytics_admin.CreateRollupPropertySourceLinkRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for create_rollup_property_source_link + + Override in a subclass to manipulate the request or metadata + before they are sent to the AnalyticsAdminService server. + """ + return request, metadata + + def post_create_rollup_property_source_link( + self, response: resources.RollupPropertySourceLink + ) -> resources.RollupPropertySourceLink: + """Post-rpc interceptor for create_rollup_property_source_link + + Override in a subclass to manipulate the response + after it is returned by the AnalyticsAdminService server but before + it is returned to user code. + """ + return response + def pre_create_search_ads360_link( self, request: analytics_admin.CreateSearchAds360LinkRequest, @@ -1777,20 +1724,47 @@ def post_create_sk_ad_network_conversion_value_schema( """ return response - def pre_create_user_link( + def pre_create_subproperty( + self, + request: analytics_admin.CreateSubpropertyRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[analytics_admin.CreateSubpropertyRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for create_subproperty + + Override in a subclass to manipulate the request or metadata + before they are sent to the AnalyticsAdminService server. + """ + return request, metadata + + def post_create_subproperty( + self, response: analytics_admin.CreateSubpropertyResponse + ) -> analytics_admin.CreateSubpropertyResponse: + """Post-rpc interceptor for create_subproperty + + Override in a subclass to manipulate the response + after it is returned by the AnalyticsAdminService server but before + it is returned to user code. + """ + return response + + def pre_create_subproperty_event_filter( self, - request: analytics_admin.CreateUserLinkRequest, + request: analytics_admin.CreateSubpropertyEventFilterRequest, metadata: Sequence[Tuple[str, str]], - ) -> Tuple[analytics_admin.CreateUserLinkRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for create_user_link + ) -> Tuple[ + analytics_admin.CreateSubpropertyEventFilterRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for create_subproperty_event_filter Override in a subclass to manipulate the request or metadata before they are sent to the AnalyticsAdminService server. """ return request, metadata - def post_create_user_link(self, response: resources.UserLink) -> resources.UserLink: - """Post-rpc interceptor for create_user_link + def post_create_subproperty_event_filter( + self, response: gaa_subproperty_event_filter.SubpropertyEventFilter + ) -> gaa_subproperty_event_filter.SubpropertyEventFilter: + """Post-rpc interceptor for create_subproperty_event_filter Override in a subclass to manipulate the response after it is returned by the AnalyticsAdminService server but before @@ -1998,6 +1972,20 @@ def post_delete_property(self, response: resources.Property) -> resources.Proper """ return response + def pre_delete_rollup_property_source_link( + self, + request: analytics_admin.DeleteRollupPropertySourceLinkRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + analytics_admin.DeleteRollupPropertySourceLinkRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for delete_rollup_property_source_link + + Override in a subclass to manipulate the request or metadata + before they are sent to the AnalyticsAdminService server. + """ + return request, metadata + def pre_delete_search_ads360_link( self, request: analytics_admin.DeleteSearchAds360LinkRequest, @@ -2027,12 +2015,14 @@ def pre_delete_sk_ad_network_conversion_value_schema( """ return request, metadata - def pre_delete_user_link( + def pre_delete_subproperty_event_filter( self, - request: analytics_admin.DeleteUserLinkRequest, + request: analytics_admin.DeleteSubpropertyEventFilterRequest, metadata: Sequence[Tuple[str, str]], - ) -> Tuple[analytics_admin.DeleteUserLinkRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for delete_user_link + ) -> Tuple[ + analytics_admin.DeleteSubpropertyEventFilterRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for delete_subproperty_event_filter Override in a subclass to manipulate the request or metadata before they are sent to the AnalyticsAdminService server. @@ -2318,6 +2308,31 @@ def post_get_custom_metric( """ return response + def pre_get_data_redaction_settings( + self, + request: analytics_admin.GetDataRedactionSettingsRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + analytics_admin.GetDataRedactionSettingsRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for get_data_redaction_settings + + Override in a subclass to manipulate the request or metadata + before they are sent to the AnalyticsAdminService server. + """ + return request, metadata + + def post_get_data_redaction_settings( + self, response: resources.DataRedactionSettings + ) -> resources.DataRedactionSettings: + """Post-rpc interceptor for get_data_redaction_settings + + Override in a subclass to manipulate the response + after it is returned by the AnalyticsAdminService server but before + it is returned to user code. + """ + return response + def pre_get_data_retention_settings( self, request: analytics_admin.GetDataRetentionSettingsRequest, @@ -2608,6 +2623,31 @@ def post_get_property(self, response: resources.Property) -> resources.Property: """ return response + def pre_get_rollup_property_source_link( + self, + request: analytics_admin.GetRollupPropertySourceLinkRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + analytics_admin.GetRollupPropertySourceLinkRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for get_rollup_property_source_link + + Override in a subclass to manipulate the request or metadata + before they are sent to the AnalyticsAdminService server. + """ + return request, metadata + + def post_get_rollup_property_source_link( + self, response: resources.RollupPropertySourceLink + ) -> resources.RollupPropertySourceLink: + """Post-rpc interceptor for get_rollup_property_source_link + + Override in a subclass to manipulate the response + after it is returned by the AnalyticsAdminService server but before + it is returned to user code. + """ + return response + def pre_get_search_ads360_link( self, request: analytics_admin.GetSearchAds360LinkRequest, @@ -2657,43 +2697,22 @@ def post_get_sk_ad_network_conversion_value_schema( """ return response - def pre_get_user_link( + def pre_list_access_bindings( self, - request: analytics_admin.GetUserLinkRequest, + request: analytics_admin.ListAccessBindingsRequest, metadata: Sequence[Tuple[str, str]], - ) -> Tuple[analytics_admin.GetUserLinkRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for get_user_link + ) -> Tuple[analytics_admin.ListAccessBindingsRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for list_access_bindings Override in a subclass to manipulate the request or metadata before they are sent to the AnalyticsAdminService server. """ return request, metadata - def post_get_user_link(self, response: resources.UserLink) -> resources.UserLink: - """Post-rpc interceptor for get_user_link - - Override in a subclass to manipulate the response - after it is returned by the AnalyticsAdminService server but before - it is returned to user code. - """ - return response - - def pre_list_access_bindings( - self, - request: analytics_admin.ListAccessBindingsRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[analytics_admin.ListAccessBindingsRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for list_access_bindings - - Override in a subclass to manipulate the request or metadata - before they are sent to the AnalyticsAdminService server. - """ - return request, metadata - - def post_list_access_bindings( - self, response: analytics_admin.ListAccessBindingsResponse - ) -> analytics_admin.ListAccessBindingsResponse: - """Post-rpc interceptor for list_access_bindings + def post_list_access_bindings( + self, response: analytics_admin.ListAccessBindingsResponse + ) -> analytics_admin.ListAccessBindingsResponse: + """Post-rpc interceptor for list_access_bindings Override in a subclass to manipulate the response after it is returned by the AnalyticsAdminService server but before @@ -3147,6 +3166,31 @@ def post_list_properties( """ return response + def pre_list_rollup_property_source_links( + self, + request: analytics_admin.ListRollupPropertySourceLinksRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + analytics_admin.ListRollupPropertySourceLinksRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for list_rollup_property_source_links + + Override in a subclass to manipulate the request or metadata + before they are sent to the AnalyticsAdminService server. + """ + return request, metadata + + def post_list_rollup_property_source_links( + self, response: analytics_admin.ListRollupPropertySourceLinksResponse + ) -> analytics_admin.ListRollupPropertySourceLinksResponse: + """Post-rpc interceptor for list_rollup_property_source_links + + Override in a subclass to manipulate the response + after it is returned by the AnalyticsAdminService server but before + it is returned to user code. + """ + return response + def pre_list_search_ads360_links( self, request: analytics_admin.ListSearchAds360LinksRequest, @@ -3196,29 +3240,6 @@ def post_list_sk_ad_network_conversion_value_schemas( """ return response - def pre_list_user_links( - self, - request: analytics_admin.ListUserLinksRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[analytics_admin.ListUserLinksRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for list_user_links - - Override in a subclass to manipulate the request or metadata - before they are sent to the AnalyticsAdminService server. - """ - return request, metadata - - def post_list_user_links( - self, response: analytics_admin.ListUserLinksResponse - ) -> analytics_admin.ListUserLinksResponse: - """Post-rpc interceptor for list_user_links - - Override in a subclass to manipulate the response - after it is returned by the AnalyticsAdminService server but before - it is returned to user code. - """ - return response - def pre_provision_account_ticket( self, request: analytics_admin.ProvisionAccountTicketRequest, @@ -3502,6 +3523,31 @@ def post_update_custom_metric( """ return response + def pre_update_data_redaction_settings( + self, + request: analytics_admin.UpdateDataRedactionSettingsRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[ + analytics_admin.UpdateDataRedactionSettingsRequest, Sequence[Tuple[str, str]] + ]: + """Pre-rpc interceptor for update_data_redaction_settings + + Override in a subclass to manipulate the request or metadata + before they are sent to the AnalyticsAdminService server. + """ + return request, metadata + + def post_update_data_redaction_settings( + self, response: resources.DataRedactionSettings + ) -> resources.DataRedactionSettings: + """Post-rpc interceptor for update_data_redaction_settings + + Override in a subclass to manipulate the response + after it is returned by the AnalyticsAdminService server but before + it is returned to user code. + """ + return response + def pre_update_data_retention_settings( self, request: analytics_admin.UpdateDataRetentionSettingsRequest, @@ -3794,27 +3840,6 @@ def post_update_sk_ad_network_conversion_value_schema( """ return response - def pre_update_user_link( - self, - request: analytics_admin.UpdateUserLinkRequest, - metadata: Sequence[Tuple[str, str]], - ) -> Tuple[analytics_admin.UpdateUserLinkRequest, Sequence[Tuple[str, str]]]: - """Pre-rpc interceptor for update_user_link - - Override in a subclass to manipulate the request or metadata - before they are sent to the AnalyticsAdminService server. - """ - return request, metadata - - def post_update_user_link(self, response: resources.UserLink) -> resources.UserLink: - """Post-rpc interceptor for update_user_link - - Override in a subclass to manipulate the response - after it is returned by the AnalyticsAdminService server but before - it is returned to user code. - """ - return response - @dataclasses.dataclass class AnalyticsAdminServiceRestStub: @@ -4391,9 +4416,9 @@ def __call__( if response.status_code >= 400: raise core_exceptions.from_http_response(response) - class _AuditUserLinks(AnalyticsAdminServiceRestStub): + class _BatchCreateAccessBindings(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("AuditUserLinks") + return hash("BatchCreateAccessBindings") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -4407,47 +4432,48 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.AuditUserLinksRequest, + request: analytics_admin.BatchCreateAccessBindingsRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.AuditUserLinksResponse: - r"""Call the audit user links method over HTTP. + ) -> analytics_admin.BatchCreateAccessBindingsResponse: + r"""Call the batch create access + bindings method over HTTP. - Args: - request (~.analytics_admin.AuditUserLinksRequest): - The request object. Request message for AuditUserLinks - RPC. - 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. + Args: + request (~.analytics_admin.BatchCreateAccessBindingsRequest): + The request object. Request message for + BatchCreateAccessBindings RPC. + 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: - ~.analytics_admin.AuditUserLinksResponse: - Response message for AuditUserLinks - RPC. + Returns: + ~.analytics_admin.BatchCreateAccessBindingsResponse: + Response message for + BatchCreateAccessBindings RPC. """ http_options: List[Dict[str, str]] = [ { "method": "post", - "uri": "/v1alpha/{parent=accounts/*}/userLinks:audit", + "uri": "/v1alpha/{parent=accounts/*}/accessBindings:batchCreate", "body": "*", }, { "method": "post", - "uri": "/v1alpha/{parent=properties/*}/userLinks:audit", + "uri": "/v1alpha/{parent=properties/*}/accessBindings:batchCreate", "body": "*", }, ] - request, metadata = self._interceptor.pre_audit_user_links( + request, metadata = self._interceptor.pre_batch_create_access_bindings( request, metadata ) - pb_request = analytics_admin.AuditUserLinksRequest.pb(request) + pb_request = analytics_admin.BatchCreateAccessBindingsRequest.pb(request) transcoded_request = path_template.transcode(http_options, pb_request) # Jsonify the request body @@ -4489,16 +4515,16 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = analytics_admin.AuditUserLinksResponse() - pb_resp = analytics_admin.AuditUserLinksResponse.pb(resp) + resp = analytics_admin.BatchCreateAccessBindingsResponse() + pb_resp = analytics_admin.BatchCreateAccessBindingsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_audit_user_links(resp) + resp = self._interceptor.post_batch_create_access_bindings(resp) return resp - class _BatchCreateAccessBindings(AnalyticsAdminServiceRestStub): + class _BatchDeleteAccessBindings(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("BatchCreateAccessBindings") + return hash("BatchDeleteAccessBindings") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -4512,48 +4538,42 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.BatchCreateAccessBindingsRequest, + request: analytics_admin.BatchDeleteAccessBindingsRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchCreateAccessBindingsResponse: - r"""Call the batch create access + ): + r"""Call the batch delete access bindings method over HTTP. Args: - request (~.analytics_admin.BatchCreateAccessBindingsRequest): + request (~.analytics_admin.BatchDeleteAccessBindingsRequest): The request object. Request message for - BatchCreateAccessBindings RPC. + BatchDeleteAccessBindings RPC. 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: - ~.analytics_admin.BatchCreateAccessBindingsResponse: - Response message for - BatchCreateAccessBindings RPC. - """ http_options: List[Dict[str, str]] = [ { "method": "post", - "uri": "/v1alpha/{parent=accounts/*}/accessBindings:batchCreate", + "uri": "/v1alpha/{parent=accounts/*}/accessBindings:batchDelete", "body": "*", }, { "method": "post", - "uri": "/v1alpha/{parent=properties/*}/accessBindings:batchCreate", + "uri": "/v1alpha/{parent=properties/*}/accessBindings:batchDelete", "body": "*", }, ] - request, metadata = self._interceptor.pre_batch_create_access_bindings( + request, metadata = self._interceptor.pre_batch_delete_access_bindings( request, metadata ) - pb_request = analytics_admin.BatchCreateAccessBindingsRequest.pb(request) + pb_request = analytics_admin.BatchDeleteAccessBindingsRequest.pb(request) transcoded_request = path_template.transcode(http_options, pb_request) # Jsonify the request body @@ -4594,19 +4614,13 @@ def __call__( if response.status_code >= 400: raise core_exceptions.from_http_response(response) - # Return the response - resp = analytics_admin.BatchCreateAccessBindingsResponse() - pb_resp = analytics_admin.BatchCreateAccessBindingsResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_batch_create_access_bindings(resp) - return resp - - class _BatchCreateUserLinks(AnalyticsAdminServiceRestStub): + class _BatchGetAccessBindings(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("BatchCreateUserLinks") + return hash("BatchGetAccessBindings") - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + "names": "", + } @classmethod def _get_unset_required_fields(cls, message_dict): @@ -4618,18 +4632,18 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.BatchCreateUserLinksRequest, + request: analytics_admin.BatchGetAccessBindingsRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchCreateUserLinksResponse: - r"""Call the batch create user links method over HTTP. + ) -> analytics_admin.BatchGetAccessBindingsResponse: + r"""Call the batch get access bindings method over HTTP. Args: - request (~.analytics_admin.BatchCreateUserLinksRequest): + request (~.analytics_admin.BatchGetAccessBindingsRequest): The request object. Request message for - BatchCreateUserLinks RPC. + BatchGetAccessBindings RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -4637,37 +4651,28 @@ def __call__( sent along with the request as metadata. Returns: - ~.analytics_admin.BatchCreateUserLinksResponse: + ~.analytics_admin.BatchGetAccessBindingsResponse: Response message for - BatchCreateUserLinks RPC. + BatchGetAccessBindings RPC. """ http_options: List[Dict[str, str]] = [ { - "method": "post", - "uri": "/v1alpha/{parent=accounts/*}/userLinks:batchCreate", - "body": "*", + "method": "get", + "uri": "/v1alpha/{parent=accounts/*}/accessBindings:batchGet", }, { - "method": "post", - "uri": "/v1alpha/{parent=properties/*}/userLinks:batchCreate", - "body": "*", + "method": "get", + "uri": "/v1alpha/{parent=properties/*}/accessBindings:batchGet", }, ] - request, metadata = self._interceptor.pre_batch_create_user_links( + request, metadata = self._interceptor.pre_batch_get_access_bindings( request, metadata ) - pb_request = analytics_admin.BatchCreateUserLinksRequest.pb(request) + pb_request = analytics_admin.BatchGetAccessBindingsRequest.pb(request) transcoded_request = path_template.transcode(http_options, pb_request) - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) uri = transcoded_request["uri"] method = transcoded_request["method"] @@ -4691,7 +4696,6 @@ def __call__( timeout=timeout, headers=headers, params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, ) # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception @@ -4700,16 +4704,16 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = analytics_admin.BatchCreateUserLinksResponse() - pb_resp = analytics_admin.BatchCreateUserLinksResponse.pb(resp) + resp = analytics_admin.BatchGetAccessBindingsResponse() + pb_resp = analytics_admin.BatchGetAccessBindingsResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_batch_create_user_links(resp) + resp = self._interceptor.post_batch_get_access_bindings(resp) return resp - class _BatchDeleteAccessBindings(AnalyticsAdminServiceRestStub): + class _BatchUpdateAccessBindings(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("BatchDeleteAccessBindings") + return hash("BatchUpdateAccessBindings") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -4723,42 +4727,48 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.BatchDeleteAccessBindingsRequest, + request: analytics_admin.BatchUpdateAccessBindingsRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ): - r"""Call the batch delete access + ) -> analytics_admin.BatchUpdateAccessBindingsResponse: + r"""Call the batch update access bindings method over HTTP. Args: - request (~.analytics_admin.BatchDeleteAccessBindingsRequest): + request (~.analytics_admin.BatchUpdateAccessBindingsRequest): The request object. Request message for - BatchDeleteAccessBindings RPC. + BatchUpdateAccessBindings RPC. 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: + ~.analytics_admin.BatchUpdateAccessBindingsResponse: + Response message for + BatchUpdateAccessBindings RPC. + """ http_options: List[Dict[str, str]] = [ { "method": "post", - "uri": "/v1alpha/{parent=accounts/*}/accessBindings:batchDelete", + "uri": "/v1alpha/{parent=accounts/*}/accessBindings:batchUpdate", "body": "*", }, { "method": "post", - "uri": "/v1alpha/{parent=properties/*}/accessBindings:batchDelete", + "uri": "/v1alpha/{parent=properties/*}/accessBindings:batchUpdate", "body": "*", }, ] - request, metadata = self._interceptor.pre_batch_delete_access_bindings( + request, metadata = self._interceptor.pre_batch_update_access_bindings( request, metadata ) - pb_request = analytics_admin.BatchDeleteAccessBindingsRequest.pb(request) + pb_request = analytics_admin.BatchUpdateAccessBindingsRequest.pb(request) transcoded_request = path_template.transcode(http_options, pb_request) # Jsonify the request body @@ -4799,9 +4809,17 @@ def __call__( if response.status_code >= 400: raise core_exceptions.from_http_response(response) - class _BatchDeleteUserLinks(AnalyticsAdminServiceRestStub): + # Return the response + resp = analytics_admin.BatchUpdateAccessBindingsResponse() + pb_resp = analytics_admin.BatchUpdateAccessBindingsResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_batch_update_access_bindings(resp) + return resp + + class _CancelDisplayVideo360AdvertiserLinkProposal(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("BatchDeleteUserLinks") + return hash("CancelDisplayVideo360AdvertiserLinkProposal") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -4815,521 +4833,25 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.BatchDeleteUserLinksRequest, + request: analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ): - r"""Call the batch delete user links method over HTTP. + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Call the cancel display video360 + advertiser link proposal method over HTTP. - Args: - request (~.analytics_admin.BatchDeleteUserLinksRequest): - The request object. Request message for - BatchDeleteUserLinks RPC. - 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. - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "post", - "uri": "/v1alpha/{parent=accounts/*}/userLinks:batchDelete", - "body": "*", - }, - { - "method": "post", - "uri": "/v1alpha/{parent=properties/*}/userLinks:batchDelete", - "body": "*", - }, - ] - request, metadata = self._interceptor.pre_batch_delete_user_links( - request, metadata - ) - pb_request = analytics_admin.BatchDeleteUserLinksRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - query_params.update(self._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - class _BatchGetAccessBindings(AnalyticsAdminServiceRestStub): - def __hash__(self): - return hash("BatchGetAccessBindings") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - "names": "", - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return { - k: v - for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() - if k not in message_dict - } - - def __call__( - self, - request: analytics_admin.BatchGetAccessBindingsRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchGetAccessBindingsResponse: - r"""Call the batch get access bindings method over HTTP. - - Args: - request (~.analytics_admin.BatchGetAccessBindingsRequest): - The request object. Request message for - BatchGetAccessBindings RPC. - 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: - ~.analytics_admin.BatchGetAccessBindingsResponse: - Response message for - BatchGetAccessBindings RPC. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1alpha/{parent=accounts/*}/accessBindings:batchGet", - }, - { - "method": "get", - "uri": "/v1alpha/{parent=properties/*}/accessBindings:batchGet", - }, - ] - request, metadata = self._interceptor.pre_batch_get_access_bindings( - request, metadata - ) - pb_request = analytics_admin.BatchGetAccessBindingsRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - query_params.update(self._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = analytics_admin.BatchGetAccessBindingsResponse() - pb_resp = analytics_admin.BatchGetAccessBindingsResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_batch_get_access_bindings(resp) - return resp - - class _BatchGetUserLinks(AnalyticsAdminServiceRestStub): - def __hash__(self): - return hash("BatchGetUserLinks") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { - "names": "", - } - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return { - k: v - for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() - if k not in message_dict - } - - def __call__( - self, - request: analytics_admin.BatchGetUserLinksRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchGetUserLinksResponse: - r"""Call the batch get user links method over HTTP. - - Args: - request (~.analytics_admin.BatchGetUserLinksRequest): - The request object. Request message for BatchGetUserLinks - RPC. - 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: - ~.analytics_admin.BatchGetUserLinksResponse: - Response message for - BatchGetUserLinks RPC. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "get", - "uri": "/v1alpha/{parent=accounts/*}/userLinks:batchGet", - }, - { - "method": "get", - "uri": "/v1alpha/{parent=properties/*}/userLinks:batchGet", - }, - ] - request, metadata = self._interceptor.pre_batch_get_user_links( - request, metadata - ) - pb_request = analytics_admin.BatchGetUserLinksRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - query_params.update(self._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = analytics_admin.BatchGetUserLinksResponse() - pb_resp = analytics_admin.BatchGetUserLinksResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_batch_get_user_links(resp) - return resp - - class _BatchUpdateAccessBindings(AnalyticsAdminServiceRestStub): - def __hash__(self): - return hash("BatchUpdateAccessBindings") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return { - k: v - for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() - if k not in message_dict - } - - def __call__( - self, - request: analytics_admin.BatchUpdateAccessBindingsRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchUpdateAccessBindingsResponse: - r"""Call the batch update access - bindings method over HTTP. - - Args: - request (~.analytics_admin.BatchUpdateAccessBindingsRequest): - The request object. Request message for - BatchUpdateAccessBindings RPC. - 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: - ~.analytics_admin.BatchUpdateAccessBindingsResponse: - Response message for - BatchUpdateAccessBindings RPC. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "post", - "uri": "/v1alpha/{parent=accounts/*}/accessBindings:batchUpdate", - "body": "*", - }, - { - "method": "post", - "uri": "/v1alpha/{parent=properties/*}/accessBindings:batchUpdate", - "body": "*", - }, - ] - request, metadata = self._interceptor.pre_batch_update_access_bindings( - request, metadata - ) - pb_request = analytics_admin.BatchUpdateAccessBindingsRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - query_params.update(self._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = analytics_admin.BatchUpdateAccessBindingsResponse() - pb_resp = analytics_admin.BatchUpdateAccessBindingsResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_batch_update_access_bindings(resp) - return resp - - class _BatchUpdateUserLinks(AnalyticsAdminServiceRestStub): - def __hash__(self): - return hash("BatchUpdateUserLinks") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return { - k: v - for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() - if k not in message_dict - } - - def __call__( - self, - request: analytics_admin.BatchUpdateUserLinksRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.BatchUpdateUserLinksResponse: - r"""Call the batch update user links method over HTTP. - - Args: - request (~.analytics_admin.BatchUpdateUserLinksRequest): - The request object. Request message for - BatchUpdateUserLinks RPC. - 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: - ~.analytics_admin.BatchUpdateUserLinksResponse: - Response message for - BatchUpdateUserLinks RPC. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "post", - "uri": "/v1alpha/{parent=accounts/*}/userLinks:batchUpdate", - "body": "*", - }, - { - "method": "post", - "uri": "/v1alpha/{parent=properties/*}/userLinks:batchUpdate", - "body": "*", - }, - ] - request, metadata = self._interceptor.pre_batch_update_user_links( - request, metadata - ) - pb_request = analytics_admin.BatchUpdateUserLinksRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - query_params.update(self._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = analytics_admin.BatchUpdateUserLinksResponse() - pb_resp = analytics_admin.BatchUpdateUserLinksResponse.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_batch_update_user_links(resp) - return resp - - class _CancelDisplayVideo360AdvertiserLinkProposal(AnalyticsAdminServiceRestStub): - def __hash__(self): - return hash("CancelDisplayVideo360AdvertiserLinkProposal") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return { - k: v - for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() - if k not in message_dict - } - - def __call__( - self, - request: analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.DisplayVideo360AdvertiserLinkProposal: - r"""Call the cancel display video360 - advertiser link proposal method over HTTP. - - Args: - request (~.analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest): - The request object. Request message for - CancelDisplayVideo360AdvertiserLinkProposal - RPC. - 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. + Args: + request (~.analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest): + The request object. Request message for + CancelDisplayVideo360AdvertiserLinkProposal + RPC. + 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: ~.resources.DisplayVideo360AdvertiserLinkProposal: @@ -6951,12 +6473,216 @@ def __call__( pb_resp = resources.GoogleAdsLink.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_create_google_ads_link(resp) + resp = self._interceptor.post_create_google_ads_link(resp) + return resp + + class _CreateMeasurementProtocolSecret(AnalyticsAdminServiceRestStub): + def __hash__(self): + return hash("CreateMeasurementProtocolSecret") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: analytics_admin.CreateMeasurementProtocolSecretRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.MeasurementProtocolSecret: + r"""Call the create measurement + protocol secret method over HTTP. + + Args: + request (~.analytics_admin.CreateMeasurementProtocolSecretRequest): + The request object. Request message for + CreateMeasurementProtocolSecret RPC + 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: + ~.resources.MeasurementProtocolSecret: + A secret value used for sending hits + to Measurement Protocol. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1alpha/{parent=properties/*/dataStreams/*}/measurementProtocolSecrets", + "body": "measurement_protocol_secret", + }, + ] + ( + request, + metadata, + ) = self._interceptor.pre_create_measurement_protocol_secret( + request, metadata + ) + pb_request = analytics_admin.CreateMeasurementProtocolSecretRequest.pb( + request + ) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + query_params.update(self._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = resources.MeasurementProtocolSecret() + pb_resp = resources.MeasurementProtocolSecret.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_measurement_protocol_secret(resp) + return resp + + class _CreateProperty(AnalyticsAdminServiceRestStub): + def __hash__(self): + return hash("CreateProperty") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: analytics_admin.CreatePropertyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Property: + r"""Call the create property method over HTTP. + + Args: + request (~.analytics_admin.CreatePropertyRequest): + The request object. Request message for CreateProperty + RPC. + 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: + ~.resources.Property: + A resource message representing a + Google Analytics GA4 property. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "post", + "uri": "/v1alpha/properties", + "body": "property", + }, + ] + request, metadata = self._interceptor.pre_create_property(request, metadata) + pb_request = analytics_admin.CreatePropertyRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + query_params.update(self._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = resources.Property() + pb_resp = resources.Property.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_property(resp) return resp - class _CreateMeasurementProtocolSecret(AnalyticsAdminServiceRestStub): + class _CreateRollupProperty(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("CreateMeasurementProtocolSecret") + return hash("CreateRollupProperty") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -6970,48 +6696,42 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.CreateMeasurementProtocolSecretRequest, + request: analytics_admin.CreateRollupPropertyRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.MeasurementProtocolSecret: - r"""Call the create measurement - protocol secret method over HTTP. + ) -> analytics_admin.CreateRollupPropertyResponse: + r"""Call the create rollup property method over HTTP. - Args: - request (~.analytics_admin.CreateMeasurementProtocolSecretRequest): - The request object. Request message for - CreateMeasurementProtocolSecret RPC - 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. + Args: + request (~.analytics_admin.CreateRollupPropertyRequest): + The request object. Request message for + CreateRollupProperty RPC. + 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: - ~.resources.MeasurementProtocolSecret: - A secret value used for sending hits - to Measurement Protocol. + Returns: + ~.analytics_admin.CreateRollupPropertyResponse: + Response message for + CreateRollupProperty RPC. """ http_options: List[Dict[str, str]] = [ { "method": "post", - "uri": "/v1alpha/{parent=properties/*/dataStreams/*}/measurementProtocolSecrets", - "body": "measurement_protocol_secret", + "uri": "/v1alpha/properties:createRollupProperty", + "body": "*", }, ] - ( - request, - metadata, - ) = self._interceptor.pre_create_measurement_protocol_secret( + request, metadata = self._interceptor.pre_create_rollup_property( request, metadata ) - pb_request = analytics_admin.CreateMeasurementProtocolSecretRequest.pb( - request - ) + pb_request = analytics_admin.CreateRollupPropertyRequest.pb(request) transcoded_request = path_template.transcode(http_options, pb_request) # Jsonify the request body @@ -7053,16 +6773,16 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = resources.MeasurementProtocolSecret() - pb_resp = resources.MeasurementProtocolSecret.pb(resp) + resp = analytics_admin.CreateRollupPropertyResponse() + pb_resp = analytics_admin.CreateRollupPropertyResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_create_measurement_protocol_secret(resp) + resp = self._interceptor.post_create_rollup_property(resp) return resp - class _CreateProperty(AnalyticsAdminServiceRestStub): + class _CreateRollupPropertySourceLink(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("CreateProperty") + return hash("CreateRollupPropertySourceLink") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -7076,40 +6796,49 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.CreatePropertyRequest, + request: analytics_admin.CreateRollupPropertySourceLinkRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Property: - r"""Call the create property method over HTTP. + ) -> resources.RollupPropertySourceLink: + r"""Call the create rollup property + source link method over HTTP. - Args: - request (~.analytics_admin.CreatePropertyRequest): - The request object. Request message for CreateProperty - RPC. - 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. + Args: + request (~.analytics_admin.CreateRollupPropertySourceLinkRequest): + The request object. Request message for + CreateRollupPropertySourceLink RPC. + 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: - ~.resources.Property: - A resource message representing a - Google Analytics GA4 property. + Returns: + ~.resources.RollupPropertySourceLink: + A link that references a source + property under the parent rollup + property. """ http_options: List[Dict[str, str]] = [ { "method": "post", - "uri": "/v1alpha/properties", - "body": "property", + "uri": "/v1alpha/{parent=properties/*}/rollupPropertySourceLinks", + "body": "rollup_property_source_link", }, ] - request, metadata = self._interceptor.pre_create_property(request, metadata) - pb_request = analytics_admin.CreatePropertyRequest.pb(request) + ( + request, + metadata, + ) = self._interceptor.pre_create_rollup_property_source_link( + request, metadata + ) + pb_request = analytics_admin.CreateRollupPropertySourceLinkRequest.pb( + request + ) transcoded_request = path_template.transcode(http_options, pb_request) # Jsonify the request body @@ -7151,11 +6880,11 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = resources.Property() - pb_resp = resources.Property.pb(resp) + resp = resources.RollupPropertySourceLink() + pb_resp = resources.RollupPropertySourceLink.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_create_property(resp) + resp = self._interceptor.post_create_rollup_property_source_link(resp) return resp class _CreateSearchAds360Link(AnalyticsAdminServiceRestStub): @@ -7369,9 +7098,9 @@ def __call__( ) return resp - class _CreateUserLink(AnalyticsAdminServiceRestStub): + class _CreateSubproperty(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("CreateUserLink") + return hash("CreateSubproperty") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -7385,28 +7114,18 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.CreateUserLinkRequest, + request: analytics_admin.CreateSubpropertyRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.UserLink: - r"""Call the create user link method over HTTP. + ) -> analytics_admin.CreateSubpropertyResponse: + r"""Call the create subproperty method over HTTP. Args: - request (~.analytics_admin.CreateUserLinkRequest): - The request object. Request message for CreateUserLink + request (~.analytics_admin.CreateSubpropertyRequest): + The request object. Request message for CreateSubproperty RPC. - Users can have multiple email addresses - associated with their Google account, - and one of these email addresses is the - "primary" email address. Any of the - email addresses associated with a Google - account may be used for a new UserLink, - but the returned UserLink will always - contain the "primary" email address. As - a result, the input and output email - address for this request may differ. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -7414,29 +7133,124 @@ def __call__( sent along with the request as metadata. Returns: - ~.resources.UserLink: - A resource message representing a - user's permissions on an Account or - Property resource. + ~.analytics_admin.CreateSubpropertyResponse: + Response message for + CreateSubproperty RPC. """ http_options: List[Dict[str, str]] = [ { "method": "post", - "uri": "/v1alpha/{parent=accounts/*}/userLinks", - "body": "user_link", + "uri": "/v1alpha/properties:createSubproperty", + "body": "*", }, + ] + request, metadata = self._interceptor.pre_create_subproperty( + request, metadata + ) + pb_request = analytics_admin.CreateSubpropertyRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + query_params.update(self._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = analytics_admin.CreateSubpropertyResponse() + pb_resp = analytics_admin.CreateSubpropertyResponse.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_create_subproperty(resp) + return resp + + class _CreateSubpropertyEventFilter(AnalyticsAdminServiceRestStub): + def __hash__(self): + return hash("CreateSubpropertyEventFilter") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: analytics_admin.CreateSubpropertyEventFilterRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> gaa_subproperty_event_filter.SubpropertyEventFilter: + r"""Call the create subproperty event + filter method over HTTP. + + Args: + request (~.analytics_admin.CreateSubpropertyEventFilterRequest): + The request object. Request message for + CreateSubpropertyEventFilter RPC. + 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: + ~.gaa_subproperty_event_filter.SubpropertyEventFilter: + A resource message representing a GA4 + Subproperty event filter. + + """ + + http_options: List[Dict[str, str]] = [ { "method": "post", - "uri": "/v1alpha/{parent=properties/*}/userLinks", - "body": "user_link", + "uri": "/v1alpha/{parent=properties/*}/subpropertyEventFilters", + "body": "subproperty_event_filter", }, ] - request, metadata = self._interceptor.pre_create_user_link( + request, metadata = self._interceptor.pre_create_subproperty_event_filter( request, metadata ) - pb_request = analytics_admin.CreateUserLinkRequest.pb(request) + pb_request = analytics_admin.CreateSubpropertyEventFilterRequest.pb(request) transcoded_request = path_template.transcode(http_options, pb_request) # Jsonify the request body @@ -7478,11 +7292,11 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = resources.UserLink() - pb_resp = resources.UserLink.pb(resp) + resp = gaa_subproperty_event_filter.SubpropertyEventFilter() + pb_resp = gaa_subproperty_event_filter.SubpropertyEventFilter.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_create_user_link(resp) + resp = self._interceptor.post_create_subproperty_event_filter(resp) return resp class _DeleteAccessBinding(AnalyticsAdminServiceRestStub): @@ -8600,39 +8414,130 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.DeletePropertyRequest, + request: analytics_admin.DeletePropertyRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.Property: + r"""Call the delete property method over HTTP. + + Args: + request (~.analytics_admin.DeletePropertyRequest): + The request object. Request message for DeleteProperty + RPC. + 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: + ~.resources.Property: + A resource message representing a + Google Analytics GA4 property. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "delete", + "uri": "/v1alpha/{name=properties/*}", + }, + ] + request, metadata = self._interceptor.pre_delete_property(request, metadata) + pb_request = analytics_admin.DeletePropertyRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + query_params.update(self._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = resources.Property() + pb_resp = resources.Property.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_delete_property(resp) + return resp + + class _DeleteRollupPropertySourceLink(AnalyticsAdminServiceRestStub): + def __hash__(self): + return hash("DeleteRollupPropertySourceLink") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: analytics_admin.DeleteRollupPropertySourceLinkRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.Property: - r"""Call the delete property method over HTTP. - - Args: - request (~.analytics_admin.DeletePropertyRequest): - The request object. Request message for DeleteProperty - RPC. - 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: - ~.resources.Property: - A resource message representing a - Google Analytics GA4 property. + ): + r"""Call the delete rollup property + source link method over HTTP. + Args: + request (~.analytics_admin.DeleteRollupPropertySourceLinkRequest): + The request object. Request message for + DeleteRollupPropertySourceLink RPC. + 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. """ http_options: List[Dict[str, str]] = [ { "method": "delete", - "uri": "/v1alpha/{name=properties/*}", + "uri": "/v1alpha/{name=properties/*/rollupPropertySourceLinks/*}", }, ] - request, metadata = self._interceptor.pre_delete_property(request, metadata) - pb_request = analytics_admin.DeletePropertyRequest.pb(request) + ( + request, + metadata, + ) = self._interceptor.pre_delete_rollup_property_source_link( + request, metadata + ) + pb_request = analytics_admin.DeleteRollupPropertySourceLinkRequest.pb( + request + ) transcoded_request = path_template.transcode(http_options, pb_request) uri = transcoded_request["uri"] @@ -8665,14 +8570,6 @@ def __call__( if response.status_code >= 400: raise core_exceptions.from_http_response(response) - # Return the response - resp = resources.Property() - pb_resp = resources.Property.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_delete_property(resp) - return resp - class _DeleteSearchAds360Link(AnalyticsAdminServiceRestStub): def __hash__(self): return hash("DeleteSearchAds360Link") @@ -8836,9 +8733,9 @@ def __call__( if response.status_code >= 400: raise core_exceptions.from_http_response(response) - class _DeleteUserLink(AnalyticsAdminServiceRestStub): + class _DeleteSubpropertyEventFilter(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("DeleteUserLink") + return hash("DeleteSubpropertyEventFilter") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -8852,39 +8749,36 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.DeleteUserLinkRequest, + request: analytics_admin.DeleteSubpropertyEventFilterRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), ): - r"""Call the delete user link method over HTTP. + r"""Call the delete subproperty event + filter method over HTTP. - Args: - request (~.analytics_admin.DeleteUserLinkRequest): - The request object. Request message for DeleteUserLink - RPC. - 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. + Args: + request (~.analytics_admin.DeleteSubpropertyEventFilterRequest): + The request object. Request message for + DeleteSubpropertyEventFilter RPC. + 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. """ http_options: List[Dict[str, str]] = [ { "method": "delete", - "uri": "/v1alpha/{name=accounts/*/userLinks/*}", - }, - { - "method": "delete", - "uri": "/v1alpha/{name=properties/*/userLinks/*}", + "uri": "/v1alpha/{name=properties/*/subpropertyEventFilters/*}", }, ] - request, metadata = self._interceptor.pre_delete_user_link( + request, metadata = self._interceptor.pre_delete_subproperty_event_filter( request, metadata ) - pb_request = analytics_admin.DeleteUserLinkRequest.pb(request) + pb_request = analytics_admin.DeleteSubpropertyEventFilterRequest.pb(request) transcoded_request = path_template.transcode(http_options, pb_request) uri = transcoded_request["uri"] @@ -10028,6 +9922,99 @@ def __call__( resp = self._interceptor.post_get_custom_metric(resp) return resp + class _GetDataRedactionSettings(AnalyticsAdminServiceRestStub): + def __hash__(self): + return hash("GetDataRedactionSettings") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: analytics_admin.GetDataRedactionSettingsRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DataRedactionSettings: + r"""Call the get data redaction + settings method over HTTP. + + Args: + request (~.analytics_admin.GetDataRedactionSettingsRequest): + The request object. Request message for + GetDataRedactionSettings RPC. + 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: + ~.resources.DataRedactionSettings: + Settings for client-side data + redaction. Singleton resource under a + Web Stream. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "get", + "uri": "/v1alpha/{name=properties/*/dataStreams/*/dataRedactionSettings}", + }, + ] + request, metadata = self._interceptor.pre_get_data_redaction_settings( + request, metadata + ) + pb_request = analytics_admin.GetDataRedactionSettingsRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + query_params.update(self._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = resources.DataRedactionSettings() + pb_resp = resources.DataRedactionSettings.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_get_data_redaction_settings(resp) + return resp + class _GetDataRetentionSettings(AnalyticsAdminServiceRestStub): def __hash__(self): return hash("GetDataRetentionSettings") @@ -11163,9 +11150,9 @@ def __call__( resp = self._interceptor.post_get_property(resp) return resp - class _GetSearchAds360Link(AnalyticsAdminServiceRestStub): + class _GetRollupPropertySourceLink(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("GetSearchAds360Link") + return hash("GetRollupPropertySourceLink") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -11179,41 +11166,43 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.GetSearchAds360LinkRequest, + request: analytics_admin.GetRollupPropertySourceLinkRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SearchAds360Link: - r"""Call the get search ads360 link method over HTTP. + ) -> resources.RollupPropertySourceLink: + r"""Call the get rollup property + source link method over HTTP. - Args: - request (~.analytics_admin.GetSearchAds360LinkRequest): - The request object. Request message for - GetSearchAds360Link RPC. - 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. + Args: + request (~.analytics_admin.GetRollupPropertySourceLinkRequest): + The request object. Request message for + GetRollupPropertySourceLink RPC. + 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: - ~.resources.SearchAds360Link: - A link between a GA4 property and a - Search Ads 360 entity. + Returns: + ~.resources.RollupPropertySourceLink: + A link that references a source + property under the parent rollup + property. """ http_options: List[Dict[str, str]] = [ { "method": "get", - "uri": "/v1alpha/{name=properties/*/searchAds360Links/*}", + "uri": "/v1alpha/{name=properties/*/rollupPropertySourceLinks/*}", }, ] - request, metadata = self._interceptor.pre_get_search_ads360_link( + request, metadata = self._interceptor.pre_get_rollup_property_source_link( request, metadata ) - pb_request = analytics_admin.GetSearchAds360LinkRequest.pb(request) + pb_request = analytics_admin.GetRollupPropertySourceLinkRequest.pb(request) transcoded_request = path_template.transcode(http_options, pb_request) uri = transcoded_request["uri"] @@ -11247,16 +11236,16 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = resources.SearchAds360Link() - pb_resp = resources.SearchAds360Link.pb(resp) + resp = resources.RollupPropertySourceLink() + pb_resp = resources.RollupPropertySourceLink.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_get_search_ads360_link(resp) + resp = self._interceptor.post_get_rollup_property_source_link(resp) return resp - class _GetSKAdNetworkConversionValueSchema(AnalyticsAdminServiceRestStub): + class _GetSearchAds360Link(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("GetSKAdNetworkConversionValueSchema") + return hash("GetSearchAds360Link") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -11270,47 +11259,41 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, + request: analytics_admin.GetSearchAds360LinkRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.SKAdNetworkConversionValueSchema: - r"""Call the get sk ad network - conversion value schema method over HTTP. + ) -> resources.SearchAds360Link: + r"""Call the get search ads360 link method over HTTP. - Args: - request (~.analytics_admin.GetSKAdNetworkConversionValueSchemaRequest): - The request object. Request message for - GetSKAdNetworkConversionValueSchema RPC. - 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. + Args: + request (~.analytics_admin.GetSearchAds360LinkRequest): + The request object. Request message for + GetSearchAds360Link RPC. + 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: - ~.resources.SKAdNetworkConversionValueSchema: - SKAdNetwork conversion value schema - of an iOS stream. + Returns: + ~.resources.SearchAds360Link: + A link between a GA4 property and a + Search Ads 360 entity. """ http_options: List[Dict[str, str]] = [ { "method": "get", - "uri": "/v1alpha/{name=properties/*/dataStreams/*/sKAdNetworkConversionValueSchema/*}", + "uri": "/v1alpha/{name=properties/*/searchAds360Links/*}", }, ] - ( - request, - metadata, - ) = self._interceptor.pre_get_sk_ad_network_conversion_value_schema( + request, metadata = self._interceptor.pre_get_search_ads360_link( request, metadata ) - pb_request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest.pb( - request - ) + pb_request = analytics_admin.GetSearchAds360LinkRequest.pb(request) transcoded_request = path_template.transcode(http_options, pb_request) uri = transcoded_request["uri"] @@ -11344,18 +11327,16 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = resources.SKAdNetworkConversionValueSchema() - pb_resp = resources.SKAdNetworkConversionValueSchema.pb(resp) + resp = resources.SearchAds360Link() + pb_resp = resources.SearchAds360Link.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_get_sk_ad_network_conversion_value_schema( - resp - ) + resp = self._interceptor.post_get_search_ads360_link(resp) return resp - class _GetUserLink(AnalyticsAdminServiceRestStub): + class _GetSKAdNetworkConversionValueSchema(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("GetUserLink") + return hash("GetSKAdNetworkConversionValueSchema") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -11369,43 +11350,47 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.GetUserLinkRequest, + request: analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.UserLink: - r"""Call the get user link method over HTTP. + ) -> resources.SKAdNetworkConversionValueSchema: + r"""Call the get sk ad network + conversion value schema method over HTTP. - Args: - request (~.analytics_admin.GetUserLinkRequest): - The request object. Request message for GetUserLink RPC. - 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. + Args: + request (~.analytics_admin.GetSKAdNetworkConversionValueSchemaRequest): + The request object. Request message for + GetSKAdNetworkConversionValueSchema RPC. + 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: - ~.resources.UserLink: - A resource message representing a - user's permissions on an Account or - Property resource. + Returns: + ~.resources.SKAdNetworkConversionValueSchema: + SKAdNetwork conversion value schema + of an iOS stream. """ http_options: List[Dict[str, str]] = [ { "method": "get", - "uri": "/v1alpha/{name=accounts/*/userLinks/*}", - }, - { - "method": "get", - "uri": "/v1alpha/{name=properties/*/userLinks/*}", + "uri": "/v1alpha/{name=properties/*/dataStreams/*/sKAdNetworkConversionValueSchema/*}", }, ] - request, metadata = self._interceptor.pre_get_user_link(request, metadata) - pb_request = analytics_admin.GetUserLinkRequest.pb(request) + ( + request, + metadata, + ) = self._interceptor.pre_get_sk_ad_network_conversion_value_schema( + request, metadata + ) + pb_request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest.pb( + request + ) transcoded_request = path_template.transcode(http_options, pb_request) uri = transcoded_request["uri"] @@ -11439,11 +11424,13 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = resources.UserLink() - pb_resp = resources.UserLink.pb(resp) + resp = resources.SKAdNetworkConversionValueSchema() + pb_resp = resources.SKAdNetworkConversionValueSchema.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_get_user_link(resp) + resp = self._interceptor.post_get_sk_ad_network_conversion_value_schema( + resp + ) return resp class _ListAccessBindings(AnalyticsAdminServiceRestStub): @@ -13268,9 +13255,9 @@ def __call__( resp = self._interceptor.post_list_properties(resp) return resp - class _ListSearchAds360Links(AnalyticsAdminServiceRestStub): + class _ListRollupPropertySourceLinks(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("ListSearchAds360Links") + return hash("ListRollupPropertySourceLinks") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -13284,41 +13271,44 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.ListSearchAds360LinksRequest, + request: analytics_admin.ListRollupPropertySourceLinksRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.ListSearchAds360LinksResponse: - r"""Call the list search ads360 links method over HTTP. + ) -> analytics_admin.ListRollupPropertySourceLinksResponse: + r"""Call the list rollup property + source links method over HTTP. - Args: - request (~.analytics_admin.ListSearchAds360LinksRequest): - The request object. Request message for - ListSearchAds360Links RPC. - 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. + Args: + request (~.analytics_admin.ListRollupPropertySourceLinksRequest): + The request object. Request message for + ListRollupPropertySourceLinks RPC. + 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: - ~.analytics_admin.ListSearchAds360LinksResponse: - Response message for - ListSearchAds360Links RPC. + Returns: + ~.analytics_admin.ListRollupPropertySourceLinksResponse: + Response message for + ListRollupPropertySourceLinks RPC. """ http_options: List[Dict[str, str]] = [ { "method": "get", - "uri": "/v1alpha/{parent=properties/*}/searchAds360Links", + "uri": "/v1alpha/{parent=properties/*}/rollupPropertySourceLinks", }, ] - request, metadata = self._interceptor.pre_list_search_ads360_links( + request, metadata = self._interceptor.pre_list_rollup_property_source_links( request, metadata ) - pb_request = analytics_admin.ListSearchAds360LinksRequest.pb(request) + pb_request = analytics_admin.ListRollupPropertySourceLinksRequest.pb( + request + ) transcoded_request = path_template.transcode(http_options, pb_request) uri = transcoded_request["uri"] @@ -13352,16 +13342,16 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = analytics_admin.ListSearchAds360LinksResponse() - pb_resp = analytics_admin.ListSearchAds360LinksResponse.pb(resp) + resp = analytics_admin.ListRollupPropertySourceLinksResponse() + pb_resp = analytics_admin.ListRollupPropertySourceLinksResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_list_search_ads360_links(resp) + resp = self._interceptor.post_list_rollup_property_source_links(resp) return resp - class _ListSKAdNetworkConversionValueSchemas(AnalyticsAdminServiceRestStub): + class _ListSearchAds360Links(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("ListSKAdNetworkConversionValueSchemas") + return hash("ListSearchAds360Links") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -13375,49 +13365,41 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, + request: analytics_admin.ListSearchAds360LinksRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.ListSKAdNetworkConversionValueSchemasResponse: - r"""Call the list sk ad network - conversion value schemas method over HTTP. + ) -> analytics_admin.ListSearchAds360LinksResponse: + r"""Call the list search ads360 links method over HTTP. - Args: - request (~.analytics_admin.ListSKAdNetworkConversionValueSchemasRequest): - The request object. Request message for - ListSKAdNetworkConversionValueSchemas - RPC - 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. + Args: + request (~.analytics_admin.ListSearchAds360LinksRequest): + The request object. Request message for + ListSearchAds360Links RPC. + 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: - ~.analytics_admin.ListSKAdNetworkConversionValueSchemasResponse: - Response message for - ListSKAdNetworkConversionValueSchemas - RPC + Returns: + ~.analytics_admin.ListSearchAds360LinksResponse: + Response message for + ListSearchAds360Links RPC. """ http_options: List[Dict[str, str]] = [ { "method": "get", - "uri": "/v1alpha/{parent=properties/*/dataStreams/*}/sKAdNetworkConversionValueSchema", + "uri": "/v1alpha/{parent=properties/*}/searchAds360Links", }, ] - ( - request, - metadata, - ) = self._interceptor.pre_list_sk_ad_network_conversion_value_schemas( + request, metadata = self._interceptor.pre_list_search_ads360_links( request, metadata ) - pb_request = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasRequest.pb(request) - ) + pb_request = analytics_admin.ListSearchAds360LinksRequest.pb(request) transcoded_request = path_template.transcode(http_options, pb_request) uri = transcoded_request["uri"] @@ -13451,20 +13433,16 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() - pb_resp = analytics_admin.ListSKAdNetworkConversionValueSchemasResponse.pb( - resp - ) + resp = analytics_admin.ListSearchAds360LinksResponse() + pb_resp = analytics_admin.ListSearchAds360LinksResponse.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_list_sk_ad_network_conversion_value_schemas( - resp - ) + resp = self._interceptor.post_list_search_ads360_links(resp) return resp - class _ListUserLinks(AnalyticsAdminServiceRestStub): + class _ListSKAdNetworkConversionValueSchemas(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("ListUserLinks") + return hash("ListSKAdNetworkConversionValueSchemas") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} @@ -13478,43 +13456,49 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.ListUserLinksRequest, + request: analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> analytics_admin.ListUserLinksResponse: - r"""Call the list user links method over HTTP. + ) -> analytics_admin.ListSKAdNetworkConversionValueSchemasResponse: + r"""Call the list sk ad network + conversion value schemas method over HTTP. - Args: - request (~.analytics_admin.ListUserLinksRequest): - The request object. Request message for ListUserLinks - RPC. - 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. + Args: + request (~.analytics_admin.ListSKAdNetworkConversionValueSchemasRequest): + The request object. Request message for + ListSKAdNetworkConversionValueSchemas + RPC + 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: - ~.analytics_admin.ListUserLinksResponse: - Response message for ListUserLinks - RPC. + Returns: + ~.analytics_admin.ListSKAdNetworkConversionValueSchemasResponse: + Response message for + ListSKAdNetworkConversionValueSchemas + RPC """ http_options: List[Dict[str, str]] = [ { "method": "get", - "uri": "/v1alpha/{parent=accounts/*}/userLinks", - }, - { - "method": "get", - "uri": "/v1alpha/{parent=properties/*}/userLinks", + "uri": "/v1alpha/{parent=properties/*/dataStreams/*}/sKAdNetworkConversionValueSchema", }, ] - request, metadata = self._interceptor.pre_list_user_links(request, metadata) - pb_request = analytics_admin.ListUserLinksRequest.pb(request) + ( + request, + metadata, + ) = self._interceptor.pre_list_sk_ad_network_conversion_value_schemas( + request, metadata + ) + pb_request = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasRequest.pb(request) + ) transcoded_request = path_template.transcode(http_options, pb_request) uri = transcoded_request["uri"] @@ -13548,11 +13532,15 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = analytics_admin.ListUserLinksResponse() - pb_resp = analytics_admin.ListUserLinksResponse.pb(resp) + resp = analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() + pb_resp = analytics_admin.ListSKAdNetworkConversionValueSchemasResponse.pb( + resp + ) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_list_user_links(resp) + resp = self._interceptor.post_list_sk_ad_network_conversion_value_schemas( + resp + ) return resp class _ProvisionAccountTicket(AnalyticsAdminServiceRestStub): @@ -14589,9 +14577,109 @@ def __call__( r"""Call the update custom dimension method over HTTP. Args: - request (~.analytics_admin.UpdateCustomDimensionRequest): + request (~.analytics_admin.UpdateCustomDimensionRequest): + The request object. Request message for + UpdateCustomDimension RPC. + 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: + ~.resources.CustomDimension: + A definition for a CustomDimension. + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/v1alpha/{custom_dimension.name=properties/*/customDimensions/*}", + "body": "custom_dimension", + }, + ] + request, metadata = self._interceptor.pre_update_custom_dimension( + request, metadata + ) + pb_request = analytics_admin.UpdateCustomDimensionRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + query_params.update(self._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = resources.CustomDimension() + pb_resp = resources.CustomDimension.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_custom_dimension(resp) + return resp + + class _UpdateCustomMetric(AnalyticsAdminServiceRestStub): + def __hash__(self): + return hash("UpdateCustomMetric") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + "updateMask": {}, + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: analytics_admin.UpdateCustomMetricRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CustomMetric: + r"""Call the update custom metric method over HTTP. + + Args: + request (~.analytics_admin.UpdateCustomMetricRequest): The request object. Request message for - UpdateCustomDimension RPC. + UpdateCustomMetric RPC. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -14599,21 +14687,21 @@ def __call__( sent along with the request as metadata. Returns: - ~.resources.CustomDimension: - A definition for a CustomDimension. + ~.resources.CustomMetric: + A definition for a custom metric. """ http_options: List[Dict[str, str]] = [ { "method": "patch", - "uri": "/v1alpha/{custom_dimension.name=properties/*/customDimensions/*}", - "body": "custom_dimension", + "uri": "/v1alpha/{custom_metric.name=properties/*/customMetrics/*}", + "body": "custom_metric", }, ] - request, metadata = self._interceptor.pre_update_custom_dimension( + request, metadata = self._interceptor.pre_update_custom_metric( request, metadata ) - pb_request = analytics_admin.UpdateCustomDimensionRequest.pb(request) + pb_request = analytics_admin.UpdateCustomMetricRequest.pb(request) transcoded_request = path_template.transcode(http_options, pb_request) # Jsonify the request body @@ -14655,16 +14743,16 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = resources.CustomDimension() - pb_resp = resources.CustomDimension.pb(resp) + resp = resources.CustomMetric() + pb_resp = resources.CustomMetric.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_update_custom_dimension(resp) + resp = self._interceptor.post_update_custom_metric(resp) return resp - class _UpdateCustomMetric(AnalyticsAdminServiceRestStub): + class _UpdateDataRedactionSettings(AnalyticsAdminServiceRestStub): def __hash__(self): - return hash("UpdateCustomMetric") + return hash("UpdateDataRedactionSettings") __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { "updateMask": {}, @@ -14680,40 +14768,44 @@ def _get_unset_required_fields(cls, message_dict): def __call__( self, - request: analytics_admin.UpdateCustomMetricRequest, + request: analytics_admin.UpdateDataRedactionSettingsRequest, *, retry: OptionalRetry = gapic_v1.method.DEFAULT, timeout: Optional[float] = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomMetric: - r"""Call the update custom metric method over HTTP. + ) -> resources.DataRedactionSettings: + r"""Call the update data redaction + settings method over HTTP. - Args: - request (~.analytics_admin.UpdateCustomMetricRequest): - The request object. Request message for - UpdateCustomMetric RPC. - 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. + Args: + request (~.analytics_admin.UpdateDataRedactionSettingsRequest): + The request object. Request message for + UpdateDataRedactionSettings RPC. + 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: + ~.resources.DataRedactionSettings: + Settings for client-side data + redaction. Singleton resource under a + Web Stream. - Returns: - ~.resources.CustomMetric: - A definition for a custom metric. """ http_options: List[Dict[str, str]] = [ { "method": "patch", - "uri": "/v1alpha/{custom_metric.name=properties/*/customMetrics/*}", - "body": "custom_metric", + "uri": "/v1alpha/{data_redaction_settings.name=properties/*/dataStreams/*/dataRedactionSettings}", + "body": "data_redaction_settings", }, ] - request, metadata = self._interceptor.pre_update_custom_metric( + request, metadata = self._interceptor.pre_update_data_redaction_settings( request, metadata ) - pb_request = analytics_admin.UpdateCustomMetricRequest.pb(request) + pb_request = analytics_admin.UpdateDataRedactionSettingsRequest.pb(request) transcoded_request = path_template.transcode(http_options, pb_request) # Jsonify the request body @@ -14755,11 +14847,11 @@ def __call__( raise core_exceptions.from_http_response(response) # Return the response - resp = resources.CustomMetric() - pb_resp = resources.CustomMetric.pb(resp) + resp = resources.DataRedactionSettings() + pb_resp = resources.DataRedactionSettings.pb(resp) json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_update_custom_metric(resp) + resp = self._interceptor.post_update_data_redaction_settings(resp) return resp class _UpdateDataRetentionSettings(AnalyticsAdminServiceRestStub): @@ -16029,112 +16121,6 @@ def __call__( ) return resp - class _UpdateUserLink(AnalyticsAdminServiceRestStub): - def __hash__(self): - return hash("UpdateUserLink") - - __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = {} - - @classmethod - def _get_unset_required_fields(cls, message_dict): - return { - k: v - for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() - if k not in message_dict - } - - def __call__( - self, - request: analytics_admin.UpdateUserLinkRequest, - *, - retry: OptionalRetry = gapic_v1.method.DEFAULT, - timeout: Optional[float] = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.UserLink: - r"""Call the update user link method over HTTP. - - Args: - request (~.analytics_admin.UpdateUserLinkRequest): - The request object. Request message for UpdateUserLink - RPC. - 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: - ~.resources.UserLink: - A resource message representing a - user's permissions on an Account or - Property resource. - - """ - - http_options: List[Dict[str, str]] = [ - { - "method": "patch", - "uri": "/v1alpha/{user_link.name=accounts/*/userLinks/*}", - "body": "user_link", - }, - { - "method": "patch", - "uri": "/v1alpha/{user_link.name=properties/*/userLinks/*}", - "body": "user_link", - }, - ] - request, metadata = self._interceptor.pre_update_user_link( - request, metadata - ) - pb_request = analytics_admin.UpdateUserLinkRequest.pb(request) - transcoded_request = path_template.transcode(http_options, pb_request) - - # Jsonify the request body - - body = json_format.MessageToJson( - transcoded_request["body"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - uri = transcoded_request["uri"] - method = transcoded_request["method"] - - # Jsonify the query params - query_params = json.loads( - json_format.MessageToJson( - transcoded_request["query_params"], - including_default_value_fields=False, - use_integers_for_enums=True, - ) - ) - query_params.update(self._get_unset_required_fields(query_params)) - - query_params["$alt"] = "json;enum-encoding=int" - - # Send the request - headers = dict(metadata) - headers["Content-Type"] = "application/json" - response = getattr(self._session, method)( - "{host}{uri}".format(host=self._host, uri=uri), - timeout=timeout, - headers=headers, - params=rest_helpers.flatten_query_params(query_params, strict=True), - data=body, - ) - - # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception - # subclass. - if response.status_code >= 400: - raise core_exceptions.from_http_response(response) - - # Return the response - resp = resources.UserLink() - pb_resp = resources.UserLink.pb(resp) - - json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) - resp = self._interceptor.post_update_user_link(resp) - return resp - @property def acknowledge_user_data_collection( self, @@ -16181,16 +16167,6 @@ def archive_custom_metric( # In C++ this would require a dynamic_cast return self._ArchiveCustomMetric(self._session, self._host, self._interceptor) # type: ignore - @property - def audit_user_links( - self, - ) -> Callable[ - [analytics_admin.AuditUserLinksRequest], analytics_admin.AuditUserLinksResponse - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._AuditUserLinks(self._session, self._host, self._interceptor) # type: ignore - @property def batch_create_access_bindings( self, @@ -16202,17 +16178,6 @@ def batch_create_access_bindings( # In C++ this would require a dynamic_cast return self._BatchCreateAccessBindings(self._session, self._host, self._interceptor) # type: ignore - @property - def batch_create_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchCreateUserLinksRequest], - analytics_admin.BatchCreateUserLinksResponse, - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._BatchCreateUserLinks(self._session, self._host, self._interceptor) # type: ignore - @property def batch_delete_access_bindings( self, @@ -16221,14 +16186,6 @@ def batch_delete_access_bindings( # In C++ this would require a dynamic_cast return self._BatchDeleteAccessBindings(self._session, self._host, self._interceptor) # type: ignore - @property - def batch_delete_user_links( - self, - ) -> Callable[[analytics_admin.BatchDeleteUserLinksRequest], empty_pb2.Empty]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._BatchDeleteUserLinks(self._session, self._host, self._interceptor) # type: ignore - @property def batch_get_access_bindings( self, @@ -16240,17 +16197,6 @@ def batch_get_access_bindings( # In C++ this would require a dynamic_cast return self._BatchGetAccessBindings(self._session, self._host, self._interceptor) # type: ignore - @property - def batch_get_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchGetUserLinksRequest], - analytics_admin.BatchGetUserLinksResponse, - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._BatchGetUserLinks(self._session, self._host, self._interceptor) # type: ignore - @property def batch_update_access_bindings( self, @@ -16262,17 +16208,6 @@ def batch_update_access_bindings( # In C++ this would require a dynamic_cast return self._BatchUpdateAccessBindings(self._session, self._host, self._interceptor) # type: ignore - @property - def batch_update_user_links( - self, - ) -> Callable[ - [analytics_admin.BatchUpdateUserLinksRequest], - analytics_admin.BatchUpdateUserLinksResponse, - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._BatchUpdateUserLinks(self._session, self._host, self._interceptor) # type: ignore - @property def cancel_display_video360_advertiser_link_proposal( self, @@ -16448,6 +16383,28 @@ def create_property( # In C++ this would require a dynamic_cast return self._CreateProperty(self._session, self._host, self._interceptor) # type: ignore + @property + def create_rollup_property( + self, + ) -> Callable[ + [analytics_admin.CreateRollupPropertyRequest], + analytics_admin.CreateRollupPropertyResponse, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CreateRollupProperty(self._session, self._host, self._interceptor) # type: ignore + + @property + def create_rollup_property_source_link( + self, + ) -> Callable[ + [analytics_admin.CreateRollupPropertySourceLinkRequest], + resources.RollupPropertySourceLink, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CreateRollupPropertySourceLink(self._session, self._host, self._interceptor) # type: ignore + @property def create_search_ads360_link( self, @@ -16470,12 +16427,26 @@ def create_sk_ad_network_conversion_value_schema( return self._CreateSKAdNetworkConversionValueSchema(self._session, self._host, self._interceptor) # type: ignore @property - def create_user_link( + def create_subproperty( + self, + ) -> Callable[ + [analytics_admin.CreateSubpropertyRequest], + analytics_admin.CreateSubpropertyResponse, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._CreateSubproperty(self._session, self._host, self._interceptor) # type: ignore + + @property + def create_subproperty_event_filter( self, - ) -> Callable[[analytics_admin.CreateUserLinkRequest], resources.UserLink]: + ) -> Callable[ + [analytics_admin.CreateSubpropertyEventFilterRequest], + gaa_subproperty_event_filter.SubpropertyEventFilter, + ]: # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. # In C++ this would require a dynamic_cast - return self._CreateUserLink(self._session, self._host, self._interceptor) # type: ignore + return self._CreateSubpropertyEventFilter(self._session, self._host, self._interceptor) # type: ignore @property def delete_access_binding( @@ -16604,6 +16575,16 @@ def delete_property( # In C++ this would require a dynamic_cast return self._DeleteProperty(self._session, self._host, self._interceptor) # type: ignore + @property + def delete_rollup_property_source_link( + self, + ) -> Callable[ + [analytics_admin.DeleteRollupPropertySourceLinkRequest], empty_pb2.Empty + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._DeleteRollupPropertySourceLink(self._session, self._host, self._interceptor) # type: ignore + @property def delete_search_ads360_link( self, @@ -16623,12 +16604,14 @@ def delete_sk_ad_network_conversion_value_schema( return self._DeleteSKAdNetworkConversionValueSchema(self._session, self._host, self._interceptor) # type: ignore @property - def delete_user_link( + def delete_subproperty_event_filter( self, - ) -> Callable[[analytics_admin.DeleteUserLinkRequest], empty_pb2.Empty]: + ) -> Callable[ + [analytics_admin.DeleteSubpropertyEventFilterRequest], empty_pb2.Empty + ]: # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. # In C++ this would require a dynamic_cast - return self._DeleteUserLink(self._session, self._host, self._interceptor) # type: ignore + return self._DeleteSubpropertyEventFilter(self._session, self._host, self._interceptor) # type: ignore @property def fetch_automated_ga4_configuration_opt_out( @@ -16738,6 +16721,17 @@ def get_custom_metric( # In C++ this would require a dynamic_cast return self._GetCustomMetric(self._session, self._host, self._interceptor) # type: ignore + @property + def get_data_redaction_settings( + self, + ) -> Callable[ + [analytics_admin.GetDataRedactionSettingsRequest], + resources.DataRedactionSettings, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetDataRedactionSettings(self._session, self._host, self._interceptor) # type: ignore + @property def get_data_retention_settings( self, @@ -16859,6 +16853,17 @@ def get_property( # In C++ this would require a dynamic_cast return self._GetProperty(self._session, self._host, self._interceptor) # type: ignore + @property + def get_rollup_property_source_link( + self, + ) -> Callable[ + [analytics_admin.GetRollupPropertySourceLinkRequest], + resources.RollupPropertySourceLink, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._GetRollupPropertySourceLink(self._session, self._host, self._interceptor) # type: ignore + @property def get_search_ads360_link( self, @@ -16880,14 +16885,6 @@ def get_sk_ad_network_conversion_value_schema( # In C++ this would require a dynamic_cast return self._GetSKAdNetworkConversionValueSchema(self._session, self._host, self._interceptor) # type: ignore - @property - def get_user_link( - self, - ) -> Callable[[analytics_admin.GetUserLinkRequest], resources.UserLink]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._GetUserLink(self._session, self._host, self._interceptor) # type: ignore - @property def list_access_bindings( self, @@ -17105,6 +17102,17 @@ def list_properties( # In C++ this would require a dynamic_cast return self._ListProperties(self._session, self._host, self._interceptor) # type: ignore + @property + def list_rollup_property_source_links( + self, + ) -> Callable[ + [analytics_admin.ListRollupPropertySourceLinksRequest], + analytics_admin.ListRollupPropertySourceLinksResponse, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._ListRollupPropertySourceLinks(self._session, self._host, self._interceptor) # type: ignore + @property def list_search_ads360_links( self, @@ -17127,16 +17135,6 @@ def list_sk_ad_network_conversion_value_schemas( # In C++ this would require a dynamic_cast return self._ListSKAdNetworkConversionValueSchemas(self._session, self._host, self._interceptor) # type: ignore - @property - def list_user_links( - self, - ) -> Callable[ - [analytics_admin.ListUserLinksRequest], analytics_admin.ListUserLinksResponse - ]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._ListUserLinks(self._session, self._host, self._interceptor) # type: ignore - @property def provision_account_ticket( self, @@ -17256,6 +17254,17 @@ def update_custom_metric( # In C++ this would require a dynamic_cast return self._UpdateCustomMetric(self._session, self._host, self._interceptor) # type: ignore + @property + def update_data_redaction_settings( + self, + ) -> Callable[ + [analytics_admin.UpdateDataRedactionSettingsRequest], + resources.DataRedactionSettings, + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._UpdateDataRedactionSettings(self._session, self._host, self._interceptor) # type: ignore + @property def update_data_retention_settings( self, @@ -17380,14 +17389,6 @@ def update_sk_ad_network_conversion_value_schema( # In C++ this would require a dynamic_cast return self._UpdateSKAdNetworkConversionValueSchema(self._session, self._host, self._interceptor) # type: ignore - @property - def update_user_link( - self, - ) -> Callable[[analytics_admin.UpdateUserLinkRequest], resources.UserLink]: - # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. - # In C++ this would require a dynamic_cast - return self._UpdateUserLink(self._session, self._host, self._interceptor) # type: ignore - @property def kind(self) -> str: return "rest" diff --git a/google/analytics/admin_v1alpha/types/__init__.py b/google/analytics/admin_v1alpha/types/__init__.py index 6622dea0..c837c99d 100644 --- a/google/analytics/admin_v1alpha/types/__init__.py +++ b/google/analytics/admin_v1alpha/types/__init__.py @@ -42,22 +42,13 @@ ArchiveAudienceRequest, ArchiveCustomDimensionRequest, ArchiveCustomMetricRequest, - AuditUserLinksRequest, - AuditUserLinksResponse, BatchCreateAccessBindingsRequest, BatchCreateAccessBindingsResponse, - BatchCreateUserLinksRequest, - BatchCreateUserLinksResponse, BatchDeleteAccessBindingsRequest, - BatchDeleteUserLinksRequest, BatchGetAccessBindingsRequest, BatchGetAccessBindingsResponse, - BatchGetUserLinksRequest, - BatchGetUserLinksResponse, BatchUpdateAccessBindingsRequest, BatchUpdateAccessBindingsResponse, - BatchUpdateUserLinksRequest, - BatchUpdateUserLinksResponse, CancelDisplayVideo360AdvertiserLinkProposalRequest, CreateAccessBindingRequest, CreateAdSenseLinkRequest, @@ -77,9 +68,14 @@ CreateGoogleAdsLinkRequest, CreateMeasurementProtocolSecretRequest, CreatePropertyRequest, + CreateRollupPropertyRequest, + CreateRollupPropertyResponse, + CreateRollupPropertySourceLinkRequest, CreateSearchAds360LinkRequest, CreateSKAdNetworkConversionValueSchemaRequest, - CreateUserLinkRequest, + CreateSubpropertyEventFilterRequest, + CreateSubpropertyRequest, + CreateSubpropertyResponse, DeleteAccessBindingRequest, DeleteAccountRequest, DeleteAdSenseLinkRequest, @@ -95,9 +91,10 @@ DeleteGoogleAdsLinkRequest, DeleteMeasurementProtocolSecretRequest, DeletePropertyRequest, + DeleteRollupPropertySourceLinkRequest, DeleteSearchAds360LinkRequest, DeleteSKAdNetworkConversionValueSchemaRequest, - DeleteUserLinkRequest, + DeleteSubpropertyEventFilterRequest, FetchAutomatedGa4ConfigurationOptOutRequest, FetchAutomatedGa4ConfigurationOptOutResponse, FetchConnectedGa4PropertyRequest, @@ -112,6 +109,7 @@ GetConversionEventRequest, GetCustomDimensionRequest, GetCustomMetricRequest, + GetDataRedactionSettingsRequest, GetDataRetentionSettingsRequest, GetDataSharingSettingsRequest, GetDataStreamRequest, @@ -124,9 +122,10 @@ GetGoogleSignalsSettingsRequest, GetMeasurementProtocolSecretRequest, GetPropertyRequest, + GetRollupPropertySourceLinkRequest, GetSearchAds360LinkRequest, GetSKAdNetworkConversionValueSchemaRequest, - GetUserLinkRequest, + GetSubpropertyEventFilterRequest, ListAccessBindingsRequest, ListAccessBindingsResponse, ListAccountsRequest, @@ -167,12 +166,14 @@ ListMeasurementProtocolSecretsResponse, ListPropertiesRequest, ListPropertiesResponse, + ListRollupPropertySourceLinksRequest, + ListRollupPropertySourceLinksResponse, ListSearchAds360LinksRequest, ListSearchAds360LinksResponse, ListSKAdNetworkConversionValueSchemasRequest, ListSKAdNetworkConversionValueSchemasResponse, - ListUserLinksRequest, - ListUserLinksResponse, + ListSubpropertyEventFiltersRequest, + ListSubpropertyEventFiltersResponse, ProvisionAccountTicketRequest, ProvisionAccountTicketResponse, RunAccessReportRequest, @@ -189,6 +190,7 @@ UpdateConversionEventRequest, UpdateCustomDimensionRequest, UpdateCustomMetricRequest, + UpdateDataRedactionSettingsRequest, UpdateDataRetentionSettingsRequest, UpdateDataStreamRequest, UpdateDisplayVideo360AdvertiserLinkRequest, @@ -201,7 +203,7 @@ UpdatePropertyRequest, UpdateSearchAds360LinkRequest, UpdateSKAdNetworkConversionValueSchemaRequest, - UpdateUserLinkRequest, + UpdateSubpropertyEventFilterRequest, ) from .audience import ( Audience, @@ -237,7 +239,6 @@ ActorType, AdSenseLink, AttributionSettings, - AuditUserLink, BigQueryLink, ChangeHistoryChange, ChangeHistoryEvent, @@ -248,6 +249,7 @@ ConversionValues, CustomDimension, CustomMetric, + DataRedactionSettings, DataRetentionSettings, DataSharingSettings, DataStream, @@ -270,10 +272,17 @@ Property, PropertySummary, PropertyType, + RollupPropertySourceLink, SearchAds360Link, ServiceLevel, SKAdNetworkConversionValueSchema, - UserLink, +) +from .subproperty_event_filter import ( + SubpropertyEventFilter, + SubpropertyEventFilterClause, + SubpropertyEventFilterCondition, + SubpropertyEventFilterExpression, + SubpropertyEventFilterExpressionList, ) __all__ = ( @@ -303,22 +312,13 @@ "ArchiveAudienceRequest", "ArchiveCustomDimensionRequest", "ArchiveCustomMetricRequest", - "AuditUserLinksRequest", - "AuditUserLinksResponse", "BatchCreateAccessBindingsRequest", "BatchCreateAccessBindingsResponse", - "BatchCreateUserLinksRequest", - "BatchCreateUserLinksResponse", "BatchDeleteAccessBindingsRequest", - "BatchDeleteUserLinksRequest", "BatchGetAccessBindingsRequest", "BatchGetAccessBindingsResponse", - "BatchGetUserLinksRequest", - "BatchGetUserLinksResponse", "BatchUpdateAccessBindingsRequest", "BatchUpdateAccessBindingsResponse", - "BatchUpdateUserLinksRequest", - "BatchUpdateUserLinksResponse", "CancelDisplayVideo360AdvertiserLinkProposalRequest", "CreateAccessBindingRequest", "CreateAdSenseLinkRequest", @@ -338,9 +338,14 @@ "CreateGoogleAdsLinkRequest", "CreateMeasurementProtocolSecretRequest", "CreatePropertyRequest", + "CreateRollupPropertyRequest", + "CreateRollupPropertyResponse", + "CreateRollupPropertySourceLinkRequest", "CreateSearchAds360LinkRequest", "CreateSKAdNetworkConversionValueSchemaRequest", - "CreateUserLinkRequest", + "CreateSubpropertyEventFilterRequest", + "CreateSubpropertyRequest", + "CreateSubpropertyResponse", "DeleteAccessBindingRequest", "DeleteAccountRequest", "DeleteAdSenseLinkRequest", @@ -356,9 +361,10 @@ "DeleteGoogleAdsLinkRequest", "DeleteMeasurementProtocolSecretRequest", "DeletePropertyRequest", + "DeleteRollupPropertySourceLinkRequest", "DeleteSearchAds360LinkRequest", "DeleteSKAdNetworkConversionValueSchemaRequest", - "DeleteUserLinkRequest", + "DeleteSubpropertyEventFilterRequest", "FetchAutomatedGa4ConfigurationOptOutRequest", "FetchAutomatedGa4ConfigurationOptOutResponse", "FetchConnectedGa4PropertyRequest", @@ -373,6 +379,7 @@ "GetConversionEventRequest", "GetCustomDimensionRequest", "GetCustomMetricRequest", + "GetDataRedactionSettingsRequest", "GetDataRetentionSettingsRequest", "GetDataSharingSettingsRequest", "GetDataStreamRequest", @@ -385,9 +392,10 @@ "GetGoogleSignalsSettingsRequest", "GetMeasurementProtocolSecretRequest", "GetPropertyRequest", + "GetRollupPropertySourceLinkRequest", "GetSearchAds360LinkRequest", "GetSKAdNetworkConversionValueSchemaRequest", - "GetUserLinkRequest", + "GetSubpropertyEventFilterRequest", "ListAccessBindingsRequest", "ListAccessBindingsResponse", "ListAccountsRequest", @@ -428,12 +436,14 @@ "ListMeasurementProtocolSecretsResponse", "ListPropertiesRequest", "ListPropertiesResponse", + "ListRollupPropertySourceLinksRequest", + "ListRollupPropertySourceLinksResponse", "ListSearchAds360LinksRequest", "ListSearchAds360LinksResponse", "ListSKAdNetworkConversionValueSchemasRequest", "ListSKAdNetworkConversionValueSchemasResponse", - "ListUserLinksRequest", - "ListUserLinksResponse", + "ListSubpropertyEventFiltersRequest", + "ListSubpropertyEventFiltersResponse", "ProvisionAccountTicketRequest", "ProvisionAccountTicketResponse", "RunAccessReportRequest", @@ -450,6 +460,7 @@ "UpdateConversionEventRequest", "UpdateCustomDimensionRequest", "UpdateCustomMetricRequest", + "UpdateDataRedactionSettingsRequest", "UpdateDataRetentionSettingsRequest", "UpdateDataStreamRequest", "UpdateDisplayVideo360AdvertiserLinkRequest", @@ -462,7 +473,7 @@ "UpdatePropertyRequest", "UpdateSearchAds360LinkRequest", "UpdateSKAdNetworkConversionValueSchemaRequest", - "UpdateUserLinkRequest", + "UpdateSubpropertyEventFilterRequest", "Audience", "AudienceDimensionOrMetricFilter", "AudienceEventFilter", @@ -490,7 +501,6 @@ "AccountSummary", "AdSenseLink", "AttributionSettings", - "AuditUserLink", "BigQueryLink", "ChangeHistoryChange", "ChangeHistoryEvent", @@ -499,6 +509,7 @@ "ConversionValues", "CustomDimension", "CustomMetric", + "DataRedactionSettings", "DataRetentionSettings", "DataSharingSettings", "DataStream", @@ -515,9 +526,9 @@ "PostbackWindow", "Property", "PropertySummary", + "RollupPropertySourceLink", "SearchAds360Link", "SKAdNetworkConversionValueSchema", - "UserLink", "ActionType", "ActorType", "ChangeHistoryResourceType", @@ -529,4 +540,9 @@ "LinkProposalState", "PropertyType", "ServiceLevel", + "SubpropertyEventFilter", + "SubpropertyEventFilterClause", + "SubpropertyEventFilterCondition", + "SubpropertyEventFilterExpression", + "SubpropertyEventFilterExpressionList", ) diff --git a/google/analytics/admin_v1alpha/types/analytics_admin.py b/google/analytics/admin_v1alpha/types/analytics_admin.py index 9b15a0f6..fa730192 100644 --- a/google/analytics/admin_v1alpha/types/analytics_admin.py +++ b/google/analytics/admin_v1alpha/types/analytics_admin.py @@ -25,6 +25,9 @@ from google.analytics.admin_v1alpha.types import ( expanded_data_set as gaa_expanded_data_set, ) +from google.analytics.admin_v1alpha.types import ( + subproperty_event_filter as gaa_subproperty_event_filter, +) from google.analytics.admin_v1alpha.types import access_report from google.analytics.admin_v1alpha.types import audience as gaa_audience from google.analytics.admin_v1alpha.types import event_create_and_edit @@ -48,21 +51,6 @@ "UpdatePropertyRequest", "CreatePropertyRequest", "DeletePropertyRequest", - "GetUserLinkRequest", - "BatchGetUserLinksRequest", - "BatchGetUserLinksResponse", - "ListUserLinksRequest", - "ListUserLinksResponse", - "AuditUserLinksRequest", - "AuditUserLinksResponse", - "CreateUserLinkRequest", - "BatchCreateUserLinksRequest", - "BatchCreateUserLinksResponse", - "UpdateUserLinkRequest", - "BatchUpdateUserLinksRequest", - "BatchUpdateUserLinksResponse", - "DeleteUserLinkRequest", - "BatchDeleteUserLinksRequest", "CreateFirebaseLinkRequest", "DeleteFirebaseLinkRequest", "ListFirebaseLinksRequest", @@ -182,6 +170,8 @@ "ListBigQueryLinksResponse", "GetEnhancedMeasurementSettingsRequest", "UpdateEnhancedMeasurementSettingsRequest", + "GetDataRedactionSettingsRequest", + "UpdateDataRedactionSettingsRequest", "CreateConnectedSiteTagRequest", "CreateConnectedSiteTagResponse", "DeleteConnectedSiteTagRequest", @@ -200,6 +190,21 @@ "GetEventCreateRuleRequest", "ListEventCreateRulesRequest", "ListEventCreateRulesResponse", + "CreateRollupPropertyRequest", + "CreateRollupPropertyResponse", + "GetRollupPropertySourceLinkRequest", + "ListRollupPropertySourceLinksRequest", + "ListRollupPropertySourceLinksResponse", + "CreateRollupPropertySourceLinkRequest", + "DeleteRollupPropertySourceLinkRequest", + "CreateSubpropertyRequest", + "CreateSubpropertyResponse", + "CreateSubpropertyEventFilterRequest", + "GetSubpropertyEventFilterRequest", + "ListSubpropertyEventFiltersRequest", + "ListSubpropertyEventFiltersResponse", + "UpdateSubpropertyEventFilterRequest", + "DeleteSubpropertyEventFilterRequest", }, ) @@ -290,6 +295,20 @@ class RunAccessReportRequest(proto.Message): Analytics Property's quota. Quota is returned in `AccessQuota <#AccessQuota>`__. For account-level requests, this field must be false. + include_all_users (bool): + Optional. Determines whether to include users + who have never made an API call in the response. + If true, all users with access to the specified + property or account are included in the + response, regardless of whether they have made + an API call or not. If false, only the users who + have made an API call will be included. + expand_groups (bool): + Optional. Decides whether to return the users within user + groups. This field works only when include_all_users is set + to true. If true, it will return all users with access to + the specified property or account. If false, only the users + with direct access will be returned. """ entity: str = proto.Field( @@ -342,6 +361,14 @@ class RunAccessReportRequest(proto.Message): proto.BOOL, number=11, ) + include_all_users: bool = proto.Field( + proto.BOOL, + number=12, + ) + expand_groups: bool = proto.Field( + proto.BOOL, + number=13, + ) class RunAccessReportResponse(proto.Message): @@ -730,375 +757,6 @@ class DeletePropertyRequest(proto.Message): ) -class GetUserLinkRequest(proto.Message): - r"""Request message for GetUserLink RPC. - - Attributes: - name (str): - Required. Example format: - accounts/1234/userLinks/5678 - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class BatchGetUserLinksRequest(proto.Message): - r"""Request message for BatchGetUserLinks RPC. - - Attributes: - parent (str): - Required. The account or property that all - user links in the request are for. The parent of - all provided values for the 'names' field must - match this field. - Example format: accounts/1234 - names (MutableSequence[str]): - Required. The names of the user links to - retrieve. A maximum of 1000 user links can be - retrieved in a batch. Format: - accounts/{accountId}/userLinks/{userLinkId} - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - names: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=2, - ) - - -class BatchGetUserLinksResponse(proto.Message): - r"""Response message for BatchGetUserLinks RPC. - - Attributes: - user_links (MutableSequence[google.analytics.admin_v1alpha.types.UserLink]): - The requested user links. - """ - - user_links: MutableSequence[resources.UserLink] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.UserLink, - ) - - -class ListUserLinksRequest(proto.Message): - r"""Request message for ListUserLinks RPC. - - Attributes: - parent (str): - Required. Example format: accounts/1234 - page_size (int): - The maximum number of user links to return. - The service may return fewer than this value. If - unspecified, at most 200 user links will be - returned. The maximum value is 500; values above - 500 will be coerced to 500. - page_token (str): - A page token, received from a previous ``ListUserLinks`` - call. Provide this to retrieve the subsequent page. When - paginating, all other parameters provided to - ``ListUserLinks`` must match the call that provided the page - token. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - - -class ListUserLinksResponse(proto.Message): - r"""Response message for ListUserLinks RPC. - - Attributes: - user_links (MutableSequence[google.analytics.admin_v1alpha.types.UserLink]): - List of UserLinks. These will be ordered - stably, but in an arbitrary order. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - """ - - @property - def raw_page(self): - return self - - user_links: MutableSequence[resources.UserLink] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.UserLink, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class AuditUserLinksRequest(proto.Message): - r"""Request message for AuditUserLinks RPC. - - Attributes: - parent (str): - Required. Example format: accounts/1234 - page_size (int): - The maximum number of user links to return. - The service may return fewer than this value. If - unspecified, at most 1000 user links will be - returned. The maximum value is 5000; values - above 5000 will be coerced to 5000. - page_token (str): - A page token, received from a previous ``AuditUserLinks`` - call. Provide this to retrieve the subsequent page. When - paginating, all other parameters provided to - ``AuditUserLinks`` must match the call that provided the - page token. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - page_size: int = proto.Field( - proto.INT32, - number=2, - ) - page_token: str = proto.Field( - proto.STRING, - number=3, - ) - - -class AuditUserLinksResponse(proto.Message): - r"""Response message for AuditUserLinks RPC. - - Attributes: - user_links (MutableSequence[google.analytics.admin_v1alpha.types.AuditUserLink]): - List of AuditUserLinks. These will be ordered - stably, but in an arbitrary order. - next_page_token (str): - A token, which can be sent as ``page_token`` to retrieve the - next page. If this field is omitted, there are no subsequent - pages. - """ - - @property - def raw_page(self): - return self - - user_links: MutableSequence[resources.AuditUserLink] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.AuditUserLink, - ) - next_page_token: str = proto.Field( - proto.STRING, - number=2, - ) - - -class CreateUserLinkRequest(proto.Message): - r"""Request message for CreateUserLink RPC. - - Users can have multiple email addresses associated with their - Google account, and one of these email addresses is the - "primary" email address. Any of the email addresses associated - with a Google account may be used for a new UserLink, but the - returned UserLink will always contain the "primary" email - address. As a result, the input and output email address for - this request may differ. - - Attributes: - parent (str): - Required. Example format: accounts/1234 - notify_new_user (bool): - Optional. If set, then email the new user - notifying them that they've been granted - permissions to the resource. - user_link (google.analytics.admin_v1alpha.types.UserLink): - Required. The user link to create. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - notify_new_user: bool = proto.Field( - proto.BOOL, - number=2, - ) - user_link: resources.UserLink = proto.Field( - proto.MESSAGE, - number=3, - message=resources.UserLink, - ) - - -class BatchCreateUserLinksRequest(proto.Message): - r"""Request message for BatchCreateUserLinks RPC. - - Attributes: - parent (str): - Required. The account or property that all - user links in the request are for. This field is - required. The parent field in the - CreateUserLinkRequest messages must either be - empty or match this field. Example format: - accounts/1234 - notify_new_users (bool): - Optional. If set, then email the new users notifying them - that they've been granted permissions to the resource. - Regardless of whether this is set or not, notify_new_user - field inside each individual request is ignored. - requests (MutableSequence[google.analytics.admin_v1alpha.types.CreateUserLinkRequest]): - Required. The requests specifying the user - links to create. A maximum of 1000 user links - can be created in a batch. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - notify_new_users: bool = proto.Field( - proto.BOOL, - number=2, - ) - requests: MutableSequence["CreateUserLinkRequest"] = proto.RepeatedField( - proto.MESSAGE, - number=3, - message="CreateUserLinkRequest", - ) - - -class BatchCreateUserLinksResponse(proto.Message): - r"""Response message for BatchCreateUserLinks RPC. - - Attributes: - user_links (MutableSequence[google.analytics.admin_v1alpha.types.UserLink]): - The user links created. - """ - - user_links: MutableSequence[resources.UserLink] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.UserLink, - ) - - -class UpdateUserLinkRequest(proto.Message): - r"""Request message for UpdateUserLink RPC. - - Attributes: - user_link (google.analytics.admin_v1alpha.types.UserLink): - Required. The user link to update. - """ - - user_link: resources.UserLink = proto.Field( - proto.MESSAGE, - number=1, - message=resources.UserLink, - ) - - -class BatchUpdateUserLinksRequest(proto.Message): - r"""Request message for BatchUpdateUserLinks RPC. - - Attributes: - parent (str): - Required. The account or property that all - user links in the request are for. The parent - field in the UpdateUserLinkRequest messages must - either be empty or match this field. - Example format: accounts/1234 - requests (MutableSequence[google.analytics.admin_v1alpha.types.UpdateUserLinkRequest]): - Required. The requests specifying the user - links to update. A maximum of 1000 user links - can be updated in a batch. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - requests: MutableSequence["UpdateUserLinkRequest"] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message="UpdateUserLinkRequest", - ) - - -class BatchUpdateUserLinksResponse(proto.Message): - r"""Response message for BatchUpdateUserLinks RPC. - - Attributes: - user_links (MutableSequence[google.analytics.admin_v1alpha.types.UserLink]): - The user links updated. - """ - - user_links: MutableSequence[resources.UserLink] = proto.RepeatedField( - proto.MESSAGE, - number=1, - message=resources.UserLink, - ) - - -class DeleteUserLinkRequest(proto.Message): - r"""Request message for DeleteUserLink RPC. - - Attributes: - name (str): - Required. Example format: - accounts/1234/userLinks/5678 - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - - -class BatchDeleteUserLinksRequest(proto.Message): - r"""Request message for BatchDeleteUserLinks RPC. - - Attributes: - parent (str): - Required. The account or property that all - user links in the request are for. The parent of - all values for user link names to delete must - match this field. - Example format: accounts/1234 - requests (MutableSequence[google.analytics.admin_v1alpha.types.DeleteUserLinkRequest]): - Required. The requests specifying the user - links to update. A maximum of 1000 user links - can be updated in a batch. - """ - - parent: str = proto.Field( - proto.STRING, - number=1, - ) - requests: MutableSequence["DeleteUserLinkRequest"] = proto.RepeatedField( - proto.MESSAGE, - number=2, - message="DeleteUserLinkRequest", - ) - - class CreateFirebaseLinkRequest(proto.Message): r"""Request message for CreateFirebaseLink RPC @@ -1807,10 +1465,9 @@ class ListSKAdNetworkConversionValueSchemasRequest(proto.Message): Attributes: parent (str): - Required. Format: - properties/{property_id}/dataStreams/{dataStream}/sKAdNetworkConversionValueSchema - Example: - properties/1234/dataStreams/5678/sKAdNetworkConversionValueSchema + Required. The DataStream resource to list schemas for. + Format: properties/{property_id}/dataStreams/{dataStream} + Example: properties/1234/dataStreams/5678 page_size (int): The maximum number of resources to return. The service may return fewer than this value, @@ -3959,26 +3616,69 @@ class UpdateEnhancedMeasurementSettingsRequest(proto.Message): ) -class CreateConnectedSiteTagRequest(proto.Message): - r"""Request message for CreateConnectedSiteTag RPC. +class GetDataRedactionSettingsRequest(proto.Message): + r"""Request message for GetDataRedactionSettings RPC. Attributes: - property (str): - The Universal Analytics property to create - connected site tags for. This API does not - support GA4 properties. Format: - properties/{universalAnalyticsPropertyId} - Example: properties/1234 - connected_site_tag (google.analytics.admin_v1alpha.types.ConnectedSiteTag): - Required. The tag to add to the Universal - Analytics property + name (str): + Required. The name of the settings to lookup. Format: + properties/{property}/dataStreams/{data_stream}/dataRedactionSettings + Example: + "properties/1000/dataStreams/2000/dataRedactionSettings". """ - property: str = proto.Field( + name: str = proto.Field( proto.STRING, number=1, ) - connected_site_tag: resources.ConnectedSiteTag = proto.Field( + + +class UpdateDataRedactionSettingsRequest(proto.Message): + r"""Request message for UpdateDataRedactionSettings RPC. + + Attributes: + data_redaction_settings (google.analytics.admin_v1alpha.types.DataRedactionSettings): + Required. The settings to update. The ``name`` field is used + to identify the settings to be updated. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Field names must + be in snake case (e.g., "field_to_update"). Omitted fields + will not be updated. To replace the entire entity, use one + path with the string "*" to match all fields. + """ + + data_redaction_settings: resources.DataRedactionSettings = proto.Field( + proto.MESSAGE, + number=1, + message=resources.DataRedactionSettings, + ) + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + + +class CreateConnectedSiteTagRequest(proto.Message): + r"""Request message for CreateConnectedSiteTag RPC. + + Attributes: + property (str): + The Universal Analytics property to create + connected site tags for. This API does not + support GA4 properties. Format: + properties/{universalAnalyticsPropertyId} + Example: properties/1234 + connected_site_tag (google.analytics.admin_v1alpha.types.ConnectedSiteTag): + Required. The tag to add to the Universal + Analytics property + """ + + property: str = proto.Field( + proto.STRING, + number=1, + ) + connected_site_tag: resources.ConnectedSiteTag = proto.Field( proto.MESSAGE, number=2, message=resources.ConnectedSiteTag, @@ -4354,4 +4054,383 @@ def raw_page(self): ) +class CreateRollupPropertyRequest(proto.Message): + r"""Request message for CreateRollupProperty RPC. + + Attributes: + rollup_property (google.analytics.admin_v1alpha.types.Property): + Required. The roll-up property to create. + source_properties (MutableSequence[str]): + Optional. The resource names of properties + that will be sources to the created roll-up + property. + """ + + rollup_property: resources.Property = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Property, + ) + source_properties: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=2, + ) + + +class CreateRollupPropertyResponse(proto.Message): + r"""Response message for CreateRollupProperty RPC. + + Attributes: + rollup_property (google.analytics.admin_v1alpha.types.Property): + The created roll-up property. + rollup_property_source_links (MutableSequence[google.analytics.admin_v1alpha.types.RollupPropertySourceLink]): + The created roll-up property source links. + """ + + rollup_property: resources.Property = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Property, + ) + rollup_property_source_links: MutableSequence[ + resources.RollupPropertySourceLink + ] = proto.RepeatedField( + proto.MESSAGE, + number=2, + message=resources.RollupPropertySourceLink, + ) + + +class GetRollupPropertySourceLinkRequest(proto.Message): + r"""Request message for GetRollupPropertySourceLink RPC. + + Attributes: + name (str): + Required. The name of the roll-up property source link to + lookup. Format: + properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link_id} + Example: properties/123/rollupPropertySourceLinks/456 + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListRollupPropertySourceLinksRequest(proto.Message): + r"""Request message for ListRollupPropertySourceLinks RPC. + + Attributes: + parent (str): + Required. The name of the roll-up property to list roll-up + property source links under. Format: + properties/{property_id} Example: properties/1234 + page_size (int): + Optional. The maximum number of resources to + return. The service may return fewer than this + value, even if there are additional pages. If + unspecified, at most 50 resources will be + returned. The maximum value is 200; (higher + values will be coerced to the maximum) + page_token (str): + Optional. A page token, received from a previous + ``ListRollupPropertySourceLinks`` call. Provide this to + retrieve the subsequent page. When paginating, all other + parameters provided to ``ListRollupPropertySourceLinks`` + must match the call that provided the page token. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + + +class ListRollupPropertySourceLinksResponse(proto.Message): + r"""Response message for ListRollupPropertySourceLinks RPC. + + Attributes: + rollup_property_source_links (MutableSequence[google.analytics.admin_v1alpha.types.RollupPropertySourceLink]): + List of RollupPropertySourceLinks. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + """ + + @property + def raw_page(self): + return self + + rollup_property_source_links: MutableSequence[ + resources.RollupPropertySourceLink + ] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.RollupPropertySourceLink, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + + +class CreateRollupPropertySourceLinkRequest(proto.Message): + r"""Request message for CreateRollupPropertySourceLink RPC. + + Attributes: + parent (str): + Required. Format: properties/{property_id} Example: + properties/1234 + rollup_property_source_link (google.analytics.admin_v1alpha.types.RollupPropertySourceLink): + Required. The roll-up property source link to + create. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + rollup_property_source_link: resources.RollupPropertySourceLink = proto.Field( + proto.MESSAGE, + number=2, + message=resources.RollupPropertySourceLink, + ) + + +class DeleteRollupPropertySourceLinkRequest(proto.Message): + r"""Request message for DeleteRollupPropertySourceLink RPC. + + Attributes: + name (str): + Required. Format: + properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link_id} + Example: properties/1234/rollupPropertySourceLinks/5678 + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class CreateSubpropertyRequest(proto.Message): + r"""Request message for CreateSubproperty RPC. + + Attributes: + parent (str): + Required. The ordinary property for which to create a + subproperty. Format: properties/property_id Example: + properties/123 + subproperty (google.analytics.admin_v1alpha.types.Property): + Required. The subproperty to create. + subproperty_event_filter (google.analytics.admin_v1alpha.types.SubpropertyEventFilter): + Optional. The subproperty event filter to + create on an ordinary property. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + subproperty: resources.Property = proto.Field( + proto.MESSAGE, + number=2, + message=resources.Property, + ) + subproperty_event_filter: gaa_subproperty_event_filter.SubpropertyEventFilter = ( + proto.Field( + proto.MESSAGE, + number=3, + message=gaa_subproperty_event_filter.SubpropertyEventFilter, + ) + ) + + +class CreateSubpropertyResponse(proto.Message): + r"""Response message for CreateSubproperty RPC. + + Attributes: + subproperty (google.analytics.admin_v1alpha.types.Property): + The created subproperty. + subproperty_event_filter (google.analytics.admin_v1alpha.types.SubpropertyEventFilter): + The created subproperty event filter. + """ + + subproperty: resources.Property = proto.Field( + proto.MESSAGE, + number=1, + message=resources.Property, + ) + subproperty_event_filter: gaa_subproperty_event_filter.SubpropertyEventFilter = ( + proto.Field( + proto.MESSAGE, + number=2, + message=gaa_subproperty_event_filter.SubpropertyEventFilter, + ) + ) + + +class CreateSubpropertyEventFilterRequest(proto.Message): + r"""Request message for CreateSubpropertyEventFilter RPC. + + Attributes: + parent (str): + Required. The ordinary property for which to create a + subproperty event filter. Format: properties/property_id + Example: properties/123 + subproperty_event_filter (google.analytics.admin_v1alpha.types.SubpropertyEventFilter): + Required. The subproperty event filter to + create. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + subproperty_event_filter: gaa_subproperty_event_filter.SubpropertyEventFilter = ( + proto.Field( + proto.MESSAGE, + number=2, + message=gaa_subproperty_event_filter.SubpropertyEventFilter, + ) + ) + + +class GetSubpropertyEventFilterRequest(proto.Message): + r"""Request message for GetSubpropertyEventFilter RPC. + + Attributes: + name (str): + Required. Resource name of the subproperty event filter to + lookup. Format: + properties/property_id/subpropertyEventFilters/subproperty_event_filter + Example: properties/123/subpropertyEventFilters/456 + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class ListSubpropertyEventFiltersRequest(proto.Message): + r"""Request message for ListSubpropertyEventFilters RPC. + + Attributes: + parent (str): + Required. Resource name of the ordinary property. Format: + properties/property_id Example: properties/123 + page_size (int): + Optional. The maximum number of resources to + return. The service may return fewer than this + value, even if there are additional pages. If + unspecified, at most 50 resources will be + returned. The maximum value is 200; (higher + values will be coerced to the maximum) + page_token (str): + Optional. A page token, received from a previous + ``ListSubpropertyEventFilters`` call. Provide this to + retrieve the subsequent page. When paginating, all other + parameters provided to ``ListSubpropertyEventFilters`` must + match the call that provided the page token. + """ + + parent: str = proto.Field( + proto.STRING, + number=1, + ) + page_size: int = proto.Field( + proto.INT32, + number=2, + ) + page_token: str = proto.Field( + proto.STRING, + number=3, + ) + + +class ListSubpropertyEventFiltersResponse(proto.Message): + r"""Response message for ListSubpropertyEventFilter RPC. + + Attributes: + subproperty_event_filters (MutableSequence[google.analytics.admin_v1alpha.types.SubpropertyEventFilter]): + List of subproperty event filters. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + """ + + @property + def raw_page(self): + return self + + subproperty_event_filters: MutableSequence[ + gaa_subproperty_event_filter.SubpropertyEventFilter + ] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=gaa_subproperty_event_filter.SubpropertyEventFilter, + ) + next_page_token: str = proto.Field( + proto.STRING, + number=2, + ) + + +class UpdateSubpropertyEventFilterRequest(proto.Message): + r"""Request message for UpdateSubpropertyEventFilter RPC. + + Attributes: + subproperty_event_filter (google.analytics.admin_v1alpha.types.SubpropertyEventFilter): + Required. The subproperty event filter to + update. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to update. Field names must be + in snake case (for example, "field_to_update"). Omitted + fields will not be updated. To replace the entire entity, + use one path with the string "*" to match all fields. + """ + + subproperty_event_filter: gaa_subproperty_event_filter.SubpropertyEventFilter = ( + proto.Field( + proto.MESSAGE, + number=1, + message=gaa_subproperty_event_filter.SubpropertyEventFilter, + ) + ) + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + + +class DeleteSubpropertyEventFilterRequest(proto.Message): + r"""Request message for DeleteSubpropertyEventFilter RPC. + + Attributes: + name (str): + Required. Resource name of the subproperty event filter to + delete. Format: + properties/property_id/subpropertyEventFilters/subproperty_event_filter + Example: properties/123/subpropertyEventFilters/456 + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/analytics/admin_v1alpha/types/resources.py b/google/analytics/admin_v1alpha/types/resources.py index d77de83f..6c4f8194 100644 --- a/google/analytics/admin_v1alpha/types/resources.py +++ b/google/analytics/admin_v1alpha/types/resources.py @@ -45,8 +45,6 @@ "Account", "Property", "DataStream", - "UserLink", - "AuditUserLink", "FirebaseLink", "GlobalSiteTag", "GoogleAdsLink", @@ -74,7 +72,9 @@ "BigQueryLink", "EnhancedMeasurementSettings", "ConnectedSiteTag", + "DataRedactionSettings", "AdSenseLink", + "RollupPropertySourceLink", }, ) @@ -269,6 +269,8 @@ class ChangeHistoryResourceType(proto.Enum): ChannelGroup resource ENHANCED_MEASUREMENT_SETTINGS (24): EnhancedMeasurementSettings resource + DATA_REDACTION_SETTINGS (25): + DataRedactionSettings resource SKADNETWORK_CONVERSION_VALUE_SCHEMA (26): SKAdNetworkConversionValueSchema resource ADSENSE_LINK (27): @@ -297,6 +299,7 @@ class ChangeHistoryResourceType(proto.Enum): EXPANDED_DATA_SET = 21 CHANNEL_GROUP = 22 ENHANCED_MEASUREMENT_SETTINGS = 24 + DATA_REDACTION_SETTINGS = 25 SKADNETWORK_CONVERSION_VALUE_SCHEMA = 26 ADSENSE_LINK = 27 AUDIENCE = 28 @@ -509,8 +512,7 @@ class Property(proto.Message): Immutable. The property type for this Property resource. When creating a property, if the type is "PROPERTY_TYPE_UNSPECIFIED", then "ORDINARY_PROPERTY" will - be implied. "SUBPROPERTY" and "ROLLUP_PROPERTY" types cannot - yet be created with the Google Analytics Admin API. + be implied. create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time when the entity was originally created. @@ -811,89 +813,6 @@ class IosAppStreamData(proto.Message): ) -class UserLink(proto.Message): - r"""A resource message representing a user's permissions on an - Account or Property resource. - - Attributes: - name (str): - Output only. Example format: - properties/1234/userLinks/5678 - email_address (str): - Immutable. Email address of the user to link - direct_roles (MutableSequence[str]): - Roles directly assigned to this user for this account or - property. - - Valid values: predefinedRoles/viewer predefinedRoles/analyst - predefinedRoles/editor predefinedRoles/admin - predefinedRoles/no-cost-data predefinedRoles/no-revenue-data - - Excludes roles that are inherited from a higher-level - entity, group, or organization admin role. - - A UserLink that is updated to have an empty list of - direct_roles will be deleted. - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - email_address: str = proto.Field( - proto.STRING, - number=2, - ) - direct_roles: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - - -class AuditUserLink(proto.Message): - r"""Read-only resource used to summarize a principal's effective - roles. - - Attributes: - name (str): - Example format: - properties/1234/userLinks/5678 - email_address (str): - Email address of the linked user - direct_roles (MutableSequence[str]): - Roles directly assigned to this user for this - entity. - Format: predefinedRoles/viewer - - Excludes roles that are inherited from an - account (if this is for a property), group, or - organization admin role. - effective_roles (MutableSequence[str]): - Union of all permissions a user has at this - account or property (includes direct - permissions, group-inherited permissions, etc.). - - Format: predefinedRoles/viewer - """ - - name: str = proto.Field( - proto.STRING, - number=1, - ) - email_address: str = proto.Field( - proto.STRING, - number=2, - ) - direct_roles: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=3, - ) - effective_roles: MutableSequence[str] = proto.RepeatedField( - proto.STRING, - number=4, - ) - - class FirebaseLink(proto.Message): r"""A link between a GA4 property and a Firebase project. @@ -1623,6 +1542,11 @@ class ChangeHistoryResource(proto.Message): A snapshot of EnhancedMeasurementSettings resource in change history. + This field is a member of `oneof`_ ``resource``. + data_redaction_settings (google.analytics.admin_v1alpha.types.DataRedactionSettings): + A snapshot of DataRedactionSettings resource + in change history. + This field is a member of `oneof`_ ``resource``. skadnetwork_conversion_value_schema (google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema): A snapshot of @@ -1763,6 +1687,12 @@ class ChangeHistoryResource(proto.Message): oneof="resource", message="EnhancedMeasurementSettings", ) + data_redaction_settings: "DataRedactionSettings" = proto.Field( + proto.MESSAGE, + number=25, + oneof="resource", + message="DataRedactionSettings", + ) skadnetwork_conversion_value_schema: "SKAdNetworkConversionValueSchema" = ( proto.Field( proto.MESSAGE, @@ -2933,6 +2863,57 @@ class ConnectedSiteTag(proto.Message): ) +class DataRedactionSettings(proto.Message): + r"""Settings for client-side data redaction. Singleton resource + under a Web Stream. + + Attributes: + name (str): + Output only. Name of this Data Redaction Settings resource. + Format: + properties/{property_id}/dataStreams/{data_stream}/dataRedactionSettings + Example: + "properties/1000/dataStreams/2000/dataRedactionSettings". + email_redaction_enabled (bool): + If enabled, any event parameter or user + property values that look like an email will be + redacted. + query_parameter_redaction_enabled (bool): + Query Parameter redaction removes the key and value portions + of a query parameter if it is in the configured set of query + parameters. + + If enabled, URL query replacement logic will be run for the + Stream. Any query parameters defined in query_parameter_keys + will be redacted. + query_parameter_keys (MutableSequence[str]): + The query parameter keys to apply redaction logic to if + present in the URL. Query parameter matching is + case-insensitive. + + Must contain at least one element if + query_parameter_replacement_enabled is true. Keys cannot + contain commas. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + email_redaction_enabled: bool = proto.Field( + proto.BOOL, + number=2, + ) + query_parameter_redaction_enabled: bool = proto.Field( + proto.BOOL, + number=3, + ) + query_parameter_keys: MutableSequence[str] = proto.RepeatedField( + proto.STRING, + number=4, + ) + + class AdSenseLink(proto.Message): r"""A link between a GA4 Property and an AdSense for Content ad client. @@ -2959,4 +2940,29 @@ class AdSenseLink(proto.Message): ) +class RollupPropertySourceLink(proto.Message): + r"""A link that references a source property under the parent + rollup property. + + Attributes: + name (str): + Output only. Resource name of this RollupPropertySourceLink. + Format: + 'properties/{property_id}/rollupPropertySourceLinks/{rollup_property_source_link}' + Format: 'properties/123/rollupPropertySourceLinks/456' + source_property (str): + Immutable. Resource name of the source property. Format: + properties/{property_id} Example: "properties/789". + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + source_property: str = proto.Field( + proto.STRING, + number=2, + ) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/analytics/admin_v1alpha/types/subproperty_event_filter.py b/google/analytics/admin_v1alpha/types/subproperty_event_filter.py new file mode 100644 index 00000000..7b735c45 --- /dev/null +++ b/google/analytics/admin_v1alpha/types/subproperty_event_filter.py @@ -0,0 +1,292 @@ +# -*- coding: utf-8 -*- +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +from __future__ import annotations + +from typing import MutableMapping, MutableSequence + +import proto # type: ignore + +__protobuf__ = proto.module( + package="google.analytics.admin.v1alpha", + manifest={ + "SubpropertyEventFilterCondition", + "SubpropertyEventFilterExpression", + "SubpropertyEventFilterExpressionList", + "SubpropertyEventFilterClause", + "SubpropertyEventFilter", + }, +) + + +class SubpropertyEventFilterCondition(proto.Message): + r"""A specific filter expression + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + null_filter (bool): + A filter for null values. + + This field is a member of `oneof`_ ``one_filter``. + string_filter (google.analytics.admin_v1alpha.types.SubpropertyEventFilterCondition.StringFilter): + A filter for a string-type dimension that + matches a particular pattern. + + This field is a member of `oneof`_ ``one_filter``. + field_name (str): + Required. The field that is being filtered. + """ + + class StringFilter(proto.Message): + r"""A filter for a string-type dimension that matches a + particular pattern. + + Attributes: + match_type (google.analytics.admin_v1alpha.types.SubpropertyEventFilterCondition.StringFilter.MatchType): + Required. The match type for the string + filter. + value (str): + Required. The string value used for the + matching. + case_sensitive (bool): + Optional. If true, the string value is case + sensitive. If false, the match is + case-insensitive. + """ + + class MatchType(proto.Enum): + r"""How the filter will be used to determine a match. + + Values: + MATCH_TYPE_UNSPECIFIED (0): + Match type unknown or not specified. + EXACT (1): + Exact match of the string value. + BEGINS_WITH (2): + Begins with the string value. + ENDS_WITH (3): + Ends with the string value. + CONTAINS (4): + Contains the string value. + FULL_REGEXP (5): + Full regular expression matches with the + string value. + PARTIAL_REGEXP (6): + Partial regular expression matches with the + string value. + """ + MATCH_TYPE_UNSPECIFIED = 0 + EXACT = 1 + BEGINS_WITH = 2 + ENDS_WITH = 3 + CONTAINS = 4 + FULL_REGEXP = 5 + PARTIAL_REGEXP = 6 + + match_type: "SubpropertyEventFilterCondition.StringFilter.MatchType" = ( + proto.Field( + proto.ENUM, + number=1, + enum="SubpropertyEventFilterCondition.StringFilter.MatchType", + ) + ) + value: str = proto.Field( + proto.STRING, + number=2, + ) + case_sensitive: bool = proto.Field( + proto.BOOL, + number=3, + ) + + null_filter: bool = proto.Field( + proto.BOOL, + number=2, + oneof="one_filter", + ) + string_filter: StringFilter = proto.Field( + proto.MESSAGE, + number=3, + oneof="one_filter", + message=StringFilter, + ) + field_name: str = proto.Field( + proto.STRING, + number=1, + ) + + +class SubpropertyEventFilterExpression(proto.Message): + r"""A logical expression of Subproperty event filters. + + This message has `oneof`_ fields (mutually exclusive fields). + For each oneof, at most one member field can be set at the same time. + Setting any member of the oneof automatically clears all other + members. + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + or_group (google.analytics.admin_v1alpha.types.SubpropertyEventFilterExpressionList): + A list of expressions to OR’ed together. Must only contain + not_expression or filter_condition expressions. + + This field is a member of `oneof`_ ``expr``. + not_expression (google.analytics.admin_v1alpha.types.SubpropertyEventFilterExpression): + A filter expression to be NOT'ed (inverted, + complemented). It can only include a filter. + This cannot be set on the top level + SubpropertyEventFilterExpression. + + This field is a member of `oneof`_ ``expr``. + filter_condition (google.analytics.admin_v1alpha.types.SubpropertyEventFilterCondition): + Creates a filter that matches a specific + event. This cannot be set on the top level + SubpropertyEventFilterExpression. + + This field is a member of `oneof`_ ``expr``. + """ + + or_group: "SubpropertyEventFilterExpressionList" = proto.Field( + proto.MESSAGE, + number=1, + oneof="expr", + message="SubpropertyEventFilterExpressionList", + ) + not_expression: "SubpropertyEventFilterExpression" = proto.Field( + proto.MESSAGE, + number=2, + oneof="expr", + message="SubpropertyEventFilterExpression", + ) + filter_condition: "SubpropertyEventFilterCondition" = proto.Field( + proto.MESSAGE, + number=3, + oneof="expr", + message="SubpropertyEventFilterCondition", + ) + + +class SubpropertyEventFilterExpressionList(proto.Message): + r"""A list of Subproperty event filter expressions. + + Attributes: + filter_expressions (MutableSequence[google.analytics.admin_v1alpha.types.SubpropertyEventFilterExpression]): + Required. Unordered list. A list of + Subproperty event filter expressions + """ + + filter_expressions: MutableSequence[ + "SubpropertyEventFilterExpression" + ] = proto.RepeatedField( + proto.MESSAGE, + number=1, + message="SubpropertyEventFilterExpression", + ) + + +class SubpropertyEventFilterClause(proto.Message): + r"""A clause for defining a filter. A filter may be inclusive + (events satisfying the filter clause are included in the + subproperty's data) or exclusive (events satisfying the filter + clause are excluded from the subproperty's data). + + Attributes: + filter_clause_type (google.analytics.admin_v1alpha.types.SubpropertyEventFilterClause.FilterClauseType): + Required. The type for the filter clause. + filter_expression (google.analytics.admin_v1alpha.types.SubpropertyEventFilterExpression): + Required. The logical expression for what + events are sent to the subproperty. + """ + + class FilterClauseType(proto.Enum): + r"""Specifies whether this is an include or exclude filter + clause. + + Values: + FILTER_CLAUSE_TYPE_UNSPECIFIED (0): + Filter clause type unknown or not specified. + INCLUDE (1): + Events will be included in the Sub property + if the filter clause is met. + EXCLUDE (2): + Events will be excluded from the Sub property + if the filter clause is met. + """ + FILTER_CLAUSE_TYPE_UNSPECIFIED = 0 + INCLUDE = 1 + EXCLUDE = 2 + + filter_clause_type: FilterClauseType = proto.Field( + proto.ENUM, + number=1, + enum=FilterClauseType, + ) + filter_expression: "SubpropertyEventFilterExpression" = proto.Field( + proto.MESSAGE, + number=2, + message="SubpropertyEventFilterExpression", + ) + + +class SubpropertyEventFilter(proto.Message): + r"""A resource message representing a GA4 Subproperty event + filter. + + + .. _oneof: https://proto-plus-python.readthedocs.io/en/stable/fields.html#oneofs-mutually-exclusive-fields + + Attributes: + name (str): + Output only. Format: + properties/{ordinary_property_id}/subpropertyEventFilters/{sub_property_event_filter} + Example: properties/1234/subpropertyEventFilters/5678 + apply_to_property (str): + Immutable. Resource name of the Subproperty + that uses this filter. + + This field is a member of `oneof`_ ``_apply_to_property``. + filter_clauses (MutableSequence[google.analytics.admin_v1alpha.types.SubpropertyEventFilterClause]): + Required. Unordered list. Filter clauses that + define the SubpropertyEventFilter. All clauses + are AND'ed together to determine what data is + sent to the subproperty. + """ + + name: str = proto.Field( + proto.STRING, + number=1, + ) + apply_to_property: str = proto.Field( + proto.STRING, + number=2, + optional=True, + ) + filter_clauses: MutableSequence[ + "SubpropertyEventFilterClause" + ] = proto.RepeatedField( + proto.MESSAGE, + number=3, + message="SubpropertyEventFilterClause", + ) + + +__all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/google/analytics/admin_v1beta/gapic_version.py b/google/analytics/admin_v1beta/gapic_version.py index 2fe35b14..5552ce40 100644 --- a/google/analytics/admin_v1beta/gapic_version.py +++ b/google/analytics/admin_v1beta/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.21.0" # {x-release-please-version} +__version__ = "0.22.0" # {x-release-please-version} diff --git a/samples/account_summaries_list.py b/samples/account_summaries_list.py deleted file mode 100644 index 9efd7ca9..00000000 --- a/samples/account_summaries_list.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints summaries of -all accounts accessible by the caller. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accountSummaries/list -for more information. -""" -# [START analyticsadmin_account_summaries_list] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def list_account_summaries(transport: str = None) -> None: - """ - Prints summaries of all accounts accessible by the caller. - - Args: - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - results = client.list_account_summaries() - - print("Result:") - for account_summary in results: - print("-- Account --") - print(f"Resource name: {account_summary.name}") - print(f"Account name: {account_summary.account}") - print(f"Display name: {account_summary.display_name}") - print() - for property_summary in account_summary.property_summaries: - print("-- Property --") - print(f"Property resource name: {property_summary.property}") - print(f"Property display name: {property_summary.display_name}") - print() - - -# [END analyticsadmin_account_summaries_list] - - -if __name__ == "__main__": - list_account_summaries() diff --git a/samples/account_summaries_list_test.py b/samples/account_summaries_list_test.py deleted file mode 100644 index c132782f..00000000 --- a/samples/account_summaries_list_test.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import account_summaries_list - - -def test_account_summaries_list(capsys): - transports = ["grpc", "rest"] - for transport in transports: - account_summaries_list.list_account_summaries(transport=transport) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/accounts_delete.py b/samples/accounts_delete.py deleted file mode 100644 index 44b6aba0..00000000 --- a/samples/accounts_delete.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which deletes a Google -Analytics account. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/delete -for more information. -""" -# [START analyticsadmin_accounts_delete] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics account ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - delete_account(account_id) - - -def delete_account(account_id: str, transport: str = None): - """ - Deletes the Google Analytics account. - - Args: - account_id(str): The id of the account to be deleted. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - client.delete_account(name=f"accounts/{account_id}") - print("Account deleted") - - -# [END analyticsadmin_accounts_delete] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_delete_test.py b/samples/accounts_delete_test.py deleted file mode 100644 index 76f8dd78..00000000 --- a/samples/accounts_delete_test.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import accounts_delete - -FAKE_ACCOUNT_ID = "1" - - -def test_accounts_delete(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server. No - # account is being deleted during the test as it is not trivial to - # provision a new account for testing. - with pytest.raises(Exception, match="The caller does not have permission"): - accounts_delete.delete_account(FAKE_ACCOUNT_ID, transport=transport) diff --git a/samples/accounts_get.py b/samples/accounts_get.py deleted file mode 100644 index 221cf18a..00000000 --- a/samples/accounts_get.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints the Google -Analytics account data. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/get -for more information. -""" -# [START analyticsadmin_accounts_get] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - get_account(account_id) - - -def get_account(account_id: str, transport: str = None): - """ - Retrieves the Google Analytics account data. - Args: - account_id(str): The id of the account. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - account = client.get_account(name=f"accounts/{account_id}") - - print("Result:") - print_account(account) - - -def print_account(account: str): - """Prints account data.""" - print(f"Resource name: {account.name}") - print(f"Display name: {account.display_name}") - print(f"Region code: {account.region_code}") - print(f"Create time: {account.create_time}") - print(f"Update time: {account.update_time}") - - -# [END analyticsadmin_accounts_get] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_get_data_sharing_settings.py b/samples/accounts_get_data_sharing_settings.py deleted file mode 100644 index be43a009..00000000 --- a/samples/accounts_get_data_sharing_settings.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints the data sharing -settings on an account. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/getDataSharingSettings -for more information. -""" -# [START analyticsadmin_accounts_get_data_sharing_settings] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - get_data_sharing_settings(account_id) - - -def get_data_sharing_settings(account_id: str, transport=None): - """ - Gets data sharing settings on an account. - Args: - account_id(str): The id of the account. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - data_sharing_settings = client.get_data_sharing_settings( - name=f"accounts/{account_id}/dataSharingSettings" - ) - - print("Result:") - print(f"Resource name: {data_sharing_settings.name}") - print( - f"Sharing with Google support enabled: {data_sharing_settings.sharing_with_google_support_enabled}" - ) - print( - f"Sharing with Google assigned sales enabled: {data_sharing_settings.sharing_with_google_assigned_sales_enabled}" - ) - print( - f"Sharing with others enabled: {data_sharing_settings.sharing_with_others_enabled}" - ) - - -# [END analyticsadmin_accounts_get_data_sharing_settings] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_get_data_sharing_settings_test.py b/samples/accounts_get_data_sharing_settings_test.py deleted file mode 100644 index 2ac0cac1..00000000 --- a/samples/accounts_get_data_sharing_settings_test.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import accounts_get_data_sharing_settings - -TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID") - - -def test_accounts_get_data_sharing_settings(capsys): - transports = ["grpc", "rest"] - for transport in transports: - accounts_get_data_sharing_settings.get_data_sharing_settings( - TEST_ACCOUNT_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/accounts_get_test.py b/samples/accounts_get_test.py deleted file mode 100644 index c982c471..00000000 --- a/samples/accounts_get_test.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import accounts_get - -TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID") - - -def test_accounts_get(capsys): - transports = ["grpc", "rest"] - for transport in transports: - accounts_get.get_account(TEST_ACCOUNT_ID, transport=transport) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/accounts_list.py b/samples/accounts_list.py deleted file mode 100644 index 87a2c5ef..00000000 --- a/samples/accounts_list.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints the Google -Analytics accounts available to the current user. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/list -for more information. -""" -# [START analyticsadmin_accounts_list] -from google.analytics.admin import AnalyticsAdminServiceClient - -from accounts_get import print_account - - -def list_accounts(transport: str = None): - """ - Lists the Google Analytics accounts available to the current user. - - Args: - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - results = client.list_accounts() - - print("Result:") - for account in results: - print_account(account) - - -# [END analyticsadmin_accounts_list] - - -if __name__ == "__main__": - list_accounts() diff --git a/samples/accounts_list_test.py b/samples/accounts_list_test.py deleted file mode 100644 index d8c2f0f4..00000000 --- a/samples/accounts_list_test.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import accounts_list - - -def test_accounts_list(capsys): - transports = ["grpc", "rest"] - for transport in transports: - accounts_list.list_accounts(transport=transport) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/accounts_provision_account_ticket.py b/samples/accounts_provision_account_ticket.py deleted file mode 100644 index 977c74cf..00000000 --- a/samples/accounts_provision_account_ticket.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which provisions the Google -Analytics account creation ticket and prints the Terms of Service link that -can be used by an end user to complete the account creation flow. - -This sample invokes the provision_account_ticket() method of the Google -Analytics Admin API to start the Google Analytics account creation -process for a user. This method returns an account ticket which shall be used -to generate the Terms Of Service url that an end user should visit in order -to accept the Terms and complete the account creation flow. - -You have to authenticate as an end user in order to run this sample. Only -the authenticated user will be able to use the Terms of Service url generated -as part of the account provisioning flow. - -To authenticate as an end user prior to running this sample, use the -gcloud tool: - - gcloud auth application-default login --scopes=https://www.googleapis.com/auth/analytics.edit --client-id-file=PATH_TO_YOUR_CLIENT_SECRET_JSON - - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/provisionAccountTicket -for more information. -""" -# [START analyticsadmin_accounts_provision_account_ticket] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import Account, ProvisionAccountTicketRequest - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics account ID from - # your production environment below. - - # TODO(developer): Replace this variable with a redirect URI where the user - # will be sent after accepting Terms of Service. Must be configured in - # Developers Console as a Redirect URI - redirect_uri = "YOUR-REDIRECT-URI" - - provision_account_ticket(redirect_uri) - - -def provision_account_ticket(redirect_uri: str, transport: str = None): - """ - Provisions the Google Analytics account creation ticket. - - Args: - redirect_uri(str): Redirect URI where the user will be sent - after accepting Terms of Service. Must be configured in - Developers Console as a Redirect URI. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - response = client.provision_account_ticket( - ProvisionAccountTicketRequest( - account=Account(display_name="Test Account", region_code="US"), - redirect_uri=redirect_uri, - ) - ) - - print("Result:") - print(f"Account ticket id: {response.account_ticket_id}") - print( - f"You can now open the following URL to complete the account creation:" - f"https://analytics.google.com/analytics/web/?provisioningSignup=false#/termsofservice/{response.account_ticket_id}" - ) - print() - print( - "Attention: make sure your browser is signed in to the same user " - "account that was used to provision the ticket." - ) - - -# [END analyticsadmin_accounts_provision_account_ticket] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_provision_account_ticket_test.py b/samples/accounts_provision_account_ticket_test.py deleted file mode 100644 index ca1f0692..00000000 --- a/samples/accounts_provision_account_ticket_test.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import accounts_provision_account_ticket - -TEST_REDIRECT_URL = "https://www.google.com" - - -def test_accounts_provision_account_ticket(capsys): - transports = ["grpc", "rest"] - for transport in transports: - accounts_provision_account_ticket.provision_account_ticket( - TEST_REDIRECT_URL, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/accounts_search_change_history_events.py b/samples/accounts_search_change_history_events.py deleted file mode 100644 index 1fb57dc8..00000000 --- a/samples/accounts_search_change_history_events.py +++ /dev/null @@ -1,129 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which displays the change -history for the Google Analytics account. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/searchChangeHistoryEvents -for more information. -""" -# [START analyticsadmin_properties_conversion_events_create] -from datetime import datetime, timedelta - -from google.analytics.admin import ( - AnalyticsAdminServiceClient, - SearchChangeHistoryEventsRequest, -) -from google.analytics.admin_v1alpha.types import ActionType, ActorType -from google.protobuf.timestamp_pb2 import Timestamp - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - search_change_history_events(account_id, property_id) - - -def search_change_history_events( - account_id: str, property_id: str, transport: str = None -): - """ - Lists the change history events for the Google Analytics 4 property - within the specified date range. - - Args: - account_id(str): The Google Analytics Account ID. - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - # Create a timestamp object and subtract 7 days from the current date/time. - earliest_change_time = Timestamp() - earliest_change_time.FromDatetime(datetime.now() - timedelta(days=7)) - - results = client.search_change_history_events( - SearchChangeHistoryEventsRequest( - account=f"accounts/{account_id}", - property=f"properties/{property_id}", - action=["CREATED", "UPDATED"], - earliest_change_time=earliest_change_time, - ) - ) - - print("Result:") - for event in results: - print(f"Event ID: {event.id}") - print(f"Change time: {event.change_time}") - print(f"Actor type: {ActorType(event.actor_type).name}") - print(f"User actor e-mail: {event.user_actor_email}") - print(f"Changes filtered: {event.changes_filtered}") - for change in event.changes: - print(" Change details") - print(f" Resource name: {change.resource}") - print(f" Action: {ActionType(change.action).name}") - print(" Resource before change: ") - print_resource(change.resource_before_change) - print(" Resource after change: ") - print_resource(change.resource_after_change) - print() - - -def print_resource(resource): - """Prints the change history resource.""" - # Detect the type of the resource by checking value of a oneof field. - if resource.property: - print(" Property resource") - elif resource.account: - print(" Account resource") - elif resource.data_stream: - print(" DataStream resource") - elif resource.firebase_link: - print(" FirebaseLink resource") - elif resource.google_ads_link: - print(" GoogleAdsLink resource") - elif resource.google_signals_settings: - print(" GoogleSignalsSettings resource") - elif resource.display_video_360_advertiser_link: - print(" DisplayVideo360AdvertiserLink resource") - elif resource.display_video_360_advertiser_link_proposal: - print(" DisplayVideo360AdvertiserLinkProposal resource") - elif resource.conversion_event: - print(" ConversionEvent resource") - elif resource.measurement_protocol_secret: - print(" MeasurementProtocolSecret resource") - elif resource.custom_dimension: - print(" CustomDimension resource") - elif resource.custom_metric: - print(" CustomMetric resource") - elif resource.data_retention_settings: - print(" DataRetentionSettings resource") - else: - print(" Resource not set") - print(f" Resource value: {resource}") - print() - - -# [END analyticsadmin_properties_conversion_events_create] - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_search_change_history_events_test.py b/samples/accounts_search_change_history_events_test.py deleted file mode 100644 index 8bc148f9..00000000 --- a/samples/accounts_search_change_history_events_test.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import accounts_search_change_history_events - -TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID") -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") - - -def test_accounts_search_change_history_events(capsys): - transports = ["grpc", "rest"] - for transport in transports: - accounts_search_change_history_events.search_change_history_events( - TEST_ACCOUNT_ID, TEST_PROPERTY_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/accounts_update.py b/samples/accounts_update.py deleted file mode 100644 index 602ff634..00000000 --- a/samples/accounts_update.py +++ /dev/null @@ -1,76 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which updates the Google -Analytics account. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts/patch -for more information. -""" -# [START analyticsadmin_accounts_update] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import Account -from google.protobuf.field_mask_pb2 import FieldMask - -from accounts_get import print_account - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics account ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - update_account(account_id) - - -def update_account(account_id: str, transport: str = None): - """ - Updates the Google Analytics account. - - Args: - account_id(str): The Google Analytics Account ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - # This call updates the display name and region code of the account, as - # indicated by the value of the `update_mask` field. - # The account to update is specified in the `name` field of the `Account` - # instance. - account = client.update_account( - account=Account( - name=f"accounts/{account_id}", - display_name="This is a test account", - region_code="US", - ), - update_mask=FieldMask(paths=["display_name", "region_code"]), - ) - - print("Result:") - print_account(account) - - -# [END analyticsadmin_accounts_update] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_update_test.py b/samples/accounts_update_test.py deleted file mode 100644 index 9481acc5..00000000 --- a/samples/accounts_update_test.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import accounts_update - -FAKE_ACCOUNT_ID = "1" - - -def test_accounts_update(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - accounts_update.update_account(FAKE_ACCOUNT_ID, transport=transport) diff --git a/samples/accounts_user_links_audit.py b/samples/accounts_user_links_audit.py deleted file mode 100644 index bc583536..00000000 --- a/samples/accounts_user_links_audit.py +++ /dev/null @@ -1,66 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints all user links on -an account. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/audit -for more information. -""" -# [START analyticsadmin_accounts_user_links_audit] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import AuditUserLinksRequest - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - audit_account_user_links(account_id) - - -def audit_account_user_links(account_id: str, transport: str = None): - """ - Lists all user links on an account, including implicit ones that come - from effective permissions granted by groups or organization admin roles. - - Args: - account_id(str): The Google Analytics Account ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - - print("Result:") - for user_link in client.audit_user_links( - AuditUserLinksRequest(parent=f"accounts/{account_id}") - ): - print(f"Resource name: {user_link.name}") - print(f"Email address: {user_link.email_address}") - for direct_role in user_link.direct_roles: - print(f"Direct role: {direct_role}") - - for effective_role in user_link.effective_roles: - print(f"Effective role: {effective_role}") - print() - - -# [END analyticsadmin_accounts_user_links_audit] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_user_links_audit_test.py b/samples/accounts_user_links_audit_test.py deleted file mode 100644 index d2724773..00000000 --- a/samples/accounts_user_links_audit_test.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import accounts_user_links_audit - -TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID") - - -def test_accounts_user_links_audit(capsys): - transports = ["grpc", "rest"] - for transport in transports: - accounts_user_links_audit.audit_account_user_links( - TEST_ACCOUNT_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/accounts_user_links_batch_create.py b/samples/accounts_user_links_batch_create.py deleted file mode 100644 index ca4d455f..00000000 --- a/samples/accounts_user_links_batch_create.py +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which creates a user link for -the account using a batch call. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/batchCreate -for more information. -""" -# [START analyticsadmin_accounts_user_links_batch_create] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import ( - BatchCreateUserLinksRequest, - CreateUserLinkRequest, - UserLink, -) - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics account ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - - # TODO(developer): Replace this variable with an email address of the user to - # link. This user will be given access to your account after running the - # sample. - email_address = "TEST-EMAIL-ADDRESS" - - batch_create_account_user_link(account_id, email_address) - - -def batch_create_account_user_link( - account_id: str, email_address: str, transport: str = None -): - """ - Creates a user link for the account using a batch call. - - Args: - account_id(str): The Google Analytics Account ID. - email_address(str): Email address of the user to link. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - response = client.batch_create_user_links( - BatchCreateUserLinksRequest( - parent=f"accounts/{account_id}", - requests=[ - CreateUserLinkRequest( - user_link=UserLink( - email_address=email_address, - direct_roles=["predefinedRoles/read"], - ) - ) - ], - notify_new_users=True, - ) - ) - - print("Result:") - for user_link in response.user_links: - print(user_link) - print() - - -# [END analyticsadmin_accounts_user_links_batch_create] - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_user_links_batch_create_test.py b/samples/accounts_user_links_batch_create_test.py deleted file mode 100644 index ea51ee23..00000000 --- a/samples/accounts_user_links_batch_create_test.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import pytest - -import accounts_user_links_batch_create - -FAKE_ACCOUNT_ID = "1" -TEST_EMAIL_ADDRESS = os.getenv("GA_TEST_EMAIL_ADDRESS") - - -def test_accounts_user_links_batch_create(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - accounts_user_links_batch_create.batch_create_account_user_link( - FAKE_ACCOUNT_ID, TEST_EMAIL_ADDRESS, transport=transport - ) diff --git a/samples/accounts_user_links_batch_delete.py b/samples/accounts_user_links_batch_delete.py deleted file mode 100644 index 0b7ba168..00000000 --- a/samples/accounts_user_links_batch_delete.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which deletes the user link -using a batch call. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/batchDelete -for more information. -""" -# [START analyticsadmin_accounts_user_links_batch_delete] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import ( - BatchDeleteUserLinksRequest, - DeleteUserLinkRequest, -) - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - - # TODO(developer): Replace this variable with your Google Analytics - # account user link ID (e.g. "123456") before running the sample. - account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID" - - batch_delete_account_user_link(account_id, account_user_link_id) - - -def batch_delete_account_user_link( - account_id: str, account_user_link_id: str, transport: str = None -): - """ - Deletes the user link using a batch call. - - Args: - account_id(str): The Google Analytics Account ID. - account_user_link_id(str): Google Analytics account user link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - client.batch_delete_user_links( - BatchDeleteUserLinksRequest( - parent=f"accounts/{account_id}", - requests=[ - DeleteUserLinkRequest( - name=f"accounts/{account_id}/userLinks/{account_user_link_id}" - ) - ], - ) - ) - print("User link deleted") - - -# [END analyticsadmin_accounts_user_links_batch_delete] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_user_links_batch_delete_test.py b/samples/accounts_user_links_batch_delete_test.py deleted file mode 100644 index e26e7bb5..00000000 --- a/samples/accounts_user_links_batch_delete_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import accounts_user_links_batch_delete - -FAKE_ACCOUNT_ID = "1" -FAKE_ACCOUNT_USER_LINK_ID = "1" - - -def test_accounts_user_links_batch_delete(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - accounts_user_links_batch_delete.batch_delete_account_user_link( - FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID, transport=transport - ) diff --git a/samples/accounts_user_links_batch_get.py b/samples/accounts_user_links_batch_get.py deleted file mode 100644 index baf989db..00000000 --- a/samples/accounts_user_links_batch_get.py +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints the details for -the account user link using a batch call. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/batchGet -for more information. -""" -# [START analyticsadmin_accounts_user_links_batch_get] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import BatchGetUserLinksRequest - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - - # TODO(developer): Replace this variable with your Google Analytics - # account user link ID (e.g. "123456") before running the sample. - account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID" - - batch_get_account_user_link(account_id, account_user_link_id) - - -def batch_get_account_user_link( - account_id: str, account_user_link_id: str, transport: str = None -): - """ - Retrieves details for the account user link using a batch call. - - Args: - account_id(str): The Google Analytics Account ID. - account_user_link_id(str): Google Analytics account user link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - response = client.batch_get_user_links( - BatchGetUserLinksRequest( - parent=f"accounts/{account_id}", - names=[f"accounts/{account_id}/userLinks/{account_user_link_id}"], - ) - ) - - print("Result:") - for user_link in response.user_links: - print(user_link) - print() - - -# [END analyticsadmin_accounts_user_links_batch_get] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_user_links_batch_get_test.py b/samples/accounts_user_links_batch_get_test.py deleted file mode 100644 index 02aa7963..00000000 --- a/samples/accounts_user_links_batch_get_test.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import accounts_user_links_batch_get - -TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID") -TEST_USER_LINK_ID = os.getenv("GA_TEST_USER_LINK_ID") - - -def test_accounts_user_links_batch_get(capsys): - transports = ["grpc", "rest"] - for transport in transports: - accounts_user_links_batch_get.batch_get_account_user_link( - TEST_ACCOUNT_ID, TEST_USER_LINK_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/accounts_user_links_batch_update.py b/samples/accounts_user_links_batch_update.py deleted file mode 100644 index 3b401fc1..00000000 --- a/samples/accounts_user_links_batch_update.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which updates the account -user link using a batch call. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/batchUpdate -for more information. -""" -# [START analyticsadmin_accounts_user_links_batch_update] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import ( - BatchUpdateUserLinksRequest, - UpdateUserLinkRequest, - UserLink, -) - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - - # TODO(developer): Replace this variable with your Google Analytics - # account user link ID (e.g. "123456") before running the sample. - account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID" - - batch_update_account_user_link(account_id, account_user_link_id) - - -def batch_update_account_user_link( - account_id: str, account_user_link_id: str, transport: str = None -): - """ - Updates the account user link using a batch call. - - Args: - account_id(str): The Google Analytics Account ID. - account_user_link_id(str): Google Analytics account user link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - # This call updates the email address and direct roles of the user link. - # The user link to update is specified in the `name` field of the `UserLink` - # instance. - response = client.batch_update_user_links( - BatchUpdateUserLinksRequest( - parent=f"accounts/{account_id}", - requests=[ - UpdateUserLinkRequest( - user_link=UserLink( - name=f"accounts/{account_id}/userLinks/{account_user_link_id}", - direct_roles=["predefinedRoles/collaborate"], - ), - ) - ], - ) - ) - - print("Result:") - for user_link in response.user_links: - print(user_link) - print() - - -# [END analyticsadmin_accounts_user_links_batch_update] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_user_links_batch_update_test.py b/samples/accounts_user_links_batch_update_test.py deleted file mode 100644 index 7fda9a6e..00000000 --- a/samples/accounts_user_links_batch_update_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import accounts_user_links_batch_update - -FAKE_ACCOUNT_ID = "1" -FAKE_ACCOUNT_USER_LINK_ID = "1" - - -def test_accounts_user_links_batch_update(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - accounts_user_links_batch_update.batch_update_account_user_link( - FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID, transport=transport - ) diff --git a/samples/accounts_user_links_create.py b/samples/accounts_user_links_create.py deleted file mode 100644 index 4b05540d..00000000 --- a/samples/accounts_user_links_create.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which creates a user link -for the account. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/create -for more information. -""" -# [START analyticsadmin_accounts_user_links_create] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import CreateUserLinkRequest, UserLink - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics account ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - - # TODO(developer): Replace this variable with an email address of the user to - # link. This user will be given access to your account after running the - # sample. - email_address = "TEST-EMAIL-ADDRESS" - - create_account_user_link(account_id, email_address) - - -def create_account_user_link( - account_id: str, email_address: str, transport: str = None -): - """ - Creates a user link for the account. - - Args: - account_id(str): The Google Analytics Account ID. - email_address(str): Email address of the user to link. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - user_link = client.create_user_link( - CreateUserLinkRequest( - parent=f"accounts/{account_id}", - user_link=UserLink( - email_address=email_address, direct_roles=["predefinedRoles/read"] - ), - notify_new_user=True, - ) - ) - - print("Result:") - print(user_link) - - -# [END analyticsadmin_accounts_user_links_create] - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_user_links_create_test.py b/samples/accounts_user_links_create_test.py deleted file mode 100644 index 720d21fd..00000000 --- a/samples/accounts_user_links_create_test.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import pytest - -import accounts_user_links_create - -FAKE_ACCOUNT_ID = "1" -TEST_EMAIL_ADDRESS = os.getenv("GA_TEST_EMAIL_ADDRESS") - - -def test_accounts_user_links_create(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - accounts_user_links_create.create_account_user_link( - FAKE_ACCOUNT_ID, TEST_EMAIL_ADDRESS, transport=transport - ) diff --git a/samples/accounts_user_links_delete.py b/samples/accounts_user_links_delete.py deleted file mode 100644 index 03dab718..00000000 --- a/samples/accounts_user_links_delete.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which deletes the user link -for the account. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/delete -for more information. -""" -# [START analyticsadmin_accounts_user_links_delete] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import DeleteUserLinkRequest - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - - # TODO(developer): Replace this variable with your Google Analytics - # account user link ID (e.g. "123456") before running the sample. - account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID" - - delete_account_user_link(account_id, account_user_link_id) - - -def delete_account_user_link( - account_id: str, account_user_link_id: str, transport: str = None -): - """ - Deletes the user link for the account. - - Args: - account_id(str): The Google Analytics Account ID. - account_user_link_id(str): Google Analytics account user link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - client.delete_user_link( - DeleteUserLinkRequest( - name=f"accounts/{account_id}/userLinks/{account_user_link_id}" - ) - ) - print("User link deleted") - - -# [END analyticsadmin_accounts_user_links_delete] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_user_links_delete_test.py b/samples/accounts_user_links_delete_test.py deleted file mode 100644 index 449a137b..00000000 --- a/samples/accounts_user_links_delete_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import accounts_user_links_delete - -FAKE_ACCOUNT_ID = "1" -FAKE_ACCOUNT_USER_LINK_ID = "1" - - -def test_accounts_user_links_delete(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - accounts_user_links_delete.delete_account_user_link( - FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID, transport=transport - ) diff --git a/samples/accounts_user_links_get.py b/samples/accounts_user_links_get.py deleted file mode 100644 index 8c6688c7..00000000 --- a/samples/accounts_user_links_get.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints the account user -link details. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/get -for more information. -""" -# [START analyticsadmin_accounts_user_links_get] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - - # TODO(developer): Replace this variable with your Google Analytics - # account user link ID (e.g. "123456") before running the sample. - account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID" - - get_account_user_link(account_id, account_user_link_id) - - -def get_account_user_link( - account_id: str, account_user_link_id: str, transport: str = None -): - """ - Retrieves the account user link details. - - Args: - account_id(str): The Google Analytics Account ID. - account_user_link_id(str): Google Analytics account user link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - user_link = client.get_user_link( - name=f"accounts/{account_id}/userLinks/{account_user_link_id}" - ) - - print("Result:") - print_user_link(user_link) - - -def print_user_link(user_link): - """Prints the user link details.""" - print(f"Resource name: {user_link.name}") - print(f"Email address: {user_link.email_address}") - for direct_role in user_link.direct_roles: - print(f"Direct role: {direct_role}") - - -# [END analyticsadmin_accounts_user_links_get] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_user_links_get_test.py b/samples/accounts_user_links_get_test.py deleted file mode 100644 index 0026edb1..00000000 --- a/samples/accounts_user_links_get_test.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import accounts_user_links_get - -TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID") -TEST_USER_LINK_ID = os.getenv("GA_TEST_USER_LINK_ID") - - -def test_accounts_user_links_get(capsys): - transports = ["grpc", "rest"] - for transport in transports: - accounts_user_links_get.get_account_user_link( - TEST_ACCOUNT_ID, TEST_USER_LINK_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/accounts_user_links_list.py b/samples/accounts_user_links_list.py deleted file mode 100644 index 52411573..00000000 --- a/samples/accounts_user_links_list.py +++ /dev/null @@ -1,57 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints user links -under the specified parent account. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/list -for more information. -""" -# [START analyticsadmin_accounts_user_links_list] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - list_account_user_links(account_id) - - -def list_account_user_links(account_id: str, transport: str = None): - """ - Lists user links under the specified parent account. - - Args: - account_id(str): The id of the account. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - results = client.list_user_links(parent=f"accounts/{account_id}") - - print("Result:") - for user_link in results: - print(user_link) - print() - - -# [END analyticsadmin_accounts_user_links_list] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_user_links_list_test.py b/samples/accounts_user_links_list_test.py deleted file mode 100644 index 0ae5730d..00000000 --- a/samples/accounts_user_links_list_test.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import accounts_user_links_list - -TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID") - - -def test_accounts_user_links_list(capsys): - transports = ["grpc", "rest"] - for transport in transports: - accounts_user_links_list.list_account_user_links( - TEST_ACCOUNT_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/accounts_user_links_update.py b/samples/accounts_user_links_update.py deleted file mode 100644 index dcb16fbb..00000000 --- a/samples/accounts_user_links_update.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which updates the account -user link. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/accounts.userLinks/patch -for more information. -""" -# [START analyticsadmin_accounts_user_links_update] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import UserLink - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - - # TODO(developer): Replace this variable with your Google Analytics - # account user link ID (e.g. "123456") before running the sample. - account_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID" - - update_account_user_link(account_id, account_user_link_id) - - -def update_account_user_link( - account_id: str, account_user_link_id: str, transport: str = None -): - """ - Updates the account user link. - - Args: - account_id(str): The Google Analytics Account ID. - account_user_link_id(str): Google Analytics account user link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - # This call updates the email address and direct roles of the user link. - # The user link to update is specified in the `name` field of the `UserLink` - # instance. - user_link = client.update_user_link( - user_link=UserLink( - name=f"accounts/{account_id}/userLinks/{account_user_link_id}", - direct_roles=["predefinedRoles/collaborate"], - ), - ) - - print("Result:") - print(user_link) - - -# [END analyticsadmin_accounts_user_links_update] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/accounts_user_links_update_test.py b/samples/accounts_user_links_update_test.py deleted file mode 100644 index 0083ad5b..00000000 --- a/samples/accounts_user_links_update_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import accounts_user_links_update - -FAKE_ACCOUNT_ID = "1" -FAKE_ACCOUNT_USER_LINK_ID = "1" - - -def test_accounts_user_links_update(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - accounts_user_links_update.update_account_user_link( - FAKE_ACCOUNT_ID, FAKE_ACCOUNT_USER_LINK_ID, transport=transport - ) diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_acknowledge_user_data_collection_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_acknowledge_user_data_collection_async.py deleted file mode 100644 index f89c494a..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_acknowledge_user_data_collection_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for AcknowledgeUserDataCollection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_AcknowledgeUserDataCollection_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_acknowledge_user_data_collection(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.AcknowledgeUserDataCollectionRequest( - property="property_value", - acknowledgement="acknowledgement_value", - ) - - # Make the request - response = await client.acknowledge_user_data_collection(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_AcknowledgeUserDataCollection_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_acknowledge_user_data_collection_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_acknowledge_user_data_collection_sync.py deleted file mode 100644 index 34d6b806..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_acknowledge_user_data_collection_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for AcknowledgeUserDataCollection -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_AcknowledgeUserDataCollection_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_acknowledge_user_data_collection(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.AcknowledgeUserDataCollectionRequest( - property="property_value", - acknowledgement="acknowledgement_value", - ) - - # Make the request - response = client.acknowledge_user_data_collection(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_AcknowledgeUserDataCollection_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_approve_display_video360_advertiser_link_proposal_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_approve_display_video360_advertiser_link_proposal_async.py deleted file mode 100644 index c9af029c..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_approve_display_video360_advertiser_link_proposal_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ApproveDisplayVideo360AdvertiserLinkProposal -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ApproveDisplayVideo360AdvertiserLinkProposal_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_approve_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ApproveDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - response = await client.approve_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ApproveDisplayVideo360AdvertiserLinkProposal_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_approve_display_video360_advertiser_link_proposal_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_approve_display_video360_advertiser_link_proposal_sync.py deleted file mode 100644 index c4478f92..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_approve_display_video360_advertiser_link_proposal_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ApproveDisplayVideo360AdvertiserLinkProposal -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ApproveDisplayVideo360AdvertiserLinkProposal_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_approve_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ApproveDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - response = client.approve_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ApproveDisplayVideo360AdvertiserLinkProposal_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_audience_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_audience_async.py deleted file mode 100644 index f85fe637..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_audience_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ArchiveAudience -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveAudience_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_archive_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ArchiveAudienceRequest( - name="name_value", - ) - - # Make the request - await client.archive_audience(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveAudience_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_audience_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_audience_sync.py deleted file mode 100644 index e06399fd..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_audience_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ArchiveAudience -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveAudience_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_archive_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ArchiveAudienceRequest( - name="name_value", - ) - - # Make the request - client.archive_audience(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveAudience_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_dimension_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_dimension_async.py deleted file mode 100644 index b543d270..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_dimension_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ArchiveCustomDimension -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomDimension_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_archive_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ArchiveCustomDimensionRequest( - name="name_value", - ) - - # Make the request - await client.archive_custom_dimension(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomDimension_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_dimension_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_dimension_sync.py deleted file mode 100644 index b9089047..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_dimension_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ArchiveCustomDimension -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomDimension_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_archive_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ArchiveCustomDimensionRequest( - name="name_value", - ) - - # Make the request - client.archive_custom_dimension(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomDimension_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_metric_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_metric_async.py deleted file mode 100644 index 5e341556..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_metric_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ArchiveCustomMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomMetric_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_archive_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ArchiveCustomMetricRequest( - name="name_value", - ) - - # Make the request - await client.archive_custom_metric(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomMetric_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_metric_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_metric_sync.py deleted file mode 100644 index 392d9f45..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_metric_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ArchiveCustomMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomMetric_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_archive_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ArchiveCustomMetricRequest( - name="name_value", - ) - - # Make the request - client.archive_custom_metric(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomMetric_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_audit_user_links_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_audit_user_links_async.py deleted file mode 100644 index 9a08777b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_audit_user_links_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for AuditUserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_AuditUserLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_audit_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.AuditUserLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.audit_user_links(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_AuditUserLinks_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_audit_user_links_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_audit_user_links_sync.py deleted file mode 100644 index 05c3fae9..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_audit_user_links_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for AuditUserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_AuditUserLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_audit_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.AuditUserLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.audit_user_links(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_AuditUserLinks_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_access_bindings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_access_bindings_async.py deleted file mode 100644 index caab041c..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_access_bindings_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchCreateAccessBindings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchCreateAccessBindings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_batch_create_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - requests = admin_v1alpha.CreateAccessBindingRequest() - requests.parent = "parent_value" - requests.access_binding.user = "user_value" - - request = admin_v1alpha.BatchCreateAccessBindingsRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - response = await client.batch_create_access_bindings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchCreateAccessBindings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_access_bindings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_access_bindings_sync.py deleted file mode 100644 index 93fedd0d..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_access_bindings_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchCreateAccessBindings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchCreateAccessBindings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_batch_create_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - requests = admin_v1alpha.CreateAccessBindingRequest() - requests.parent = "parent_value" - requests.access_binding.user = "user_value" - - request = admin_v1alpha.BatchCreateAccessBindingsRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - response = client.batch_create_access_bindings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchCreateAccessBindings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_user_links_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_user_links_async.py deleted file mode 100644 index 7dcf61fd..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_user_links_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchCreateUserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchCreateUserLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_batch_create_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - requests = admin_v1alpha.CreateUserLinkRequest() - requests.parent = "parent_value" - - request = admin_v1alpha.BatchCreateUserLinksRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - response = await client.batch_create_user_links(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchCreateUserLinks_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_user_links_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_user_links_sync.py deleted file mode 100644 index 861e8df9..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_user_links_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchCreateUserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchCreateUserLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_batch_create_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - requests = admin_v1alpha.CreateUserLinkRequest() - requests.parent = "parent_value" - - request = admin_v1alpha.BatchCreateUserLinksRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - response = client.batch_create_user_links(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchCreateUserLinks_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_access_bindings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_access_bindings_async.py deleted file mode 100644 index f35b3dee..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_access_bindings_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchDeleteAccessBindings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchDeleteAccessBindings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_batch_delete_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - requests = admin_v1alpha.DeleteAccessBindingRequest() - requests.name = "name_value" - - request = admin_v1alpha.BatchDeleteAccessBindingsRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - await client.batch_delete_access_bindings(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchDeleteAccessBindings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_access_bindings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_access_bindings_sync.py deleted file mode 100644 index d9ef5152..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_access_bindings_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchDeleteAccessBindings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchDeleteAccessBindings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_batch_delete_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - requests = admin_v1alpha.DeleteAccessBindingRequest() - requests.name = "name_value" - - request = admin_v1alpha.BatchDeleteAccessBindingsRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - client.batch_delete_access_bindings(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchDeleteAccessBindings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_user_links_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_user_links_async.py deleted file mode 100644 index 0c7aa267..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_user_links_async.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchDeleteUserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchDeleteUserLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_batch_delete_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - requests = admin_v1alpha.DeleteUserLinkRequest() - requests.name = "name_value" - - request = admin_v1alpha.BatchDeleteUserLinksRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - await client.batch_delete_user_links(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchDeleteUserLinks_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_user_links_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_user_links_sync.py deleted file mode 100644 index 4cb48810..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_user_links_sync.py +++ /dev/null @@ -1,54 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchDeleteUserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchDeleteUserLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_batch_delete_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - requests = admin_v1alpha.DeleteUserLinkRequest() - requests.name = "name_value" - - request = admin_v1alpha.BatchDeleteUserLinksRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - client.batch_delete_user_links(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchDeleteUserLinks_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_access_bindings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_access_bindings_async.py deleted file mode 100644 index 9579e82d..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_access_bindings_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchGetAccessBindings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchGetAccessBindings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_batch_get_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.BatchGetAccessBindingsRequest( - parent="parent_value", - names=['names_value1', 'names_value2'], - ) - - # Make the request - response = await client.batch_get_access_bindings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchGetAccessBindings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_access_bindings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_access_bindings_sync.py deleted file mode 100644 index 7fd859e2..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_access_bindings_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchGetAccessBindings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchGetAccessBindings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_batch_get_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.BatchGetAccessBindingsRequest( - parent="parent_value", - names=['names_value1', 'names_value2'], - ) - - # Make the request - response = client.batch_get_access_bindings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchGetAccessBindings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_user_links_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_user_links_async.py deleted file mode 100644 index e8253474..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_user_links_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchGetUserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchGetUserLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_batch_get_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.BatchGetUserLinksRequest( - parent="parent_value", - names=['names_value1', 'names_value2'], - ) - - # Make the request - response = await client.batch_get_user_links(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchGetUserLinks_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_user_links_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_user_links_sync.py deleted file mode 100644 index 8f5198f3..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_user_links_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchGetUserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchGetUserLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_batch_get_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.BatchGetUserLinksRequest( - parent="parent_value", - names=['names_value1', 'names_value2'], - ) - - # Make the request - response = client.batch_get_user_links(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchGetUserLinks_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_access_bindings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_access_bindings_async.py deleted file mode 100644 index 697e2773..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_access_bindings_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchUpdateAccessBindings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchUpdateAccessBindings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_batch_update_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - requests = admin_v1alpha.UpdateAccessBindingRequest() - requests.access_binding.user = "user_value" - - request = admin_v1alpha.BatchUpdateAccessBindingsRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - response = await client.batch_update_access_bindings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchUpdateAccessBindings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_access_bindings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_access_bindings_sync.py deleted file mode 100644 index 58f5a090..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_access_bindings_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchUpdateAccessBindings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchUpdateAccessBindings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_batch_update_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - requests = admin_v1alpha.UpdateAccessBindingRequest() - requests.access_binding.user = "user_value" - - request = admin_v1alpha.BatchUpdateAccessBindingsRequest( - parent="parent_value", - requests=requests, - ) - - # Make the request - response = client.batch_update_access_bindings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchUpdateAccessBindings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_user_links_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_user_links_async.py deleted file mode 100644 index 73b31269..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_user_links_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchUpdateUserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchUpdateUserLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_batch_update_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.BatchUpdateUserLinksRequest( - parent="parent_value", - ) - - # Make the request - response = await client.batch_update_user_links(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchUpdateUserLinks_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_user_links_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_user_links_sync.py deleted file mode 100644 index 27125438..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_user_links_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for BatchUpdateUserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchUpdateUserLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_batch_update_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.BatchUpdateUserLinksRequest( - parent="parent_value", - ) - - # Make the request - response = client.batch_update_user_links(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchUpdateUserLinks_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_cancel_display_video360_advertiser_link_proposal_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_cancel_display_video360_advertiser_link_proposal_async.py deleted file mode 100644 index 975c08f7..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_cancel_display_video360_advertiser_link_proposal_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CancelDisplayVideo360AdvertiserLinkProposal -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CancelDisplayVideo360AdvertiserLinkProposal_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_cancel_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CancelDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - response = await client.cancel_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CancelDisplayVideo360AdvertiserLinkProposal_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_cancel_display_video360_advertiser_link_proposal_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_cancel_display_video360_advertiser_link_proposal_sync.py deleted file mode 100644 index 85c1cefa..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_cancel_display_video360_advertiser_link_proposal_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CancelDisplayVideo360AdvertiserLinkProposal -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CancelDisplayVideo360AdvertiserLinkProposal_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_cancel_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CancelDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - response = client.cancel_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CancelDisplayVideo360AdvertiserLinkProposal_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_access_binding_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_access_binding_async.py deleted file mode 100644 index f8717c55..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_access_binding_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateAccessBinding -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAccessBinding_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - access_binding = admin_v1alpha.AccessBinding() - access_binding.user = "user_value" - - request = admin_v1alpha.CreateAccessBindingRequest( - parent="parent_value", - access_binding=access_binding, - ) - - # Make the request - response = await client.create_access_binding(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAccessBinding_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_access_binding_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_access_binding_sync.py deleted file mode 100644 index 0f6893e4..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_access_binding_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateAccessBinding -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAccessBinding_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - access_binding = admin_v1alpha.AccessBinding() - access_binding.user = "user_value" - - request = admin_v1alpha.CreateAccessBindingRequest( - parent="parent_value", - access_binding=access_binding, - ) - - # Make the request - response = client.create_access_binding(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAccessBinding_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_ad_sense_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_ad_sense_link_async.py deleted file mode 100644 index c7cdd0ff..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_ad_sense_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateAdSenseLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAdSenseLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_ad_sense_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateAdSenseLinkRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_ad_sense_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAdSenseLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_ad_sense_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_ad_sense_link_sync.py deleted file mode 100644 index 8f77c3c3..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_ad_sense_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateAdSenseLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAdSenseLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_ad_sense_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateAdSenseLinkRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_ad_sense_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAdSenseLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_audience_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_audience_async.py deleted file mode 100644 index 6356e224..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_audience_async.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateAudience -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAudience_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - audience = admin_v1alpha.Audience() - audience.display_name = "display_name_value" - audience.description = "description_value" - audience.membership_duration_days = 2561 - audience.filter_clauses.simple_filter.scope = "AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS" - audience.filter_clauses.clause_type = "EXCLUDE" - - request = admin_v1alpha.CreateAudienceRequest( - parent="parent_value", - audience=audience, - ) - - # Make the request - response = await client.create_audience(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAudience_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_audience_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_audience_sync.py deleted file mode 100644 index 08f4e140..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_audience_sync.py +++ /dev/null @@ -1,60 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateAudience -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAudience_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - audience = admin_v1alpha.Audience() - audience.display_name = "display_name_value" - audience.description = "description_value" - audience.membership_duration_days = 2561 - audience.filter_clauses.simple_filter.scope = "AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS" - audience.filter_clauses.clause_type = "EXCLUDE" - - request = admin_v1alpha.CreateAudienceRequest( - parent="parent_value", - audience=audience, - ) - - # Make the request - response = client.create_audience(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAudience_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_channel_group_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_channel_group_async.py deleted file mode 100644 index 1720e624..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_channel_group_async.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateChannelGroup -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateChannelGroup_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - channel_group = admin_v1alpha.ChannelGroup() - channel_group.display_name = "display_name_value" - channel_group.grouping_rule.display_name = "display_name_value" - - request = admin_v1alpha.CreateChannelGroupRequest( - parent="parent_value", - channel_group=channel_group, - ) - - # Make the request - response = await client.create_channel_group(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateChannelGroup_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_channel_group_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_channel_group_sync.py deleted file mode 100644 index 6106d866..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_channel_group_sync.py +++ /dev/null @@ -1,57 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateChannelGroup -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateChannelGroup_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - channel_group = admin_v1alpha.ChannelGroup() - channel_group.display_name = "display_name_value" - channel_group.grouping_rule.display_name = "display_name_value" - - request = admin_v1alpha.CreateChannelGroupRequest( - parent="parent_value", - channel_group=channel_group, - ) - - # Make the request - response = client.create_channel_group(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateChannelGroup_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_connected_site_tag_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_connected_site_tag_async.py deleted file mode 100644 index aa076f73..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_connected_site_tag_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateConnectedSiteTag -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConnectedSiteTag_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_connected_site_tag(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - connected_site_tag = admin_v1alpha.ConnectedSiteTag() - connected_site_tag.display_name = "display_name_value" - connected_site_tag.tag_id = "tag_id_value" - - request = admin_v1alpha.CreateConnectedSiteTagRequest( - connected_site_tag=connected_site_tag, - ) - - # Make the request - response = await client.create_connected_site_tag(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConnectedSiteTag_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_connected_site_tag_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_connected_site_tag_sync.py deleted file mode 100644 index 41b71f00..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_connected_site_tag_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateConnectedSiteTag -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConnectedSiteTag_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_connected_site_tag(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - connected_site_tag = admin_v1alpha.ConnectedSiteTag() - connected_site_tag.display_name = "display_name_value" - connected_site_tag.tag_id = "tag_id_value" - - request = admin_v1alpha.CreateConnectedSiteTagRequest( - connected_site_tag=connected_site_tag, - ) - - # Make the request - response = client.create_connected_site_tag(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConnectedSiteTag_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_conversion_event_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_conversion_event_async.py deleted file mode 100644 index 8511628a..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_conversion_event_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateConversionEvent -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConversionEvent_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateConversionEventRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_conversion_event(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConversionEvent_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_conversion_event_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_conversion_event_sync.py deleted file mode 100644 index 6f01a67c..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_conversion_event_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateConversionEvent -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConversionEvent_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateConversionEventRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_conversion_event(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConversionEvent_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_dimension_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_dimension_async.py deleted file mode 100644 index e64a3bcd..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_dimension_async.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCustomDimension -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomDimension_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - custom_dimension = admin_v1alpha.CustomDimension() - custom_dimension.parameter_name = "parameter_name_value" - custom_dimension.display_name = "display_name_value" - custom_dimension.scope = "ITEM" - - request = admin_v1alpha.CreateCustomDimensionRequest( - parent="parent_value", - custom_dimension=custom_dimension, - ) - - # Make the request - response = await client.create_custom_dimension(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomDimension_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_dimension_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_dimension_sync.py deleted file mode 100644 index 0f8e8159..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_dimension_sync.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCustomDimension -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomDimension_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - custom_dimension = admin_v1alpha.CustomDimension() - custom_dimension.parameter_name = "parameter_name_value" - custom_dimension.display_name = "display_name_value" - custom_dimension.scope = "ITEM" - - request = admin_v1alpha.CreateCustomDimensionRequest( - parent="parent_value", - custom_dimension=custom_dimension, - ) - - # Make the request - response = client.create_custom_dimension(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomDimension_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_metric_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_metric_async.py deleted file mode 100644 index 9018ed9d..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_metric_async.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCustomMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomMetric_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - custom_metric = admin_v1alpha.CustomMetric() - custom_metric.parameter_name = "parameter_name_value" - custom_metric.display_name = "display_name_value" - custom_metric.measurement_unit = "HOURS" - custom_metric.scope = "EVENT" - - request = admin_v1alpha.CreateCustomMetricRequest( - parent="parent_value", - custom_metric=custom_metric, - ) - - # Make the request - response = await client.create_custom_metric(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomMetric_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_metric_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_metric_sync.py deleted file mode 100644 index 77fe385b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_metric_sync.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateCustomMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomMetric_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - custom_metric = admin_v1alpha.CustomMetric() - custom_metric.parameter_name = "parameter_name_value" - custom_metric.display_name = "display_name_value" - custom_metric.measurement_unit = "HOURS" - custom_metric.scope = "EVENT" - - request = admin_v1alpha.CreateCustomMetricRequest( - parent="parent_value", - custom_metric=custom_metric, - ) - - # Make the request - response = client.create_custom_metric(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomMetric_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_data_stream_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_data_stream_async.py deleted file mode 100644 index 428c2c6e..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_data_stream_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateDataStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDataStream_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - data_stream = admin_v1alpha.DataStream() - data_stream.type_ = "IOS_APP_DATA_STREAM" - - request = admin_v1alpha.CreateDataStreamRequest( - parent="parent_value", - data_stream=data_stream, - ) - - # Make the request - response = await client.create_data_stream(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDataStream_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_data_stream_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_data_stream_sync.py deleted file mode 100644 index 455c93c1..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_data_stream_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateDataStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDataStream_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - data_stream = admin_v1alpha.DataStream() - data_stream.type_ = "IOS_APP_DATA_STREAM" - - request = admin_v1alpha.CreateDataStreamRequest( - parent="parent_value", - data_stream=data_stream, - ) - - # Make the request - response = client.create_data_stream(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDataStream_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_async.py deleted file mode 100644 index 8723d5ab..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateDisplayVideo360AdvertiserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDisplayVideo360AdvertiserLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateDisplayVideo360AdvertiserLinkRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_display_video360_advertiser_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDisplayVideo360AdvertiserLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_proposal_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_proposal_async.py deleted file mode 100644 index 11f71c2b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_proposal_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateDisplayVideo360AdvertiserLinkProposal -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDisplayVideo360AdvertiserLinkProposal_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateDisplayVideo360AdvertiserLinkProposalRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDisplayVideo360AdvertiserLinkProposal_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_proposal_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_proposal_sync.py deleted file mode 100644 index fc040afd..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_proposal_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateDisplayVideo360AdvertiserLinkProposal -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDisplayVideo360AdvertiserLinkProposal_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateDisplayVideo360AdvertiserLinkProposalRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDisplayVideo360AdvertiserLinkProposal_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_sync.py deleted file mode 100644 index fd51425d..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateDisplayVideo360AdvertiserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDisplayVideo360AdvertiserLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateDisplayVideo360AdvertiserLinkRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_display_video360_advertiser_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDisplayVideo360AdvertiserLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_event_create_rule_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_event_create_rule_async.py deleted file mode 100644 index 6ad44f4c..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_event_create_rule_async.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateEventCreateRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateEventCreateRule_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - event_create_rule = admin_v1alpha.EventCreateRule() - event_create_rule.destination_event = "destination_event_value" - event_create_rule.event_conditions.field = "field_value" - event_create_rule.event_conditions.comparison_type = "REGULAR_EXPRESSION_CASE_INSENSITIVE" - event_create_rule.event_conditions.value = "value_value" - - request = admin_v1alpha.CreateEventCreateRuleRequest( - parent="parent_value", - event_create_rule=event_create_rule, - ) - - # Make the request - response = await client.create_event_create_rule(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateEventCreateRule_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_event_create_rule_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_event_create_rule_sync.py deleted file mode 100644 index 62a34fd6..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_event_create_rule_sync.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateEventCreateRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateEventCreateRule_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - event_create_rule = admin_v1alpha.EventCreateRule() - event_create_rule.destination_event = "destination_event_value" - event_create_rule.event_conditions.field = "field_value" - event_create_rule.event_conditions.comparison_type = "REGULAR_EXPRESSION_CASE_INSENSITIVE" - event_create_rule.event_conditions.value = "value_value" - - request = admin_v1alpha.CreateEventCreateRuleRequest( - parent="parent_value", - event_create_rule=event_create_rule, - ) - - # Make the request - response = client.create_event_create_rule(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateEventCreateRule_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_expanded_data_set_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_expanded_data_set_async.py deleted file mode 100644 index 118695c1..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_expanded_data_set_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateExpandedDataSet -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateExpandedDataSet_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - expanded_data_set = admin_v1alpha.ExpandedDataSet() - expanded_data_set.display_name = "display_name_value" - - request = admin_v1alpha.CreateExpandedDataSetRequest( - parent="parent_value", - expanded_data_set=expanded_data_set, - ) - - # Make the request - response = await client.create_expanded_data_set(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateExpandedDataSet_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_expanded_data_set_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_expanded_data_set_sync.py deleted file mode 100644 index 45df1526..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_expanded_data_set_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateExpandedDataSet -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateExpandedDataSet_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - expanded_data_set = admin_v1alpha.ExpandedDataSet() - expanded_data_set.display_name = "display_name_value" - - request = admin_v1alpha.CreateExpandedDataSetRequest( - parent="parent_value", - expanded_data_set=expanded_data_set, - ) - - # Make the request - response = client.create_expanded_data_set(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateExpandedDataSet_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_firebase_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_firebase_link_async.py deleted file mode 100644 index af7ea843..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_firebase_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateFirebaseLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateFirebaseLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_firebase_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateFirebaseLinkRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_firebase_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateFirebaseLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_firebase_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_firebase_link_sync.py deleted file mode 100644 index c8f595e2..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_firebase_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateFirebaseLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateFirebaseLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_firebase_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateFirebaseLinkRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_firebase_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateFirebaseLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_google_ads_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_google_ads_link_async.py deleted file mode 100644 index 75579351..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_google_ads_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateGoogleAdsLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateGoogleAdsLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_google_ads_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateGoogleAdsLinkRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_google_ads_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateGoogleAdsLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_google_ads_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_google_ads_link_sync.py deleted file mode 100644 index 730d5f80..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_google_ads_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateGoogleAdsLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateGoogleAdsLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_google_ads_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateGoogleAdsLinkRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_google_ads_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateGoogleAdsLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_measurement_protocol_secret_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_measurement_protocol_secret_async.py deleted file mode 100644 index 4bd8df1b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_measurement_protocol_secret_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateMeasurementProtocolSecret -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateMeasurementProtocolSecret_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - measurement_protocol_secret = admin_v1alpha.MeasurementProtocolSecret() - measurement_protocol_secret.display_name = "display_name_value" - - request = admin_v1alpha.CreateMeasurementProtocolSecretRequest( - parent="parent_value", - measurement_protocol_secret=measurement_protocol_secret, - ) - - # Make the request - response = await client.create_measurement_protocol_secret(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateMeasurementProtocolSecret_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_measurement_protocol_secret_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_measurement_protocol_secret_sync.py deleted file mode 100644 index 64b58f02..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_measurement_protocol_secret_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateMeasurementProtocolSecret -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateMeasurementProtocolSecret_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - measurement_protocol_secret = admin_v1alpha.MeasurementProtocolSecret() - measurement_protocol_secret.display_name = "display_name_value" - - request = admin_v1alpha.CreateMeasurementProtocolSecretRequest( - parent="parent_value", - measurement_protocol_secret=measurement_protocol_secret, - ) - - # Make the request - response = client.create_measurement_protocol_secret(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateMeasurementProtocolSecret_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_property_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_property_async.py deleted file mode 100644 index a7f57238..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_property_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateProperty -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateProperty_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - property = admin_v1alpha.Property() - property.display_name = "display_name_value" - property.time_zone = "time_zone_value" - - request = admin_v1alpha.CreatePropertyRequest( - property=property, - ) - - # Make the request - response = await client.create_property(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateProperty_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_property_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_property_sync.py deleted file mode 100644 index 1dd21898..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_property_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateProperty -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateProperty_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - property = admin_v1alpha.Property() - property.display_name = "display_name_value" - property.time_zone = "time_zone_value" - - request = admin_v1alpha.CreatePropertyRequest( - property=property, - ) - - # Make the request - response = client.create_property(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateProperty_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_search_ads360_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_search_ads360_link_async.py deleted file mode 100644 index ba6cbfee..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_search_ads360_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateSearchAds360Link -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateSearchAds360Link_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateSearchAds360LinkRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_search_ads360_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateSearchAds360Link_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_search_ads360_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_search_ads360_link_sync.py deleted file mode 100644 index a88e94d9..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_search_ads360_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateSearchAds360Link -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateSearchAds360Link_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateSearchAds360LinkRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_search_ads360_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateSearchAds360Link_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_sk_ad_network_conversion_value_schema_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_sk_ad_network_conversion_value_schema_async.py deleted file mode 100644 index 6e8eeb24..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_sk_ad_network_conversion_value_schema_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateSKAdNetworkConversionValueSchema -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateSKAdNetworkConversionValueSchema_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateSKAdNetworkConversionValueSchemaRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_sk_ad_network_conversion_value_schema(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateSKAdNetworkConversionValueSchema_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_sk_ad_network_conversion_value_schema_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_sk_ad_network_conversion_value_schema_sync.py deleted file mode 100644 index dd7cc43b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_sk_ad_network_conversion_value_schema_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateSKAdNetworkConversionValueSchema -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateSKAdNetworkConversionValueSchema_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateSKAdNetworkConversionValueSchemaRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_sk_ad_network_conversion_value_schema(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateSKAdNetworkConversionValueSchema_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_user_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_user_link_async.py deleted file mode 100644 index 9fb658c4..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_user_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateUserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateUserLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_create_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateUserLinkRequest( - parent="parent_value", - ) - - # Make the request - response = await client.create_user_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateUserLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_user_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_user_link_sync.py deleted file mode 100644 index fc23896c..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_create_user_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for CreateUserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateUserLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_create_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.CreateUserLinkRequest( - parent="parent_value", - ) - - # Make the request - response = client.create_user_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateUserLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_access_binding_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_access_binding_async.py deleted file mode 100644 index 3a813a29..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_access_binding_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteAccessBinding -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAccessBinding_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteAccessBindingRequest( - name="name_value", - ) - - # Make the request - await client.delete_access_binding(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAccessBinding_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_access_binding_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_access_binding_sync.py deleted file mode 100644 index b2addb65..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_access_binding_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteAccessBinding -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAccessBinding_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteAccessBindingRequest( - name="name_value", - ) - - # Make the request - client.delete_access_binding(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAccessBinding_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_account_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_account_async.py deleted file mode 100644 index 315bdba3..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_account_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteAccount -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAccount_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_account(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteAccountRequest( - name="name_value", - ) - - # Make the request - await client.delete_account(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAccount_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_account_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_account_sync.py deleted file mode 100644 index b9453141..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_account_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteAccount -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAccount_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_account(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteAccountRequest( - name="name_value", - ) - - # Make the request - client.delete_account(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAccount_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_ad_sense_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_ad_sense_link_async.py deleted file mode 100644 index bf39faf3..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_ad_sense_link_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteAdSenseLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAdSenseLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_ad_sense_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteAdSenseLinkRequest( - name="name_value", - ) - - # Make the request - await client.delete_ad_sense_link(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAdSenseLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_ad_sense_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_ad_sense_link_sync.py deleted file mode 100644 index c79cf44e..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_ad_sense_link_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteAdSenseLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAdSenseLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_ad_sense_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteAdSenseLinkRequest( - name="name_value", - ) - - # Make the request - client.delete_ad_sense_link(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAdSenseLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_channel_group_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_channel_group_async.py deleted file mode 100644 index 195ece03..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_channel_group_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteChannelGroup -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteChannelGroup_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteChannelGroupRequest( - name="name_value", - ) - - # Make the request - await client.delete_channel_group(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteChannelGroup_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_channel_group_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_channel_group_sync.py deleted file mode 100644 index 434c049e..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_channel_group_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteChannelGroup -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteChannelGroup_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteChannelGroupRequest( - name="name_value", - ) - - # Make the request - client.delete_channel_group(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteChannelGroup_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_connected_site_tag_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_connected_site_tag_async.py deleted file mode 100644 index f9683511..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_connected_site_tag_async.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteConnectedSiteTag -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConnectedSiteTag_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_connected_site_tag(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteConnectedSiteTagRequest( - ) - - # Make the request - await client.delete_connected_site_tag(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConnectedSiteTag_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_connected_site_tag_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_connected_site_tag_sync.py deleted file mode 100644 index 727eb312..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_connected_site_tag_sync.py +++ /dev/null @@ -1,49 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteConnectedSiteTag -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConnectedSiteTag_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_connected_site_tag(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteConnectedSiteTagRequest( - ) - - # Make the request - client.delete_connected_site_tag(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConnectedSiteTag_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_conversion_event_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_conversion_event_async.py deleted file mode 100644 index e88f9bfa..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_conversion_event_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteConversionEvent -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConversionEvent_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteConversionEventRequest( - name="name_value", - ) - - # Make the request - await client.delete_conversion_event(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConversionEvent_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_conversion_event_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_conversion_event_sync.py deleted file mode 100644 index 0ccdfeb3..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_conversion_event_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteConversionEvent -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConversionEvent_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteConversionEventRequest( - name="name_value", - ) - - # Make the request - client.delete_conversion_event(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConversionEvent_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_data_stream_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_data_stream_async.py deleted file mode 100644 index 00bab773..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_data_stream_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteDataStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDataStream_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteDataStreamRequest( - name="name_value", - ) - - # Make the request - await client.delete_data_stream(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDataStream_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_data_stream_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_data_stream_sync.py deleted file mode 100644 index 9774ff76..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_data_stream_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteDataStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDataStream_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteDataStreamRequest( - name="name_value", - ) - - # Make the request - client.delete_data_stream(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDataStream_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_async.py deleted file mode 100644 index 26e54aa3..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteDisplayVideo360AdvertiserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDisplayVideo360AdvertiserLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteDisplayVideo360AdvertiserLinkRequest( - name="name_value", - ) - - # Make the request - await client.delete_display_video360_advertiser_link(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDisplayVideo360AdvertiserLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_proposal_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_proposal_async.py deleted file mode 100644 index c5a76adc..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_proposal_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteDisplayVideo360AdvertiserLinkProposal -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDisplayVideo360AdvertiserLinkProposal_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - await client.delete_display_video360_advertiser_link_proposal(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDisplayVideo360AdvertiserLinkProposal_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_proposal_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_proposal_sync.py deleted file mode 100644 index 787449c7..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_proposal_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteDisplayVideo360AdvertiserLinkProposal -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDisplayVideo360AdvertiserLinkProposal_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - client.delete_display_video360_advertiser_link_proposal(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDisplayVideo360AdvertiserLinkProposal_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_sync.py deleted file mode 100644 index b7726a11..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteDisplayVideo360AdvertiserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDisplayVideo360AdvertiserLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteDisplayVideo360AdvertiserLinkRequest( - name="name_value", - ) - - # Make the request - client.delete_display_video360_advertiser_link(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDisplayVideo360AdvertiserLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_event_create_rule_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_event_create_rule_async.py deleted file mode 100644 index 1f415285..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_event_create_rule_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteEventCreateRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteEventCreateRule_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteEventCreateRuleRequest( - name="name_value", - ) - - # Make the request - await client.delete_event_create_rule(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteEventCreateRule_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_event_create_rule_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_event_create_rule_sync.py deleted file mode 100644 index 1fe0bb5a..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_event_create_rule_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteEventCreateRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteEventCreateRule_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteEventCreateRuleRequest( - name="name_value", - ) - - # Make the request - client.delete_event_create_rule(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteEventCreateRule_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_expanded_data_set_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_expanded_data_set_async.py deleted file mode 100644 index ee1d2eeb..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_expanded_data_set_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteExpandedDataSet -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteExpandedDataSet_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteExpandedDataSetRequest( - name="name_value", - ) - - # Make the request - await client.delete_expanded_data_set(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteExpandedDataSet_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_expanded_data_set_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_expanded_data_set_sync.py deleted file mode 100644 index 8aef06a9..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_expanded_data_set_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteExpandedDataSet -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteExpandedDataSet_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteExpandedDataSetRequest( - name="name_value", - ) - - # Make the request - client.delete_expanded_data_set(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteExpandedDataSet_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_firebase_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_firebase_link_async.py deleted file mode 100644 index e1e4ca2c..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_firebase_link_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteFirebaseLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteFirebaseLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_firebase_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteFirebaseLinkRequest( - name="name_value", - ) - - # Make the request - await client.delete_firebase_link(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteFirebaseLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_firebase_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_firebase_link_sync.py deleted file mode 100644 index 497c1025..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_firebase_link_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteFirebaseLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteFirebaseLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_firebase_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteFirebaseLinkRequest( - name="name_value", - ) - - # Make the request - client.delete_firebase_link(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteFirebaseLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_google_ads_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_google_ads_link_async.py deleted file mode 100644 index 9ae7cee2..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_google_ads_link_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteGoogleAdsLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteGoogleAdsLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_google_ads_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteGoogleAdsLinkRequest( - name="name_value", - ) - - # Make the request - await client.delete_google_ads_link(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteGoogleAdsLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_google_ads_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_google_ads_link_sync.py deleted file mode 100644 index e5522618..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_google_ads_link_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteGoogleAdsLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteGoogleAdsLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_google_ads_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteGoogleAdsLinkRequest( - name="name_value", - ) - - # Make the request - client.delete_google_ads_link(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteGoogleAdsLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_measurement_protocol_secret_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_measurement_protocol_secret_async.py deleted file mode 100644 index 5b78808f..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_measurement_protocol_secret_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteMeasurementProtocolSecret -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteMeasurementProtocolSecret_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteMeasurementProtocolSecretRequest( - name="name_value", - ) - - # Make the request - await client.delete_measurement_protocol_secret(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteMeasurementProtocolSecret_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_measurement_protocol_secret_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_measurement_protocol_secret_sync.py deleted file mode 100644 index 4576dd4e..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_measurement_protocol_secret_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteMeasurementProtocolSecret -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteMeasurementProtocolSecret_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteMeasurementProtocolSecretRequest( - name="name_value", - ) - - # Make the request - client.delete_measurement_protocol_secret(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteMeasurementProtocolSecret_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_property_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_property_async.py deleted file mode 100644 index 8819fd0b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_property_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteProperty -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteProperty_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeletePropertyRequest( - name="name_value", - ) - - # Make the request - response = await client.delete_property(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteProperty_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_property_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_property_sync.py deleted file mode 100644 index f01d4162..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_property_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteProperty -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteProperty_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeletePropertyRequest( - name="name_value", - ) - - # Make the request - response = client.delete_property(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteProperty_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_search_ads360_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_search_ads360_link_async.py deleted file mode 100644 index f0356b5d..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_search_ads360_link_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteSearchAds360Link -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteSearchAds360Link_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteSearchAds360LinkRequest( - name="name_value", - ) - - # Make the request - await client.delete_search_ads360_link(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteSearchAds360Link_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_search_ads360_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_search_ads360_link_sync.py deleted file mode 100644 index febee7db..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_search_ads360_link_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteSearchAds360Link -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteSearchAds360Link_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteSearchAds360LinkRequest( - name="name_value", - ) - - # Make the request - client.delete_search_ads360_link(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteSearchAds360Link_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_sk_ad_network_conversion_value_schema_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_sk_ad_network_conversion_value_schema_async.py deleted file mode 100644 index b29039a9..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_sk_ad_network_conversion_value_schema_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteSKAdNetworkConversionValueSchema -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteSKAdNetworkConversionValueSchema_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteSKAdNetworkConversionValueSchemaRequest( - name="name_value", - ) - - # Make the request - await client.delete_sk_ad_network_conversion_value_schema(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteSKAdNetworkConversionValueSchema_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_sk_ad_network_conversion_value_schema_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_sk_ad_network_conversion_value_schema_sync.py deleted file mode 100644 index cabeb77f..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_sk_ad_network_conversion_value_schema_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteSKAdNetworkConversionValueSchema -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteSKAdNetworkConversionValueSchema_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteSKAdNetworkConversionValueSchemaRequest( - name="name_value", - ) - - # Make the request - client.delete_sk_ad_network_conversion_value_schema(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteSKAdNetworkConversionValueSchema_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_user_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_user_link_async.py deleted file mode 100644 index d59d879a..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_user_link_async.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteUserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteUserLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_delete_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteUserLinkRequest( - name="name_value", - ) - - # Make the request - await client.delete_user_link(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteUserLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_user_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_user_link_sync.py deleted file mode 100644 index 2199fb37..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_delete_user_link_sync.py +++ /dev/null @@ -1,50 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for DeleteUserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteUserLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_delete_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.DeleteUserLinkRequest( - name="name_value", - ) - - # Make the request - client.delete_user_link(request=request) - - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteUserLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_automated_ga4_configuration_opt_out_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_automated_ga4_configuration_opt_out_async.py deleted file mode 100644 index 10854511..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_automated_ga4_configuration_opt_out_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchAutomatedGa4ConfigurationOptOut -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_FetchAutomatedGa4ConfigurationOptOut_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_fetch_automated_ga4_configuration_opt_out(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.FetchAutomatedGa4ConfigurationOptOutRequest( - property="property_value", - ) - - # Make the request - response = await client.fetch_automated_ga4_configuration_opt_out(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_FetchAutomatedGa4ConfigurationOptOut_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_automated_ga4_configuration_opt_out_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_automated_ga4_configuration_opt_out_sync.py deleted file mode 100644 index 713232e4..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_automated_ga4_configuration_opt_out_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchAutomatedGa4ConfigurationOptOut -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_FetchAutomatedGa4ConfigurationOptOut_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_fetch_automated_ga4_configuration_opt_out(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.FetchAutomatedGa4ConfigurationOptOutRequest( - property="property_value", - ) - - # Make the request - response = client.fetch_automated_ga4_configuration_opt_out(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_FetchAutomatedGa4ConfigurationOptOut_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_connected_ga4_property_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_connected_ga4_property_async.py deleted file mode 100644 index 2a06854b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_connected_ga4_property_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchConnectedGa4Property -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_FetchConnectedGa4Property_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_fetch_connected_ga4_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.FetchConnectedGa4PropertyRequest( - property="property_value", - ) - - # Make the request - response = await client.fetch_connected_ga4_property(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_FetchConnectedGa4Property_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_connected_ga4_property_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_connected_ga4_property_sync.py deleted file mode 100644 index 985db961..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_connected_ga4_property_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for FetchConnectedGa4Property -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_FetchConnectedGa4Property_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_fetch_connected_ga4_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.FetchConnectedGa4PropertyRequest( - property="property_value", - ) - - # Make the request - response = client.fetch_connected_ga4_property(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_FetchConnectedGa4Property_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_access_binding_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_access_binding_async.py deleted file mode 100644 index 1a64557e..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_access_binding_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAccessBinding -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAccessBinding_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAccessBindingRequest( - name="name_value", - ) - - # Make the request - response = await client.get_access_binding(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAccessBinding_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_access_binding_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_access_binding_sync.py deleted file mode 100644 index c7b1c818..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_access_binding_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAccessBinding -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAccessBinding_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAccessBindingRequest( - name="name_value", - ) - - # Make the request - response = client.get_access_binding(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAccessBinding_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_account_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_account_async.py deleted file mode 100644 index b07eeb8c..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_account_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAccount -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAccount_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_account(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAccountRequest( - name="name_value", - ) - - # Make the request - response = await client.get_account(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAccount_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_account_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_account_sync.py deleted file mode 100644 index 5f5d69f8..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_account_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAccount -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAccount_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_account(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAccountRequest( - name="name_value", - ) - - # Make the request - response = client.get_account(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAccount_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_ad_sense_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_ad_sense_link_async.py deleted file mode 100644 index 95de9bee..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_ad_sense_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAdSenseLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAdSenseLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_ad_sense_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAdSenseLinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_ad_sense_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAdSenseLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_ad_sense_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_ad_sense_link_sync.py deleted file mode 100644 index bd2c2d73..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_ad_sense_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAdSenseLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAdSenseLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_ad_sense_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAdSenseLinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_ad_sense_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAdSenseLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_attribution_settings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_attribution_settings_async.py deleted file mode 100644 index 3c5bf6c1..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_attribution_settings_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAttributionSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAttributionSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_attribution_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAttributionSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_attribution_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAttributionSettings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_attribution_settings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_attribution_settings_sync.py deleted file mode 100644 index e2250660..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_attribution_settings_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAttributionSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAttributionSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_attribution_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAttributionSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.get_attribution_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAttributionSettings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_audience_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_audience_async.py deleted file mode 100644 index 4291b1f4..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_audience_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAudience -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAudience_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAudienceRequest( - name="name_value", - ) - - # Make the request - response = await client.get_audience(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAudience_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_audience_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_audience_sync.py deleted file mode 100644 index 789fdc42..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_audience_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetAudience -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAudience_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetAudienceRequest( - name="name_value", - ) - - # Make the request - response = client.get_audience(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAudience_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_big_query_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_big_query_link_async.py deleted file mode 100644 index df864c01..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_big_query_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetBigQueryLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetBigQueryLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_big_query_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetBigQueryLinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_big_query_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetBigQueryLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_big_query_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_big_query_link_sync.py deleted file mode 100644 index 8f90ab91..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_big_query_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetBigQueryLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetBigQueryLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_big_query_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetBigQueryLinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_big_query_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetBigQueryLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_channel_group_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_channel_group_async.py deleted file mode 100644 index 127f333b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_channel_group_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetChannelGroup -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetChannelGroup_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetChannelGroupRequest( - name="name_value", - ) - - # Make the request - response = await client.get_channel_group(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetChannelGroup_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_channel_group_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_channel_group_sync.py deleted file mode 100644 index cac3a200..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_channel_group_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetChannelGroup -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetChannelGroup_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetChannelGroupRequest( - name="name_value", - ) - - # Make the request - response = client.get_channel_group(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetChannelGroup_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_conversion_event_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_conversion_event_async.py deleted file mode 100644 index b45c9eb2..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_conversion_event_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetConversionEvent -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetConversionEvent_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetConversionEventRequest( - name="name_value", - ) - - # Make the request - response = await client.get_conversion_event(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetConversionEvent_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_conversion_event_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_conversion_event_sync.py deleted file mode 100644 index 922a3033..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_conversion_event_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetConversionEvent -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetConversionEvent_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetConversionEventRequest( - name="name_value", - ) - - # Make the request - response = client.get_conversion_event(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetConversionEvent_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_dimension_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_dimension_async.py deleted file mode 100644 index 30960e05..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_dimension_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCustomDimension -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomDimension_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetCustomDimensionRequest( - name="name_value", - ) - - # Make the request - response = await client.get_custom_dimension(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomDimension_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_dimension_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_dimension_sync.py deleted file mode 100644 index 92f20eb1..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_dimension_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCustomDimension -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomDimension_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetCustomDimensionRequest( - name="name_value", - ) - - # Make the request - response = client.get_custom_dimension(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomDimension_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_metric_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_metric_async.py deleted file mode 100644 index 90cdcf85..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_metric_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCustomMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomMetric_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetCustomMetricRequest( - name="name_value", - ) - - # Make the request - response = await client.get_custom_metric(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomMetric_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_metric_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_metric_sync.py deleted file mode 100644 index 323ac310..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_metric_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetCustomMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomMetric_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetCustomMetricRequest( - name="name_value", - ) - - # Make the request - response = client.get_custom_metric(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomMetric_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_retention_settings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_retention_settings_async.py deleted file mode 100644 index 6faf3de1..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_retention_settings_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDataRetentionSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataRetentionSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_data_retention_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDataRetentionSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_data_retention_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataRetentionSettings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_retention_settings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_retention_settings_sync.py deleted file mode 100644 index 53fc3b12..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_retention_settings_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDataRetentionSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataRetentionSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_data_retention_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDataRetentionSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.get_data_retention_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataRetentionSettings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_sharing_settings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_sharing_settings_async.py deleted file mode 100644 index 7640bb4b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_sharing_settings_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDataSharingSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataSharingSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_data_sharing_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDataSharingSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_data_sharing_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataSharingSettings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_sharing_settings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_sharing_settings_sync.py deleted file mode 100644 index ef7b5855..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_sharing_settings_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDataSharingSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataSharingSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_data_sharing_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDataSharingSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.get_data_sharing_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataSharingSettings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_stream_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_stream_async.py deleted file mode 100644 index dd0bd1e6..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_stream_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDataStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataStream_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDataStreamRequest( - name="name_value", - ) - - # Make the request - response = await client.get_data_stream(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataStream_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_stream_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_stream_sync.py deleted file mode 100644 index 19d03802..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_stream_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDataStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataStream_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDataStreamRequest( - name="name_value", - ) - - # Make the request - response = client.get_data_stream(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataStream_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_async.py deleted file mode 100644 index 9d104e04..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDisplayVideo360AdvertiserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDisplayVideo360AdvertiserLinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_display_video360_advertiser_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_proposal_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_proposal_async.py deleted file mode 100644 index edff0462..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_proposal_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDisplayVideo360AdvertiserLinkProposal -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLinkProposal_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - response = await client.get_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLinkProposal_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_proposal_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_proposal_sync.py deleted file mode 100644 index bc1fc490..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_proposal_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDisplayVideo360AdvertiserLinkProposal -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLinkProposal_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_display_video360_advertiser_link_proposal(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDisplayVideo360AdvertiserLinkProposalRequest( - name="name_value", - ) - - # Make the request - response = client.get_display_video360_advertiser_link_proposal(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLinkProposal_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_sync.py deleted file mode 100644 index 854db53d..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetDisplayVideo360AdvertiserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetDisplayVideo360AdvertiserLinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_display_video360_advertiser_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_enhanced_measurement_settings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_enhanced_measurement_settings_async.py deleted file mode 100644 index be3416cb..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_enhanced_measurement_settings_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetEnhancedMeasurementSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetEnhancedMeasurementSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_enhanced_measurement_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetEnhancedMeasurementSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_enhanced_measurement_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetEnhancedMeasurementSettings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_enhanced_measurement_settings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_enhanced_measurement_settings_sync.py deleted file mode 100644 index be782c0f..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_enhanced_measurement_settings_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetEnhancedMeasurementSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetEnhancedMeasurementSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_enhanced_measurement_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetEnhancedMeasurementSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.get_enhanced_measurement_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetEnhancedMeasurementSettings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_event_create_rule_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_event_create_rule_async.py deleted file mode 100644 index 9020a561..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_event_create_rule_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetEventCreateRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetEventCreateRule_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetEventCreateRuleRequest( - name="name_value", - ) - - # Make the request - response = await client.get_event_create_rule(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetEventCreateRule_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_event_create_rule_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_event_create_rule_sync.py deleted file mode 100644 index 452b212c..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_event_create_rule_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetEventCreateRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetEventCreateRule_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetEventCreateRuleRequest( - name="name_value", - ) - - # Make the request - response = client.get_event_create_rule(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetEventCreateRule_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_expanded_data_set_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_expanded_data_set_async.py deleted file mode 100644 index b4da23e5..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_expanded_data_set_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetExpandedDataSet -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetExpandedDataSet_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetExpandedDataSetRequest( - name="name_value", - ) - - # Make the request - response = await client.get_expanded_data_set(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetExpandedDataSet_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_expanded_data_set_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_expanded_data_set_sync.py deleted file mode 100644 index a886a6c5..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_expanded_data_set_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetExpandedDataSet -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetExpandedDataSet_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetExpandedDataSetRequest( - name="name_value", - ) - - # Make the request - response = client.get_expanded_data_set(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetExpandedDataSet_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_global_site_tag_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_global_site_tag_async.py deleted file mode 100644 index 5ad9dbd2..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_global_site_tag_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetGlobalSiteTag -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGlobalSiteTag_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_global_site_tag(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetGlobalSiteTagRequest( - name="name_value", - ) - - # Make the request - response = await client.get_global_site_tag(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGlobalSiteTag_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_global_site_tag_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_global_site_tag_sync.py deleted file mode 100644 index c6302280..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_global_site_tag_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetGlobalSiteTag -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGlobalSiteTag_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_global_site_tag(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetGlobalSiteTagRequest( - name="name_value", - ) - - # Make the request - response = client.get_global_site_tag(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGlobalSiteTag_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_google_signals_settings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_google_signals_settings_async.py deleted file mode 100644 index e4794413..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_google_signals_settings_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetGoogleSignalsSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGoogleSignalsSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_google_signals_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetGoogleSignalsSettingsRequest( - name="name_value", - ) - - # Make the request - response = await client.get_google_signals_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGoogleSignalsSettings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_google_signals_settings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_google_signals_settings_sync.py deleted file mode 100644 index 76f6c7b9..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_google_signals_settings_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetGoogleSignalsSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGoogleSignalsSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_google_signals_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetGoogleSignalsSettingsRequest( - name="name_value", - ) - - # Make the request - response = client.get_google_signals_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGoogleSignalsSettings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_measurement_protocol_secret_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_measurement_protocol_secret_async.py deleted file mode 100644 index adf4f8c9..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_measurement_protocol_secret_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetMeasurementProtocolSecret -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetMeasurementProtocolSecret_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetMeasurementProtocolSecretRequest( - name="name_value", - ) - - # Make the request - response = await client.get_measurement_protocol_secret(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetMeasurementProtocolSecret_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_measurement_protocol_secret_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_measurement_protocol_secret_sync.py deleted file mode 100644 index c3dbcd72..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_measurement_protocol_secret_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetMeasurementProtocolSecret -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetMeasurementProtocolSecret_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetMeasurementProtocolSecretRequest( - name="name_value", - ) - - # Make the request - response = client.get_measurement_protocol_secret(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetMeasurementProtocolSecret_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_property_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_property_async.py deleted file mode 100644 index cc081cb3..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_property_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetProperty -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetProperty_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetPropertyRequest( - name="name_value", - ) - - # Make the request - response = await client.get_property(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetProperty_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_property_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_property_sync.py deleted file mode 100644 index 872ab9dd..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_property_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetProperty -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetProperty_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetPropertyRequest( - name="name_value", - ) - - # Make the request - response = client.get_property(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetProperty_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_search_ads360_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_search_ads360_link_async.py deleted file mode 100644 index 202a0c22..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_search_ads360_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetSearchAds360Link -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetSearchAds360Link_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetSearchAds360LinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_search_ads360_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetSearchAds360Link_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_search_ads360_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_search_ads360_link_sync.py deleted file mode 100644 index bf835a6a..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_search_ads360_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetSearchAds360Link -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetSearchAds360Link_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetSearchAds360LinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_search_ads360_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetSearchAds360Link_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_sk_ad_network_conversion_value_schema_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_sk_ad_network_conversion_value_schema_async.py deleted file mode 100644 index de7632ba..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_sk_ad_network_conversion_value_schema_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetSKAdNetworkConversionValueSchema -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetSKAdNetworkConversionValueSchema_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetSKAdNetworkConversionValueSchemaRequest( - name="name_value", - ) - - # Make the request - response = await client.get_sk_ad_network_conversion_value_schema(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetSKAdNetworkConversionValueSchema_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_sk_ad_network_conversion_value_schema_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_sk_ad_network_conversion_value_schema_sync.py deleted file mode 100644 index 2eceae28..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_sk_ad_network_conversion_value_schema_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetSKAdNetworkConversionValueSchema -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetSKAdNetworkConversionValueSchema_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetSKAdNetworkConversionValueSchemaRequest( - name="name_value", - ) - - # Make the request - response = client.get_sk_ad_network_conversion_value_schema(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetSKAdNetworkConversionValueSchema_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_user_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_user_link_async.py deleted file mode 100644 index a943aaa1..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_user_link_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetUserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetUserLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_get_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetUserLinkRequest( - name="name_value", - ) - - # Make the request - response = await client.get_user_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetUserLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_user_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_user_link_sync.py deleted file mode 100644 index 89a30bee..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_get_user_link_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for GetUserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetUserLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_get_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.GetUserLinkRequest( - name="name_value", - ) - - # Make the request - response = client.get_user_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetUserLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_access_bindings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_access_bindings_async.py deleted file mode 100644 index 83b4bf37..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_access_bindings_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAccessBindings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccessBindings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAccessBindingsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_access_bindings(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccessBindings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_access_bindings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_access_bindings_sync.py deleted file mode 100644 index d328a533..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_access_bindings_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAccessBindings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccessBindings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_access_bindings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAccessBindingsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_access_bindings(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccessBindings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_account_summaries_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_account_summaries_async.py deleted file mode 100644 index 78c01602..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_account_summaries_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAccountSummaries -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccountSummaries_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_account_summaries(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAccountSummariesRequest( - ) - - # Make the request - page_result = client.list_account_summaries(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccountSummaries_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_account_summaries_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_account_summaries_sync.py deleted file mode 100644 index cf9aaa37..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_account_summaries_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAccountSummaries -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccountSummaries_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_account_summaries(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAccountSummariesRequest( - ) - - # Make the request - page_result = client.list_account_summaries(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccountSummaries_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_accounts_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_accounts_async.py deleted file mode 100644 index 61065587..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_accounts_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAccounts -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccounts_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_accounts(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAccountsRequest( - ) - - # Make the request - page_result = client.list_accounts(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccounts_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_accounts_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_accounts_sync.py deleted file mode 100644 index 4a45de36..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_accounts_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAccounts -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccounts_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_accounts(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAccountsRequest( - ) - - # Make the request - page_result = client.list_accounts(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccounts_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_ad_sense_links_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_ad_sense_links_async.py deleted file mode 100644 index f7ed9611..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_ad_sense_links_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAdSenseLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAdSenseLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_ad_sense_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAdSenseLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_ad_sense_links(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAdSenseLinks_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_ad_sense_links_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_ad_sense_links_sync.py deleted file mode 100644 index 52580251..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_ad_sense_links_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAdSenseLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAdSenseLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_ad_sense_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAdSenseLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_ad_sense_links(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAdSenseLinks_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_audiences_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_audiences_async.py deleted file mode 100644 index 2de8e68f..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_audiences_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAudiences -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAudiences_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_audiences(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAudiencesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_audiences(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAudiences_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_audiences_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_audiences_sync.py deleted file mode 100644 index bab0004e..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_audiences_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListAudiences -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAudiences_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_audiences(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListAudiencesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_audiences(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAudiences_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_big_query_links_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_big_query_links_async.py deleted file mode 100644 index af759e4b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_big_query_links_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListBigQueryLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListBigQueryLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_big_query_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListBigQueryLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_big_query_links(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListBigQueryLinks_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_big_query_links_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_big_query_links_sync.py deleted file mode 100644 index 161ffa25..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_big_query_links_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListBigQueryLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListBigQueryLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_big_query_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListBigQueryLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_big_query_links(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListBigQueryLinks_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_channel_groups_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_channel_groups_async.py deleted file mode 100644 index 82b8906a..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_channel_groups_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListChannelGroups -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListChannelGroups_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_channel_groups(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListChannelGroupsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_channel_groups(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListChannelGroups_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_channel_groups_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_channel_groups_sync.py deleted file mode 100644 index 67672e7b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_channel_groups_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListChannelGroups -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListChannelGroups_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_channel_groups(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListChannelGroupsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_channel_groups(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListChannelGroups_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_connected_site_tags_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_connected_site_tags_async.py deleted file mode 100644 index 06da2a52..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_connected_site_tags_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListConnectedSiteTags -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConnectedSiteTags_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_connected_site_tags(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListConnectedSiteTagsRequest( - ) - - # Make the request - response = await client.list_connected_site_tags(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConnectedSiteTags_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_connected_site_tags_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_connected_site_tags_sync.py deleted file mode 100644 index 22e541ca..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_connected_site_tags_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListConnectedSiteTags -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConnectedSiteTags_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_connected_site_tags(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListConnectedSiteTagsRequest( - ) - - # Make the request - response = client.list_connected_site_tags(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConnectedSiteTags_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_conversion_events_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_conversion_events_async.py deleted file mode 100644 index ece9ff5b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_conversion_events_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListConversionEvents -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConversionEvents_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_conversion_events(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListConversionEventsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_conversion_events(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConversionEvents_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_conversion_events_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_conversion_events_sync.py deleted file mode 100644 index 806f5f70..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_conversion_events_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListConversionEvents -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConversionEvents_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_conversion_events(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListConversionEventsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_conversion_events(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConversionEvents_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_dimensions_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_dimensions_async.py deleted file mode 100644 index c843a49f..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_dimensions_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCustomDimensions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomDimensions_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_custom_dimensions(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListCustomDimensionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_custom_dimensions(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomDimensions_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_dimensions_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_dimensions_sync.py deleted file mode 100644 index 97d9270b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_dimensions_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCustomDimensions -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomDimensions_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_custom_dimensions(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListCustomDimensionsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_custom_dimensions(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomDimensions_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_metrics_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_metrics_async.py deleted file mode 100644 index 3e326751..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_metrics_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCustomMetrics -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomMetrics_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_custom_metrics(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListCustomMetricsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_custom_metrics(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomMetrics_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_metrics_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_metrics_sync.py deleted file mode 100644 index 642964a8..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_metrics_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListCustomMetrics -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomMetrics_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_custom_metrics(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListCustomMetricsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_custom_metrics(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomMetrics_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_data_streams_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_data_streams_async.py deleted file mode 100644 index 64a6732c..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_data_streams_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListDataStreams -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDataStreams_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_data_streams(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListDataStreamsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_data_streams(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDataStreams_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_data_streams_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_data_streams_sync.py deleted file mode 100644 index d251db42..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_data_streams_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListDataStreams -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDataStreams_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_data_streams(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListDataStreamsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_data_streams(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDataStreams_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_link_proposals_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_link_proposals_async.py deleted file mode 100644 index 8fb9eb41..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_link_proposals_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListDisplayVideo360AdvertiserLinkProposals -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDisplayVideo360AdvertiserLinkProposals_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_display_video360_advertiser_link_proposals(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListDisplayVideo360AdvertiserLinkProposalsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_display_video360_advertiser_link_proposals(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDisplayVideo360AdvertiserLinkProposals_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_link_proposals_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_link_proposals_sync.py deleted file mode 100644 index 4f37bfff..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_link_proposals_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListDisplayVideo360AdvertiserLinkProposals -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDisplayVideo360AdvertiserLinkProposals_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_display_video360_advertiser_link_proposals(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListDisplayVideo360AdvertiserLinkProposalsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_display_video360_advertiser_link_proposals(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDisplayVideo360AdvertiserLinkProposals_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_links_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_links_async.py deleted file mode 100644 index 0e94b49b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_links_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListDisplayVideo360AdvertiserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDisplayVideo360AdvertiserLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_display_video360_advertiser_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListDisplayVideo360AdvertiserLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_display_video360_advertiser_links(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDisplayVideo360AdvertiserLinks_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_links_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_links_sync.py deleted file mode 100644 index f258ccbd..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_links_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListDisplayVideo360AdvertiserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDisplayVideo360AdvertiserLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_display_video360_advertiser_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListDisplayVideo360AdvertiserLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_display_video360_advertiser_links(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDisplayVideo360AdvertiserLinks_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_event_create_rules_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_event_create_rules_async.py deleted file mode 100644 index c12a5ed8..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_event_create_rules_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListEventCreateRules -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListEventCreateRules_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_event_create_rules(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListEventCreateRulesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_event_create_rules(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListEventCreateRules_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_event_create_rules_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_event_create_rules_sync.py deleted file mode 100644 index 17427733..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_event_create_rules_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListEventCreateRules -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListEventCreateRules_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_event_create_rules(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListEventCreateRulesRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_event_create_rules(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListEventCreateRules_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_expanded_data_sets_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_expanded_data_sets_async.py deleted file mode 100644 index f2390f26..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_expanded_data_sets_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListExpandedDataSets -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListExpandedDataSets_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_expanded_data_sets(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListExpandedDataSetsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_expanded_data_sets(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListExpandedDataSets_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_expanded_data_sets_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_expanded_data_sets_sync.py deleted file mode 100644 index 6cf60089..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_expanded_data_sets_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListExpandedDataSets -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListExpandedDataSets_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_expanded_data_sets(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListExpandedDataSetsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_expanded_data_sets(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListExpandedDataSets_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_firebase_links_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_firebase_links_async.py deleted file mode 100644 index 4b529f9a..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_firebase_links_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListFirebaseLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListFirebaseLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_firebase_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListFirebaseLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_firebase_links(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListFirebaseLinks_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_firebase_links_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_firebase_links_sync.py deleted file mode 100644 index 6852a4e8..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_firebase_links_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListFirebaseLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListFirebaseLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_firebase_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListFirebaseLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_firebase_links(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListFirebaseLinks_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_google_ads_links_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_google_ads_links_async.py deleted file mode 100644 index aee2b77b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_google_ads_links_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListGoogleAdsLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListGoogleAdsLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_google_ads_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListGoogleAdsLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_google_ads_links(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListGoogleAdsLinks_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_google_ads_links_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_google_ads_links_sync.py deleted file mode 100644 index 90cfeb8e..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_google_ads_links_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListGoogleAdsLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListGoogleAdsLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_google_ads_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListGoogleAdsLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_google_ads_links(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListGoogleAdsLinks_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_measurement_protocol_secrets_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_measurement_protocol_secrets_async.py deleted file mode 100644 index 048998b2..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_measurement_protocol_secrets_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListMeasurementProtocolSecrets -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListMeasurementProtocolSecrets_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_measurement_protocol_secrets(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListMeasurementProtocolSecretsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_measurement_protocol_secrets(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListMeasurementProtocolSecrets_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_measurement_protocol_secrets_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_measurement_protocol_secrets_sync.py deleted file mode 100644 index 39327273..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_measurement_protocol_secrets_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListMeasurementProtocolSecrets -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListMeasurementProtocolSecrets_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_measurement_protocol_secrets(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListMeasurementProtocolSecretsRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_measurement_protocol_secrets(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListMeasurementProtocolSecrets_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_properties_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_properties_async.py deleted file mode 100644 index 190707ba..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_properties_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListProperties -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListProperties_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_properties(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListPropertiesRequest( - filter="filter_value", - ) - - # Make the request - page_result = client.list_properties(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListProperties_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_properties_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_properties_sync.py deleted file mode 100644 index 75e28fdd..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_properties_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListProperties -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListProperties_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_properties(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListPropertiesRequest( - filter="filter_value", - ) - - # Make the request - page_result = client.list_properties(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListProperties_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_search_ads360_links_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_search_ads360_links_async.py deleted file mode 100644 index 8777ca4e..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_search_ads360_links_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListSearchAds360Links -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListSearchAds360Links_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_search_ads360_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListSearchAds360LinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_search_ads360_links(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListSearchAds360Links_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_search_ads360_links_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_search_ads360_links_sync.py deleted file mode 100644 index 21c53fec..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_search_ads360_links_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListSearchAds360Links -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListSearchAds360Links_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_search_ads360_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListSearchAds360LinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_search_ads360_links(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListSearchAds360Links_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_sk_ad_network_conversion_value_schemas_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_sk_ad_network_conversion_value_schemas_async.py deleted file mode 100644 index 32b766c0..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_sk_ad_network_conversion_value_schemas_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListSKAdNetworkConversionValueSchemas -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListSKAdNetworkConversionValueSchemas_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_sk_ad_network_conversion_value_schemas(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListSKAdNetworkConversionValueSchemasRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_sk_ad_network_conversion_value_schemas(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListSKAdNetworkConversionValueSchemas_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_sk_ad_network_conversion_value_schemas_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_sk_ad_network_conversion_value_schemas_sync.py deleted file mode 100644 index 558a8903..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_sk_ad_network_conversion_value_schemas_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListSKAdNetworkConversionValueSchemas -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListSKAdNetworkConversionValueSchemas_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_sk_ad_network_conversion_value_schemas(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListSKAdNetworkConversionValueSchemasRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_sk_ad_network_conversion_value_schemas(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListSKAdNetworkConversionValueSchemas_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_user_links_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_user_links_async.py deleted file mode 100644 index 22216ff7..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_user_links_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListUserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListUserLinks_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_list_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListUserLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_user_links(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListUserLinks_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_user_links_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_user_links_sync.py deleted file mode 100644 index 9079b068..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_list_user_links_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ListUserLinks -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListUserLinks_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_list_user_links(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ListUserLinksRequest( - parent="parent_value", - ) - - # Make the request - page_result = client.list_user_links(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListUserLinks_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_provision_account_ticket_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_provision_account_ticket_async.py deleted file mode 100644 index ef9cc477..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_provision_account_ticket_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ProvisionAccountTicket -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ProvisionAccountTicket_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_provision_account_ticket(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.ProvisionAccountTicketRequest( - ) - - # Make the request - response = await client.provision_account_ticket(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ProvisionAccountTicket_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_provision_account_ticket_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_provision_account_ticket_sync.py deleted file mode 100644 index ee06cc83..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_provision_account_ticket_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for ProvisionAccountTicket -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_ProvisionAccountTicket_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_provision_account_ticket(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.ProvisionAccountTicketRequest( - ) - - # Make the request - response = client.provision_account_ticket(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_ProvisionAccountTicket_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_run_access_report_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_run_access_report_async.py deleted file mode 100644 index 45158497..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_run_access_report_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RunAccessReport -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_RunAccessReport_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_run_access_report(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.RunAccessReportRequest( - ) - - # Make the request - response = await client.run_access_report(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_RunAccessReport_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_run_access_report_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_run_access_report_sync.py deleted file mode 100644 index a5aeb013..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_run_access_report_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for RunAccessReport -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_RunAccessReport_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_run_access_report(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.RunAccessReportRequest( - ) - - # Make the request - response = client.run_access_report(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_RunAccessReport_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_search_change_history_events_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_search_change_history_events_async.py deleted file mode 100644 index d3990ef9..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_search_change_history_events_async.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for SearchChangeHistoryEvents -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_SearchChangeHistoryEvents_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_search_change_history_events(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.SearchChangeHistoryEventsRequest( - account="account_value", - ) - - # Make the request - page_result = client.search_change_history_events(request=request) - - # Handle the response - async for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_SearchChangeHistoryEvents_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_search_change_history_events_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_search_change_history_events_sync.py deleted file mode 100644 index d5b31c45..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_search_change_history_events_sync.py +++ /dev/null @@ -1,53 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for SearchChangeHistoryEvents -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_SearchChangeHistoryEvents_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_search_change_history_events(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.SearchChangeHistoryEventsRequest( - account="account_value", - ) - - # Make the request - page_result = client.search_change_history_events(request=request) - - # Handle the response - for response in page_result: - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_SearchChangeHistoryEvents_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_set_automated_ga4_configuration_opt_out_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_set_automated_ga4_configuration_opt_out_async.py deleted file mode 100644 index a85e17c4..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_set_automated_ga4_configuration_opt_out_async.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for SetAutomatedGa4ConfigurationOptOut -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_SetAutomatedGa4ConfigurationOptOut_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_set_automated_ga4_configuration_opt_out(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.SetAutomatedGa4ConfigurationOptOutRequest( - property="property_value", - ) - - # Make the request - response = await client.set_automated_ga4_configuration_opt_out(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_SetAutomatedGa4ConfigurationOptOut_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_set_automated_ga4_configuration_opt_out_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_set_automated_ga4_configuration_opt_out_sync.py deleted file mode 100644 index c4906bca..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_set_automated_ga4_configuration_opt_out_sync.py +++ /dev/null @@ -1,52 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for SetAutomatedGa4ConfigurationOptOut -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_SetAutomatedGa4ConfigurationOptOut_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_set_automated_ga4_configuration_opt_out(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.SetAutomatedGa4ConfigurationOptOutRequest( - property="property_value", - ) - - # Make the request - response = client.set_automated_ga4_configuration_opt_out(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_SetAutomatedGa4ConfigurationOptOut_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_access_binding_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_access_binding_async.py deleted file mode 100644 index 25d2deac..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_access_binding_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateAccessBinding -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAccessBinding_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - access_binding = admin_v1alpha.AccessBinding() - access_binding.user = "user_value" - - request = admin_v1alpha.UpdateAccessBindingRequest( - access_binding=access_binding, - ) - - # Make the request - response = await client.update_access_binding(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAccessBinding_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_access_binding_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_access_binding_sync.py deleted file mode 100644 index 89489b84..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_access_binding_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateAccessBinding -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAccessBinding_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_access_binding(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - access_binding = admin_v1alpha.AccessBinding() - access_binding.user = "user_value" - - request = admin_v1alpha.UpdateAccessBindingRequest( - access_binding=access_binding, - ) - - # Make the request - response = client.update_access_binding(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAccessBinding_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_account_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_account_async.py deleted file mode 100644 index a1643c3e..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_account_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateAccount -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAccount_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_account(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - account = admin_v1alpha.Account() - account.display_name = "display_name_value" - - request = admin_v1alpha.UpdateAccountRequest( - account=account, - ) - - # Make the request - response = await client.update_account(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAccount_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_account_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_account_sync.py deleted file mode 100644 index 71f2e209..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_account_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateAccount -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAccount_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_account(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - account = admin_v1alpha.Account() - account.display_name = "display_name_value" - - request = admin_v1alpha.UpdateAccountRequest( - account=account, - ) - - # Make the request - response = client.update_account(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAccount_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_attribution_settings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_attribution_settings_async.py deleted file mode 100644 index c3f48fe1..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_attribution_settings_async.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateAttributionSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAttributionSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_attribution_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - attribution_settings = admin_v1alpha.AttributionSettings() - attribution_settings.acquisition_conversion_event_lookback_window = "ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS" - attribution_settings.other_conversion_event_lookback_window = "OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_90_DAYS" - attribution_settings.reporting_attribution_model = "GOOGLE_PAID_CHANNELS_LAST_CLICK" - attribution_settings.ads_web_conversion_data_export_scope = "GOOGLE_PAID_CHANNELS" - - request = admin_v1alpha.UpdateAttributionSettingsRequest( - attribution_settings=attribution_settings, - ) - - # Make the request - response = await client.update_attribution_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAttributionSettings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_attribution_settings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_attribution_settings_sync.py deleted file mode 100644 index 677b0ca6..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_attribution_settings_sync.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateAttributionSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAttributionSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_attribution_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - attribution_settings = admin_v1alpha.AttributionSettings() - attribution_settings.acquisition_conversion_event_lookback_window = "ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS" - attribution_settings.other_conversion_event_lookback_window = "OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_90_DAYS" - attribution_settings.reporting_attribution_model = "GOOGLE_PAID_CHANNELS_LAST_CLICK" - attribution_settings.ads_web_conversion_data_export_scope = "GOOGLE_PAID_CHANNELS" - - request = admin_v1alpha.UpdateAttributionSettingsRequest( - attribution_settings=attribution_settings, - ) - - # Make the request - response = client.update_attribution_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAttributionSettings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_audience_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_audience_async.py deleted file mode 100644 index 15142040..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_audience_async.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateAudience -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAudience_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - audience = admin_v1alpha.Audience() - audience.display_name = "display_name_value" - audience.description = "description_value" - audience.membership_duration_days = 2561 - audience.filter_clauses.simple_filter.scope = "AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS" - audience.filter_clauses.clause_type = "EXCLUDE" - - request = admin_v1alpha.UpdateAudienceRequest( - audience=audience, - ) - - # Make the request - response = await client.update_audience(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAudience_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_audience_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_audience_sync.py deleted file mode 100644 index 4822618e..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_audience_sync.py +++ /dev/null @@ -1,59 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateAudience -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAudience_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_audience(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - audience = admin_v1alpha.Audience() - audience.display_name = "display_name_value" - audience.description = "description_value" - audience.membership_duration_days = 2561 - audience.filter_clauses.simple_filter.scope = "AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS" - audience.filter_clauses.clause_type = "EXCLUDE" - - request = admin_v1alpha.UpdateAudienceRequest( - audience=audience, - ) - - # Make the request - response = client.update_audience(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAudience_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_channel_group_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_channel_group_async.py deleted file mode 100644 index 2f1612a2..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_channel_group_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateChannelGroup -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateChannelGroup_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - channel_group = admin_v1alpha.ChannelGroup() - channel_group.display_name = "display_name_value" - channel_group.grouping_rule.display_name = "display_name_value" - - request = admin_v1alpha.UpdateChannelGroupRequest( - channel_group=channel_group, - ) - - # Make the request - response = await client.update_channel_group(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateChannelGroup_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_channel_group_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_channel_group_sync.py deleted file mode 100644 index 41716e54..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_channel_group_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateChannelGroup -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateChannelGroup_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_channel_group(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - channel_group = admin_v1alpha.ChannelGroup() - channel_group.display_name = "display_name_value" - channel_group.grouping_rule.display_name = "display_name_value" - - request = admin_v1alpha.UpdateChannelGroupRequest( - channel_group=channel_group, - ) - - # Make the request - response = client.update_channel_group(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateChannelGroup_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_async.py deleted file mode 100644 index 80f3f20f..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateConversionEvent -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateConversionEvent_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateConversionEventRequest( - ) - - # Make the request - response = await client.update_conversion_event(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateConversionEvent_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_sync.py deleted file mode 100644 index 1cd10a15..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateConversionEvent -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateConversionEvent_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_conversion_event(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateConversionEventRequest( - ) - - # Make the request - response = client.update_conversion_event(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateConversionEvent_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_dimension_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_dimension_async.py deleted file mode 100644 index 4bcffbbc..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_dimension_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCustomDimension -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomDimension_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateCustomDimensionRequest( - ) - - # Make the request - response = await client.update_custom_dimension(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomDimension_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_dimension_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_dimension_sync.py deleted file mode 100644 index 9b27cb40..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_dimension_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCustomDimension -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomDimension_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_custom_dimension(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateCustomDimensionRequest( - ) - - # Make the request - response = client.update_custom_dimension(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomDimension_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_metric_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_metric_async.py deleted file mode 100644 index afe01557..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_metric_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCustomMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomMetric_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateCustomMetricRequest( - ) - - # Make the request - response = await client.update_custom_metric(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomMetric_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_metric_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_metric_sync.py deleted file mode 100644 index 555805f4..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_metric_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateCustomMetric -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomMetric_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_custom_metric(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateCustomMetricRequest( - ) - - # Make the request - response = client.update_custom_metric(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomMetric_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_retention_settings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_retention_settings_async.py deleted file mode 100644 index c4f964f2..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_retention_settings_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateDataRetentionSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataRetentionSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_data_retention_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateDataRetentionSettingsRequest( - ) - - # Make the request - response = await client.update_data_retention_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataRetentionSettings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_retention_settings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_retention_settings_sync.py deleted file mode 100644 index ed94955f..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_retention_settings_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateDataRetentionSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataRetentionSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_data_retention_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateDataRetentionSettingsRequest( - ) - - # Make the request - response = client.update_data_retention_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataRetentionSettings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_stream_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_stream_async.py deleted file mode 100644 index 622f47cb..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_stream_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateDataStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataStream_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateDataStreamRequest( - ) - - # Make the request - response = await client.update_data_stream(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataStream_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_stream_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_stream_sync.py deleted file mode 100644 index 22558fac..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_stream_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateDataStream -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataStream_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_data_stream(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateDataStreamRequest( - ) - - # Make the request - response = client.update_data_stream(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataStream_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_display_video360_advertiser_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_display_video360_advertiser_link_async.py deleted file mode 100644 index 1e36798f..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_display_video360_advertiser_link_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateDisplayVideo360AdvertiserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDisplayVideo360AdvertiserLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateDisplayVideo360AdvertiserLinkRequest( - ) - - # Make the request - response = await client.update_display_video360_advertiser_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDisplayVideo360AdvertiserLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_display_video360_advertiser_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_display_video360_advertiser_link_sync.py deleted file mode 100644 index de39c343..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_display_video360_advertiser_link_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateDisplayVideo360AdvertiserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDisplayVideo360AdvertiserLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_display_video360_advertiser_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateDisplayVideo360AdvertiserLinkRequest( - ) - - # Make the request - response = client.update_display_video360_advertiser_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDisplayVideo360AdvertiserLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_enhanced_measurement_settings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_enhanced_measurement_settings_async.py deleted file mode 100644 index d555d216..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_enhanced_measurement_settings_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateEnhancedMeasurementSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateEnhancedMeasurementSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_enhanced_measurement_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - enhanced_measurement_settings = admin_v1alpha.EnhancedMeasurementSettings() - enhanced_measurement_settings.search_query_parameter = "search_query_parameter_value" - - request = admin_v1alpha.UpdateEnhancedMeasurementSettingsRequest( - enhanced_measurement_settings=enhanced_measurement_settings, - ) - - # Make the request - response = await client.update_enhanced_measurement_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateEnhancedMeasurementSettings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_enhanced_measurement_settings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_enhanced_measurement_settings_sync.py deleted file mode 100644 index eeb646c7..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_enhanced_measurement_settings_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateEnhancedMeasurementSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateEnhancedMeasurementSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_enhanced_measurement_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - enhanced_measurement_settings = admin_v1alpha.EnhancedMeasurementSettings() - enhanced_measurement_settings.search_query_parameter = "search_query_parameter_value" - - request = admin_v1alpha.UpdateEnhancedMeasurementSettingsRequest( - enhanced_measurement_settings=enhanced_measurement_settings, - ) - - # Make the request - response = client.update_enhanced_measurement_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateEnhancedMeasurementSettings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_event_create_rule_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_event_create_rule_async.py deleted file mode 100644 index 0e0f714b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_event_create_rule_async.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateEventCreateRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateEventCreateRule_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - event_create_rule = admin_v1alpha.EventCreateRule() - event_create_rule.destination_event = "destination_event_value" - event_create_rule.event_conditions.field = "field_value" - event_create_rule.event_conditions.comparison_type = "REGULAR_EXPRESSION_CASE_INSENSITIVE" - event_create_rule.event_conditions.value = "value_value" - - request = admin_v1alpha.UpdateEventCreateRuleRequest( - event_create_rule=event_create_rule, - ) - - # Make the request - response = await client.update_event_create_rule(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateEventCreateRule_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_event_create_rule_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_event_create_rule_sync.py deleted file mode 100644 index b6a91ca8..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_event_create_rule_sync.py +++ /dev/null @@ -1,58 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateEventCreateRule -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateEventCreateRule_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_event_create_rule(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - event_create_rule = admin_v1alpha.EventCreateRule() - event_create_rule.destination_event = "destination_event_value" - event_create_rule.event_conditions.field = "field_value" - event_create_rule.event_conditions.comparison_type = "REGULAR_EXPRESSION_CASE_INSENSITIVE" - event_create_rule.event_conditions.value = "value_value" - - request = admin_v1alpha.UpdateEventCreateRuleRequest( - event_create_rule=event_create_rule, - ) - - # Make the request - response = client.update_event_create_rule(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateEventCreateRule_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_expanded_data_set_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_expanded_data_set_async.py deleted file mode 100644 index d8a09e4c..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_expanded_data_set_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateExpandedDataSet -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateExpandedDataSet_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - expanded_data_set = admin_v1alpha.ExpandedDataSet() - expanded_data_set.display_name = "display_name_value" - - request = admin_v1alpha.UpdateExpandedDataSetRequest( - expanded_data_set=expanded_data_set, - ) - - # Make the request - response = await client.update_expanded_data_set(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateExpandedDataSet_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_expanded_data_set_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_expanded_data_set_sync.py deleted file mode 100644 index 54ae82cf..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_expanded_data_set_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateExpandedDataSet -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateExpandedDataSet_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_expanded_data_set(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - expanded_data_set = admin_v1alpha.ExpandedDataSet() - expanded_data_set.display_name = "display_name_value" - - request = admin_v1alpha.UpdateExpandedDataSetRequest( - expanded_data_set=expanded_data_set, - ) - - # Make the request - response = client.update_expanded_data_set(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateExpandedDataSet_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_ads_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_ads_link_async.py deleted file mode 100644 index cfcd7a58..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_ads_link_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateGoogleAdsLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleAdsLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_google_ads_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateGoogleAdsLinkRequest( - ) - - # Make the request - response = await client.update_google_ads_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleAdsLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_ads_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_ads_link_sync.py deleted file mode 100644 index 2ca57e32..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_ads_link_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateGoogleAdsLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleAdsLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_google_ads_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateGoogleAdsLinkRequest( - ) - - # Make the request - response = client.update_google_ads_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleAdsLink_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_signals_settings_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_signals_settings_async.py deleted file mode 100644 index 7d117776..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_signals_settings_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateGoogleSignalsSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleSignalsSettings_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_google_signals_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateGoogleSignalsSettingsRequest( - ) - - # Make the request - response = await client.update_google_signals_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleSignalsSettings_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_signals_settings_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_signals_settings_sync.py deleted file mode 100644 index 6fefdda8..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_signals_settings_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateGoogleSignalsSettings -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleSignalsSettings_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_google_signals_settings(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateGoogleSignalsSettingsRequest( - ) - - # Make the request - response = client.update_google_signals_settings(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleSignalsSettings_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_measurement_protocol_secret_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_measurement_protocol_secret_async.py deleted file mode 100644 index fa2adf76..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_measurement_protocol_secret_async.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateMeasurementProtocolSecret -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateMeasurementProtocolSecret_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - measurement_protocol_secret = admin_v1alpha.MeasurementProtocolSecret() - measurement_protocol_secret.display_name = "display_name_value" - - request = admin_v1alpha.UpdateMeasurementProtocolSecretRequest( - measurement_protocol_secret=measurement_protocol_secret, - ) - - # Make the request - response = await client.update_measurement_protocol_secret(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateMeasurementProtocolSecret_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_measurement_protocol_secret_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_measurement_protocol_secret_sync.py deleted file mode 100644 index dc89e30d..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_measurement_protocol_secret_sync.py +++ /dev/null @@ -1,55 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateMeasurementProtocolSecret -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateMeasurementProtocolSecret_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_measurement_protocol_secret(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - measurement_protocol_secret = admin_v1alpha.MeasurementProtocolSecret() - measurement_protocol_secret.display_name = "display_name_value" - - request = admin_v1alpha.UpdateMeasurementProtocolSecretRequest( - measurement_protocol_secret=measurement_protocol_secret, - ) - - # Make the request - response = client.update_measurement_protocol_secret(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateMeasurementProtocolSecret_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_property_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_property_async.py deleted file mode 100644 index 53ba2895..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_property_async.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateProperty -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateProperty_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - property = admin_v1alpha.Property() - property.display_name = "display_name_value" - property.time_zone = "time_zone_value" - - request = admin_v1alpha.UpdatePropertyRequest( - property=property, - ) - - # Make the request - response = await client.update_property(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateProperty_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_property_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_property_sync.py deleted file mode 100644 index c66a0a83..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_property_sync.py +++ /dev/null @@ -1,56 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateProperty -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateProperty_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_property(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - property = admin_v1alpha.Property() - property.display_name = "display_name_value" - property.time_zone = "time_zone_value" - - request = admin_v1alpha.UpdatePropertyRequest( - property=property, - ) - - # Make the request - response = client.update_property(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateProperty_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_search_ads360_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_search_ads360_link_async.py deleted file mode 100644 index ba78a728..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_search_ads360_link_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateSearchAds360Link -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateSearchAds360Link_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateSearchAds360LinkRequest( - ) - - # Make the request - response = await client.update_search_ads360_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateSearchAds360Link_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_search_ads360_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_search_ads360_link_sync.py deleted file mode 100644 index a079b11d..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_search_ads360_link_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateSearchAds360Link -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateSearchAds360Link_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_search_ads360_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateSearchAds360LinkRequest( - ) - - # Make the request - response = client.update_search_ads360_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateSearchAds360Link_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_sk_ad_network_conversion_value_schema_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_sk_ad_network_conversion_value_schema_async.py deleted file mode 100644 index 2324953f..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_sk_ad_network_conversion_value_schema_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateSKAdNetworkConversionValueSchema -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateSKAdNetworkConversionValueSchema_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateSKAdNetworkConversionValueSchemaRequest( - ) - - # Make the request - response = await client.update_sk_ad_network_conversion_value_schema(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateSKAdNetworkConversionValueSchema_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_sk_ad_network_conversion_value_schema_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_sk_ad_network_conversion_value_schema_sync.py deleted file mode 100644 index 16d9c2d6..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_sk_ad_network_conversion_value_schema_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateSKAdNetworkConversionValueSchema -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateSKAdNetworkConversionValueSchema_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_sk_ad_network_conversion_value_schema(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateSKAdNetworkConversionValueSchemaRequest( - ) - - # Make the request - response = client.update_sk_ad_network_conversion_value_schema(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateSKAdNetworkConversionValueSchema_sync] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_user_link_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_user_link_async.py deleted file mode 100644 index d445c62b..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_user_link_async.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateUserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateUserLink_async] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -async def sample_update_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateUserLinkRequest( - ) - - # Make the request - response = await client.update_user_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateUserLink_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_user_link_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_user_link_sync.py deleted file mode 100644 index d9fbdb8c..00000000 --- a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_user_link_sync.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -# Generated code. DO NOT EDIT! -# -# Snippet for UpdateUserLink -# NOTE: This snippet has been automatically generated for illustrative purposes only. -# It may require modifications to work in your environment. - -# To install the latest published package dependency, execute the following: -# python3 -m pip install google-analytics-admin - - -# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateUserLink_sync] -# This snippet has been automatically generated and should be regarded as a -# code template only. -# It will require modifications to work: -# - It may require correct/in-range values for request initialization. -# - It may require specifying regional endpoints when creating the service -# client as shown in: -# https://googleapis.dev/python/google-api-core/latest/client_options.html -from google.analytics import admin_v1alpha - - -def sample_update_user_link(): - # Create a client - client = admin_v1alpha.AnalyticsAdminServiceClient() - - # Initialize request argument(s) - request = admin_v1alpha.UpdateUserLinkRequest( - ) - - # Make the request - response = client.update_user_link(request=request) - - # Handle the response - print(response) - -# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateUserLink_sync] diff --git a/samples/generated_samples/snippet_metadata_google.analytics.admin.v1alpha.json b/samples/generated_samples/snippet_metadata_google.analytics.admin.v1alpha.json deleted file mode 100644 index a5fab6b1..00000000 --- a/samples/generated_samples/snippet_metadata_google.analytics.admin.v1alpha.json +++ /dev/null @@ -1,20587 +0,0 @@ -{ - "clientLibrary": { - "apis": [ - { - "id": "google.analytics.admin.v1alpha", - "version": "v1alpha" - } - ], - "language": "PYTHON", - "name": "google-analytics-admin", - "version": "0.21.0" - }, - "snippets": [ - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.acknowledge_user_data_collection", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.AcknowledgeUserDataCollection", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "AcknowledgeUserDataCollection" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionResponse", - "shortName": "acknowledge_user_data_collection" - }, - "description": "Sample for AcknowledgeUserDataCollection", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_acknowledge_user_data_collection_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_AcknowledgeUserDataCollection_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_acknowledge_user_data_collection_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.acknowledge_user_data_collection", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.AcknowledgeUserDataCollection", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "AcknowledgeUserDataCollection" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AcknowledgeUserDataCollectionResponse", - "shortName": "acknowledge_user_data_collection" - }, - "description": "Sample for AcknowledgeUserDataCollection", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_acknowledge_user_data_collection_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_AcknowledgeUserDataCollection_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_acknowledge_user_data_collection_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.approve_display_video360_advertiser_link_proposal", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ApproveDisplayVideo360AdvertiserLinkProposal", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ApproveDisplayVideo360AdvertiserLinkProposal" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalResponse", - "shortName": "approve_display_video360_advertiser_link_proposal" - }, - "description": "Sample for ApproveDisplayVideo360AdvertiserLinkProposal", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_approve_display_video360_advertiser_link_proposal_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ApproveDisplayVideo360AdvertiserLinkProposal_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_approve_display_video360_advertiser_link_proposal_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.approve_display_video360_advertiser_link_proposal", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ApproveDisplayVideo360AdvertiserLinkProposal", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ApproveDisplayVideo360AdvertiserLinkProposal" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalResponse", - "shortName": "approve_display_video360_advertiser_link_proposal" - }, - "description": "Sample for ApproveDisplayVideo360AdvertiserLinkProposal", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_approve_display_video360_advertiser_link_proposal_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ApproveDisplayVideo360AdvertiserLinkProposal_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_approve_display_video360_advertiser_link_proposal_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.archive_audience", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ArchiveAudience", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ArchiveAudience" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ArchiveAudienceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "archive_audience" - }, - "description": "Sample for ArchiveAudience", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_archive_audience_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveAudience_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_archive_audience_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.archive_audience", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ArchiveAudience", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ArchiveAudience" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ArchiveAudienceRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "archive_audience" - }, - "description": "Sample for ArchiveAudience", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_archive_audience_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveAudience_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_archive_audience_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.archive_custom_dimension", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ArchiveCustomDimension", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ArchiveCustomDimension" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ArchiveCustomDimensionRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "archive_custom_dimension" - }, - "description": "Sample for ArchiveCustomDimension", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_dimension_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomDimension_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_dimension_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.archive_custom_dimension", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ArchiveCustomDimension", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ArchiveCustomDimension" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ArchiveCustomDimensionRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "archive_custom_dimension" - }, - "description": "Sample for ArchiveCustomDimension", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_dimension_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomDimension_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_dimension_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.archive_custom_metric", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ArchiveCustomMetric", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ArchiveCustomMetric" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ArchiveCustomMetricRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "archive_custom_metric" - }, - "description": "Sample for ArchiveCustomMetric", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_metric_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomMetric_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_metric_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.archive_custom_metric", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ArchiveCustomMetric", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ArchiveCustomMetric" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ArchiveCustomMetricRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "archive_custom_metric" - }, - "description": "Sample for ArchiveCustomMetric", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_metric_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ArchiveCustomMetric_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_archive_custom_metric_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.audit_user_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.AuditUserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "AuditUserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.AuditUserLinksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.AuditUserLinksAsyncPager", - "shortName": "audit_user_links" - }, - "description": "Sample for AuditUserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_audit_user_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_AuditUserLinks_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_audit_user_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.audit_user_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.AuditUserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "AuditUserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.AuditUserLinksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.AuditUserLinksPager", - "shortName": "audit_user_links" - }, - "description": "Sample for AuditUserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_audit_user_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_AuditUserLinks_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_audit_user_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.batch_create_access_bindings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchCreateAccessBindings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchCreateAccessBindings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsResponse", - "shortName": "batch_create_access_bindings" - }, - "description": "Sample for BatchCreateAccessBindings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_access_bindings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchCreateAccessBindings_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_access_bindings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.batch_create_access_bindings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchCreateAccessBindings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchCreateAccessBindings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BatchCreateAccessBindingsResponse", - "shortName": "batch_create_access_bindings" - }, - "description": "Sample for BatchCreateAccessBindings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_access_bindings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchCreateAccessBindings_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_access_bindings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.batch_create_user_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchCreateUserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchCreateUserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchCreateUserLinksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BatchCreateUserLinksResponse", - "shortName": "batch_create_user_links" - }, - "description": "Sample for BatchCreateUserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_user_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchCreateUserLinks_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_user_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.batch_create_user_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchCreateUserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchCreateUserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchCreateUserLinksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BatchCreateUserLinksResponse", - "shortName": "batch_create_user_links" - }, - "description": "Sample for BatchCreateUserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_user_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchCreateUserLinks_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_create_user_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.batch_delete_access_bindings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchDeleteAccessBindings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchDeleteAccessBindings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchDeleteAccessBindingsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "batch_delete_access_bindings" - }, - "description": "Sample for BatchDeleteAccessBindings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_access_bindings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchDeleteAccessBindings_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_access_bindings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.batch_delete_access_bindings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchDeleteAccessBindings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchDeleteAccessBindings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchDeleteAccessBindingsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "batch_delete_access_bindings" - }, - "description": "Sample for BatchDeleteAccessBindings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_access_bindings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchDeleteAccessBindings_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_access_bindings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.batch_delete_user_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchDeleteUserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchDeleteUserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchDeleteUserLinksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "batch_delete_user_links" - }, - "description": "Sample for BatchDeleteUserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_user_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchDeleteUserLinks_async", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_user_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.batch_delete_user_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchDeleteUserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchDeleteUserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchDeleteUserLinksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "batch_delete_user_links" - }, - "description": "Sample for BatchDeleteUserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_user_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchDeleteUserLinks_sync", - "segments": [ - { - "end": 53, - "start": 27, - "type": "FULL" - }, - { - "end": 53, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_delete_user_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.batch_get_access_bindings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchGetAccessBindings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchGetAccessBindings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchGetAccessBindingsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BatchGetAccessBindingsResponse", - "shortName": "batch_get_access_bindings" - }, - "description": "Sample for BatchGetAccessBindings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_access_bindings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchGetAccessBindings_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_access_bindings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.batch_get_access_bindings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchGetAccessBindings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchGetAccessBindings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchGetAccessBindingsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BatchGetAccessBindingsResponse", - "shortName": "batch_get_access_bindings" - }, - "description": "Sample for BatchGetAccessBindings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_access_bindings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchGetAccessBindings_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_access_bindings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.batch_get_user_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchGetUserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchGetUserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchGetUserLinksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BatchGetUserLinksResponse", - "shortName": "batch_get_user_links" - }, - "description": "Sample for BatchGetUserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_user_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchGetUserLinks_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_user_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.batch_get_user_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchGetUserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchGetUserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchGetUserLinksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BatchGetUserLinksResponse", - "shortName": "batch_get_user_links" - }, - "description": "Sample for BatchGetUserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_user_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchGetUserLinks_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 46, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 49, - "start": 47, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_get_user_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.batch_update_access_bindings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchUpdateAccessBindings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchUpdateAccessBindings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsResponse", - "shortName": "batch_update_access_bindings" - }, - "description": "Sample for BatchUpdateAccessBindings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_access_bindings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchUpdateAccessBindings_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_access_bindings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.batch_update_access_bindings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchUpdateAccessBindings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchUpdateAccessBindings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BatchUpdateAccessBindingsResponse", - "shortName": "batch_update_access_bindings" - }, - "description": "Sample for BatchUpdateAccessBindings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_access_bindings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchUpdateAccessBindings_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_access_bindings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.batch_update_user_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchUpdateUserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchUpdateUserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchUpdateUserLinksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BatchUpdateUserLinksResponse", - "shortName": "batch_update_user_links" - }, - "description": "Sample for BatchUpdateUserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_user_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchUpdateUserLinks_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_user_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.batch_update_user_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.BatchUpdateUserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "BatchUpdateUserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.BatchUpdateUserLinksRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BatchUpdateUserLinksResponse", - "shortName": "batch_update_user_links" - }, - "description": "Sample for BatchUpdateUserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_user_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_BatchUpdateUserLinks_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_batch_update_user_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.cancel_display_video360_advertiser_link_proposal", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CancelDisplayVideo360AdvertiserLinkProposal", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CancelDisplayVideo360AdvertiserLinkProposal" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CancelDisplayVideo360AdvertiserLinkProposalRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal", - "shortName": "cancel_display_video360_advertiser_link_proposal" - }, - "description": "Sample for CancelDisplayVideo360AdvertiserLinkProposal", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_cancel_display_video360_advertiser_link_proposal_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CancelDisplayVideo360AdvertiserLinkProposal_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_cancel_display_video360_advertiser_link_proposal_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.cancel_display_video360_advertiser_link_proposal", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CancelDisplayVideo360AdvertiserLinkProposal", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CancelDisplayVideo360AdvertiserLinkProposal" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CancelDisplayVideo360AdvertiserLinkProposalRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal", - "shortName": "cancel_display_video360_advertiser_link_proposal" - }, - "description": "Sample for CancelDisplayVideo360AdvertiserLinkProposal", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_cancel_display_video360_advertiser_link_proposal_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CancelDisplayVideo360AdvertiserLinkProposal_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_cancel_display_video360_advertiser_link_proposal_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_access_binding", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateAccessBinding", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateAccessBinding" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateAccessBindingRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "access_binding", - "type": "google.analytics.admin_v1alpha.types.AccessBinding" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AccessBinding", - "shortName": "create_access_binding" - }, - "description": "Sample for CreateAccessBinding", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_access_binding_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAccessBinding_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_access_binding_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_access_binding", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateAccessBinding", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateAccessBinding" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateAccessBindingRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "access_binding", - "type": "google.analytics.admin_v1alpha.types.AccessBinding" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AccessBinding", - "shortName": "create_access_binding" - }, - "description": "Sample for CreateAccessBinding", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_access_binding_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAccessBinding_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_access_binding_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_ad_sense_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateAdSenseLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateAdSenseLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateAdSenseLinkRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "adsense_link", - "type": "google.analytics.admin_v1alpha.types.AdSenseLink" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AdSenseLink", - "shortName": "create_ad_sense_link" - }, - "description": "Sample for CreateAdSenseLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_ad_sense_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAdSenseLink_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_ad_sense_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_ad_sense_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateAdSenseLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateAdSenseLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateAdSenseLinkRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "adsense_link", - "type": "google.analytics.admin_v1alpha.types.AdSenseLink" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AdSenseLink", - "shortName": "create_ad_sense_link" - }, - "description": "Sample for CreateAdSenseLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_ad_sense_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAdSenseLink_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_ad_sense_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_audience", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateAudience", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateAudience" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateAudienceRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "audience", - "type": "google.analytics.admin_v1alpha.types.Audience" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Audience", - "shortName": "create_audience" - }, - "description": "Sample for CreateAudience", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_audience_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAudience_async", - "segments": [ - { - "end": 59, - "start": 27, - "type": "FULL" - }, - { - "end": 59, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 53, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 56, - "start": 54, - "type": "REQUEST_EXECUTION" - }, - { - "end": 60, - "start": 57, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_audience_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_audience", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateAudience", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateAudience" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateAudienceRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "audience", - "type": "google.analytics.admin_v1alpha.types.Audience" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Audience", - "shortName": "create_audience" - }, - "description": "Sample for CreateAudience", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_audience_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateAudience_sync", - "segments": [ - { - "end": 59, - "start": 27, - "type": "FULL" - }, - { - "end": 59, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 53, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 56, - "start": 54, - "type": "REQUEST_EXECUTION" - }, - { - "end": 60, - "start": 57, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_audience_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_channel_group", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateChannelGroup", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateChannelGroup" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateChannelGroupRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "channel_group", - "type": "google.analytics.admin_v1alpha.types.ChannelGroup" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ChannelGroup", - "shortName": "create_channel_group" - }, - "description": "Sample for CreateChannelGroup", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_channel_group_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateChannelGroup_async", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_channel_group_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_channel_group", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateChannelGroup", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateChannelGroup" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateChannelGroupRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "channel_group", - "type": "google.analytics.admin_v1alpha.types.ChannelGroup" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ChannelGroup", - "shortName": "create_channel_group" - }, - "description": "Sample for CreateChannelGroup", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_channel_group_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateChannelGroup_sync", - "segments": [ - { - "end": 56, - "start": 27, - "type": "FULL" - }, - { - "end": 56, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 50, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 53, - "start": 51, - "type": "REQUEST_EXECUTION" - }, - { - "end": 57, - "start": 54, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_channel_group_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_connected_site_tag", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateConnectedSiteTag", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateConnectedSiteTag" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateConnectedSiteTagRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CreateConnectedSiteTagResponse", - "shortName": "create_connected_site_tag" - }, - "description": "Sample for CreateConnectedSiteTag", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_connected_site_tag_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConnectedSiteTag_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_connected_site_tag_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_connected_site_tag", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateConnectedSiteTag", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateConnectedSiteTag" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateConnectedSiteTagRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CreateConnectedSiteTagResponse", - "shortName": "create_connected_site_tag" - }, - "description": "Sample for CreateConnectedSiteTag", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_connected_site_tag_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConnectedSiteTag_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_connected_site_tag_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_conversion_event", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateConversionEvent", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateConversionEvent" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateConversionEventRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "conversion_event", - "type": "google.analytics.admin_v1alpha.types.ConversionEvent" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ConversionEvent", - "shortName": "create_conversion_event" - }, - "description": "Sample for CreateConversionEvent", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_conversion_event_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConversionEvent_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_conversion_event_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_conversion_event", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateConversionEvent", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateConversionEvent" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateConversionEventRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "conversion_event", - "type": "google.analytics.admin_v1alpha.types.ConversionEvent" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ConversionEvent", - "shortName": "create_conversion_event" - }, - "description": "Sample for CreateConversionEvent", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_conversion_event_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateConversionEvent_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_conversion_event_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_custom_dimension", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateCustomDimension", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateCustomDimension" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateCustomDimensionRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "custom_dimension", - "type": "google.analytics.admin_v1alpha.types.CustomDimension" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CustomDimension", - "shortName": "create_custom_dimension" - }, - "description": "Sample for CreateCustomDimension", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_dimension_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomDimension_async", - "segments": [ - { - "end": 57, - "start": 27, - "type": "FULL" - }, - { - "end": 57, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 54, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 58, - "start": 55, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_dimension_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_custom_dimension", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateCustomDimension", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateCustomDimension" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateCustomDimensionRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "custom_dimension", - "type": "google.analytics.admin_v1alpha.types.CustomDimension" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CustomDimension", - "shortName": "create_custom_dimension" - }, - "description": "Sample for CreateCustomDimension", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_dimension_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomDimension_sync", - "segments": [ - { - "end": 57, - "start": 27, - "type": "FULL" - }, - { - "end": 57, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 54, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 58, - "start": 55, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_dimension_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_custom_metric", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateCustomMetric", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateCustomMetric" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateCustomMetricRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "custom_metric", - "type": "google.analytics.admin_v1alpha.types.CustomMetric" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CustomMetric", - "shortName": "create_custom_metric" - }, - "description": "Sample for CreateCustomMetric", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_metric_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomMetric_async", - "segments": [ - { - "end": 58, - "start": 27, - "type": "FULL" - }, - { - "end": 58, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 55, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 59, - "start": 56, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_metric_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_custom_metric", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateCustomMetric", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateCustomMetric" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateCustomMetricRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "custom_metric", - "type": "google.analytics.admin_v1alpha.types.CustomMetric" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CustomMetric", - "shortName": "create_custom_metric" - }, - "description": "Sample for CreateCustomMetric", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_metric_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateCustomMetric_sync", - "segments": [ - { - "end": 58, - "start": 27, - "type": "FULL" - }, - { - "end": 58, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 55, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 59, - "start": 56, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_custom_metric_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_data_stream", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateDataStream", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateDataStream" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateDataStreamRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "data_stream", - "type": "google.analytics.admin_v1alpha.types.DataStream" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DataStream", - "shortName": "create_data_stream" - }, - "description": "Sample for CreateDataStream", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_data_stream_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDataStream_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_data_stream_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_data_stream", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateDataStream", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateDataStream" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateDataStreamRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "data_stream", - "type": "google.analytics.admin_v1alpha.types.DataStream" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DataStream", - "shortName": "create_data_stream" - }, - "description": "Sample for CreateDataStream", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_data_stream_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDataStream_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_data_stream_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_display_video360_advertiser_link_proposal", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateDisplayVideo360AdvertiserLinkProposal", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateDisplayVideo360AdvertiserLinkProposal" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkProposalRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "display_video_360_advertiser_link_proposal", - "type": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal", - "shortName": "create_display_video360_advertiser_link_proposal" - }, - "description": "Sample for CreateDisplayVideo360AdvertiserLinkProposal", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_proposal_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDisplayVideo360AdvertiserLinkProposal_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_proposal_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_display_video360_advertiser_link_proposal", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateDisplayVideo360AdvertiserLinkProposal", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateDisplayVideo360AdvertiserLinkProposal" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkProposalRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "display_video_360_advertiser_link_proposal", - "type": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal", - "shortName": "create_display_video360_advertiser_link_proposal" - }, - "description": "Sample for CreateDisplayVideo360AdvertiserLinkProposal", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_proposal_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDisplayVideo360AdvertiserLinkProposal_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_proposal_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_display_video360_advertiser_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateDisplayVideo360AdvertiserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateDisplayVideo360AdvertiserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "display_video_360_advertiser_link", - "type": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink", - "shortName": "create_display_video360_advertiser_link" - }, - "description": "Sample for CreateDisplayVideo360AdvertiserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDisplayVideo360AdvertiserLink_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_display_video360_advertiser_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateDisplayVideo360AdvertiserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateDisplayVideo360AdvertiserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "display_video_360_advertiser_link", - "type": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink", - "shortName": "create_display_video360_advertiser_link" - }, - "description": "Sample for CreateDisplayVideo360AdvertiserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateDisplayVideo360AdvertiserLink_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_display_video360_advertiser_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_event_create_rule", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateEventCreateRule", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateEventCreateRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateEventCreateRuleRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "event_create_rule", - "type": "google.analytics.admin_v1alpha.types.EventCreateRule" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.EventCreateRule", - "shortName": "create_event_create_rule" - }, - "description": "Sample for CreateEventCreateRule", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_event_create_rule_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateEventCreateRule_async", - "segments": [ - { - "end": 58, - "start": 27, - "type": "FULL" - }, - { - "end": 58, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 55, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 59, - "start": 56, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_event_create_rule_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_event_create_rule", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateEventCreateRule", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateEventCreateRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateEventCreateRuleRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "event_create_rule", - "type": "google.analytics.admin_v1alpha.types.EventCreateRule" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.EventCreateRule", - "shortName": "create_event_create_rule" - }, - "description": "Sample for CreateEventCreateRule", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_event_create_rule_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateEventCreateRule_sync", - "segments": [ - { - "end": 58, - "start": 27, - "type": "FULL" - }, - { - "end": 58, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 55, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 59, - "start": 56, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_event_create_rule_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_expanded_data_set", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateExpandedDataSet", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateExpandedDataSet" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateExpandedDataSetRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "expanded_data_set", - "type": "google.analytics.admin_v1alpha.types.ExpandedDataSet" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ExpandedDataSet", - "shortName": "create_expanded_data_set" - }, - "description": "Sample for CreateExpandedDataSet", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_expanded_data_set_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateExpandedDataSet_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_expanded_data_set_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_expanded_data_set", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateExpandedDataSet", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateExpandedDataSet" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateExpandedDataSetRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "expanded_data_set", - "type": "google.analytics.admin_v1alpha.types.ExpandedDataSet" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ExpandedDataSet", - "shortName": "create_expanded_data_set" - }, - "description": "Sample for CreateExpandedDataSet", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_expanded_data_set_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateExpandedDataSet_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_expanded_data_set_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_firebase_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateFirebaseLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateFirebaseLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateFirebaseLinkRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "firebase_link", - "type": "google.analytics.admin_v1alpha.types.FirebaseLink" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.FirebaseLink", - "shortName": "create_firebase_link" - }, - "description": "Sample for CreateFirebaseLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_firebase_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateFirebaseLink_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_firebase_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_firebase_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateFirebaseLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateFirebaseLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateFirebaseLinkRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "firebase_link", - "type": "google.analytics.admin_v1alpha.types.FirebaseLink" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.FirebaseLink", - "shortName": "create_firebase_link" - }, - "description": "Sample for CreateFirebaseLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_firebase_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateFirebaseLink_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_firebase_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_google_ads_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateGoogleAdsLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateGoogleAdsLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateGoogleAdsLinkRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "google_ads_link", - "type": "google.analytics.admin_v1alpha.types.GoogleAdsLink" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.GoogleAdsLink", - "shortName": "create_google_ads_link" - }, - "description": "Sample for CreateGoogleAdsLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_google_ads_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateGoogleAdsLink_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_google_ads_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_google_ads_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateGoogleAdsLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateGoogleAdsLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateGoogleAdsLinkRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "google_ads_link", - "type": "google.analytics.admin_v1alpha.types.GoogleAdsLink" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.GoogleAdsLink", - "shortName": "create_google_ads_link" - }, - "description": "Sample for CreateGoogleAdsLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_google_ads_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateGoogleAdsLink_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_google_ads_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_measurement_protocol_secret", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateMeasurementProtocolSecret", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateMeasurementProtocolSecret" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateMeasurementProtocolSecretRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "measurement_protocol_secret", - "type": "google.analytics.admin_v1alpha.types.MeasurementProtocolSecret" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.MeasurementProtocolSecret", - "shortName": "create_measurement_protocol_secret" - }, - "description": "Sample for CreateMeasurementProtocolSecret", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_measurement_protocol_secret_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateMeasurementProtocolSecret_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_measurement_protocol_secret_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_measurement_protocol_secret", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateMeasurementProtocolSecret", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateMeasurementProtocolSecret" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateMeasurementProtocolSecretRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "measurement_protocol_secret", - "type": "google.analytics.admin_v1alpha.types.MeasurementProtocolSecret" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.MeasurementProtocolSecret", - "shortName": "create_measurement_protocol_secret" - }, - "description": "Sample for CreateMeasurementProtocolSecret", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_measurement_protocol_secret_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateMeasurementProtocolSecret_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_measurement_protocol_secret_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_property", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateProperty", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateProperty" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreatePropertyRequest" - }, - { - "name": "property", - "type": "google.analytics.admin_v1alpha.types.Property" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Property", - "shortName": "create_property" - }, - "description": "Sample for CreateProperty", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_property_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateProperty_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_property_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_property", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateProperty", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateProperty" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreatePropertyRequest" - }, - { - "name": "property", - "type": "google.analytics.admin_v1alpha.types.Property" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Property", - "shortName": "create_property" - }, - "description": "Sample for CreateProperty", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_property_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateProperty_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_property_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_sk_ad_network_conversion_value_schema", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateSKAdNetworkConversionValueSchema", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateSKAdNetworkConversionValueSchema" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateSKAdNetworkConversionValueSchemaRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "skadnetwork_conversion_value_schema", - "type": "google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema", - "shortName": "create_sk_ad_network_conversion_value_schema" - }, - "description": "Sample for CreateSKAdNetworkConversionValueSchema", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_sk_ad_network_conversion_value_schema_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateSKAdNetworkConversionValueSchema_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_sk_ad_network_conversion_value_schema_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_sk_ad_network_conversion_value_schema", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateSKAdNetworkConversionValueSchema", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateSKAdNetworkConversionValueSchema" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateSKAdNetworkConversionValueSchemaRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "skadnetwork_conversion_value_schema", - "type": "google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema", - "shortName": "create_sk_ad_network_conversion_value_schema" - }, - "description": "Sample for CreateSKAdNetworkConversionValueSchema", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_sk_ad_network_conversion_value_schema_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateSKAdNetworkConversionValueSchema_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_sk_ad_network_conversion_value_schema_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_search_ads360_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateSearchAds360Link", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateSearchAds360Link" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateSearchAds360LinkRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "search_ads_360_link", - "type": "google.analytics.admin_v1alpha.types.SearchAds360Link" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SearchAds360Link", - "shortName": "create_search_ads360_link" - }, - "description": "Sample for CreateSearchAds360Link", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_search_ads360_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateSearchAds360Link_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_search_ads360_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_search_ads360_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateSearchAds360Link", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateSearchAds360Link" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateSearchAds360LinkRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "search_ads_360_link", - "type": "google.analytics.admin_v1alpha.types.SearchAds360Link" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SearchAds360Link", - "shortName": "create_search_ads360_link" - }, - "description": "Sample for CreateSearchAds360Link", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_search_ads360_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateSearchAds360Link_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_search_ads360_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.create_user_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateUserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateUserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateUserLinkRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "user_link", - "type": "google.analytics.admin_v1alpha.types.UserLink" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.UserLink", - "shortName": "create_user_link" - }, - "description": "Sample for CreateUserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_user_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateUserLink_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_user_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.create_user_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.CreateUserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "CreateUserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.CreateUserLinkRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "user_link", - "type": "google.analytics.admin_v1alpha.types.UserLink" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.UserLink", - "shortName": "create_user_link" - }, - "description": "Sample for CreateUserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_user_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_CreateUserLink_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_create_user_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_access_binding", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteAccessBinding", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteAccessBinding" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteAccessBindingRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_access_binding" - }, - "description": "Sample for DeleteAccessBinding", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_access_binding_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAccessBinding_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_access_binding_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_access_binding", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteAccessBinding", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteAccessBinding" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteAccessBindingRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_access_binding" - }, - "description": "Sample for DeleteAccessBinding", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_access_binding_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAccessBinding_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_access_binding_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_account", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteAccount", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteAccount" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteAccountRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_account" - }, - "description": "Sample for DeleteAccount", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_account_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAccount_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_account_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_account", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteAccount", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteAccount" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteAccountRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_account" - }, - "description": "Sample for DeleteAccount", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_account_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAccount_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_account_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_ad_sense_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteAdSenseLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteAdSenseLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteAdSenseLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_ad_sense_link" - }, - "description": "Sample for DeleteAdSenseLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_ad_sense_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAdSenseLink_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_ad_sense_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_ad_sense_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteAdSenseLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteAdSenseLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteAdSenseLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_ad_sense_link" - }, - "description": "Sample for DeleteAdSenseLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_ad_sense_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteAdSenseLink_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_ad_sense_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_channel_group", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteChannelGroup", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteChannelGroup" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteChannelGroupRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_channel_group" - }, - "description": "Sample for DeleteChannelGroup", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_channel_group_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteChannelGroup_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_channel_group_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_channel_group", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteChannelGroup", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteChannelGroup" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteChannelGroupRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_channel_group" - }, - "description": "Sample for DeleteChannelGroup", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_channel_group_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteChannelGroup_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_channel_group_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_connected_site_tag", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteConnectedSiteTag", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteConnectedSiteTag" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteConnectedSiteTagRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_connected_site_tag" - }, - "description": "Sample for DeleteConnectedSiteTag", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_connected_site_tag_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConnectedSiteTag_async", - "segments": [ - { - "end": 48, - "start": 27, - "type": "FULL" - }, - { - "end": 48, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_connected_site_tag_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_connected_site_tag", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteConnectedSiteTag", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteConnectedSiteTag" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteConnectedSiteTagRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_connected_site_tag" - }, - "description": "Sample for DeleteConnectedSiteTag", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_connected_site_tag_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConnectedSiteTag_sync", - "segments": [ - { - "end": 48, - "start": 27, - "type": "FULL" - }, - { - "end": 48, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_connected_site_tag_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_conversion_event", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteConversionEvent", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteConversionEvent" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteConversionEventRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_conversion_event" - }, - "description": "Sample for DeleteConversionEvent", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_conversion_event_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConversionEvent_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_conversion_event_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_conversion_event", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteConversionEvent", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteConversionEvent" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteConversionEventRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_conversion_event" - }, - "description": "Sample for DeleteConversionEvent", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_conversion_event_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteConversionEvent_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_conversion_event_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_data_stream", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteDataStream", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteDataStream" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteDataStreamRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_data_stream" - }, - "description": "Sample for DeleteDataStream", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_data_stream_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDataStream_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_data_stream_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_data_stream", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteDataStream", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteDataStream" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteDataStreamRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_data_stream" - }, - "description": "Sample for DeleteDataStream", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_data_stream_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDataStream_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_data_stream_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_display_video360_advertiser_link_proposal", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteDisplayVideo360AdvertiserLinkProposal", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteDisplayVideo360AdvertiserLinkProposal" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkProposalRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_display_video360_advertiser_link_proposal" - }, - "description": "Sample for DeleteDisplayVideo360AdvertiserLinkProposal", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_proposal_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDisplayVideo360AdvertiserLinkProposal_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_proposal_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_display_video360_advertiser_link_proposal", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteDisplayVideo360AdvertiserLinkProposal", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteDisplayVideo360AdvertiserLinkProposal" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkProposalRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_display_video360_advertiser_link_proposal" - }, - "description": "Sample for DeleteDisplayVideo360AdvertiserLinkProposal", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_proposal_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDisplayVideo360AdvertiserLinkProposal_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_proposal_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_display_video360_advertiser_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteDisplayVideo360AdvertiserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteDisplayVideo360AdvertiserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_display_video360_advertiser_link" - }, - "description": "Sample for DeleteDisplayVideo360AdvertiserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDisplayVideo360AdvertiserLink_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_display_video360_advertiser_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteDisplayVideo360AdvertiserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteDisplayVideo360AdvertiserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_display_video360_advertiser_link" - }, - "description": "Sample for DeleteDisplayVideo360AdvertiserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteDisplayVideo360AdvertiserLink_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_display_video360_advertiser_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_event_create_rule", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteEventCreateRule", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteEventCreateRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteEventCreateRuleRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_event_create_rule" - }, - "description": "Sample for DeleteEventCreateRule", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_event_create_rule_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteEventCreateRule_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_event_create_rule_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_event_create_rule", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteEventCreateRule", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteEventCreateRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteEventCreateRuleRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_event_create_rule" - }, - "description": "Sample for DeleteEventCreateRule", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_event_create_rule_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteEventCreateRule_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_event_create_rule_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_expanded_data_set", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteExpandedDataSet", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteExpandedDataSet" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteExpandedDataSetRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_expanded_data_set" - }, - "description": "Sample for DeleteExpandedDataSet", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_expanded_data_set_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteExpandedDataSet_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_expanded_data_set_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_expanded_data_set", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteExpandedDataSet", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteExpandedDataSet" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteExpandedDataSetRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_expanded_data_set" - }, - "description": "Sample for DeleteExpandedDataSet", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_expanded_data_set_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteExpandedDataSet_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_expanded_data_set_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_firebase_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteFirebaseLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteFirebaseLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteFirebaseLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_firebase_link" - }, - "description": "Sample for DeleteFirebaseLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_firebase_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteFirebaseLink_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_firebase_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_firebase_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteFirebaseLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteFirebaseLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteFirebaseLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_firebase_link" - }, - "description": "Sample for DeleteFirebaseLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_firebase_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteFirebaseLink_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_firebase_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_google_ads_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteGoogleAdsLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteGoogleAdsLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteGoogleAdsLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_google_ads_link" - }, - "description": "Sample for DeleteGoogleAdsLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_google_ads_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteGoogleAdsLink_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_google_ads_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_google_ads_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteGoogleAdsLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteGoogleAdsLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteGoogleAdsLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_google_ads_link" - }, - "description": "Sample for DeleteGoogleAdsLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_google_ads_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteGoogleAdsLink_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_google_ads_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_measurement_protocol_secret", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteMeasurementProtocolSecret", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteMeasurementProtocolSecret" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteMeasurementProtocolSecretRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_measurement_protocol_secret" - }, - "description": "Sample for DeleteMeasurementProtocolSecret", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_measurement_protocol_secret_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteMeasurementProtocolSecret_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_measurement_protocol_secret_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_measurement_protocol_secret", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteMeasurementProtocolSecret", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteMeasurementProtocolSecret" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteMeasurementProtocolSecretRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_measurement_protocol_secret" - }, - "description": "Sample for DeleteMeasurementProtocolSecret", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_measurement_protocol_secret_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteMeasurementProtocolSecret_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_measurement_protocol_secret_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_property", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteProperty", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteProperty" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeletePropertyRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Property", - "shortName": "delete_property" - }, - "description": "Sample for DeleteProperty", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_property_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteProperty_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_property_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_property", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteProperty", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteProperty" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeletePropertyRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Property", - "shortName": "delete_property" - }, - "description": "Sample for DeleteProperty", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_property_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteProperty_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_property_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_sk_ad_network_conversion_value_schema", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteSKAdNetworkConversionValueSchema", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteSKAdNetworkConversionValueSchema" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteSKAdNetworkConversionValueSchemaRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_sk_ad_network_conversion_value_schema" - }, - "description": "Sample for DeleteSKAdNetworkConversionValueSchema", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_sk_ad_network_conversion_value_schema_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteSKAdNetworkConversionValueSchema_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_sk_ad_network_conversion_value_schema_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_sk_ad_network_conversion_value_schema", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteSKAdNetworkConversionValueSchema", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteSKAdNetworkConversionValueSchema" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteSKAdNetworkConversionValueSchemaRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_sk_ad_network_conversion_value_schema" - }, - "description": "Sample for DeleteSKAdNetworkConversionValueSchema", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_sk_ad_network_conversion_value_schema_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteSKAdNetworkConversionValueSchema_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_sk_ad_network_conversion_value_schema_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_search_ads360_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteSearchAds360Link", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteSearchAds360Link" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteSearchAds360LinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_search_ads360_link" - }, - "description": "Sample for DeleteSearchAds360Link", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_search_ads360_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteSearchAds360Link_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_search_ads360_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_search_ads360_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteSearchAds360Link", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteSearchAds360Link" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteSearchAds360LinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_search_ads360_link" - }, - "description": "Sample for DeleteSearchAds360Link", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_search_ads360_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteSearchAds360Link_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_search_ads360_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.delete_user_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteUserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteUserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteUserLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_user_link" - }, - "description": "Sample for DeleteUserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_user_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteUserLink_async", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_user_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.delete_user_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.DeleteUserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "DeleteUserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.DeleteUserLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "shortName": "delete_user_link" - }, - "description": "Sample for DeleteUserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_user_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_DeleteUserLink_sync", - "segments": [ - { - "end": 49, - "start": 27, - "type": "FULL" - }, - { - "end": 49, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 50, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_delete_user_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.fetch_automated_ga4_configuration_opt_out", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.FetchAutomatedGa4ConfigurationOptOut", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "FetchAutomatedGa4ConfigurationOptOut" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutResponse", - "shortName": "fetch_automated_ga4_configuration_opt_out" - }, - "description": "Sample for FetchAutomatedGa4ConfigurationOptOut", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_automated_ga4_configuration_opt_out_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_FetchAutomatedGa4ConfigurationOptOut_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_automated_ga4_configuration_opt_out_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.fetch_automated_ga4_configuration_opt_out", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.FetchAutomatedGa4ConfigurationOptOut", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "FetchAutomatedGa4ConfigurationOptOut" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.FetchAutomatedGa4ConfigurationOptOutResponse", - "shortName": "fetch_automated_ga4_configuration_opt_out" - }, - "description": "Sample for FetchAutomatedGa4ConfigurationOptOut", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_automated_ga4_configuration_opt_out_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_FetchAutomatedGa4ConfigurationOptOut_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_automated_ga4_configuration_opt_out_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.fetch_connected_ga4_property", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.FetchConnectedGa4Property", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "FetchConnectedGa4Property" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyResponse", - "shortName": "fetch_connected_ga4_property" - }, - "description": "Sample for FetchConnectedGa4Property", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_connected_ga4_property_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_FetchConnectedGa4Property_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_connected_ga4_property_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.fetch_connected_ga4_property", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.FetchConnectedGa4Property", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "FetchConnectedGa4Property" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.FetchConnectedGa4PropertyResponse", - "shortName": "fetch_connected_ga4_property" - }, - "description": "Sample for FetchConnectedGa4Property", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_connected_ga4_property_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_FetchConnectedGa4Property_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_fetch_connected_ga4_property_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_access_binding", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetAccessBinding", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetAccessBinding" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetAccessBindingRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AccessBinding", - "shortName": "get_access_binding" - }, - "description": "Sample for GetAccessBinding", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_access_binding_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAccessBinding_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_access_binding_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_access_binding", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetAccessBinding", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetAccessBinding" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetAccessBindingRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AccessBinding", - "shortName": "get_access_binding" - }, - "description": "Sample for GetAccessBinding", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_access_binding_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAccessBinding_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_access_binding_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_account", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetAccount", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetAccount" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetAccountRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Account", - "shortName": "get_account" - }, - "description": "Sample for GetAccount", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_account_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAccount_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_account_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_account", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetAccount", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetAccount" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetAccountRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Account", - "shortName": "get_account" - }, - "description": "Sample for GetAccount", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_account_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAccount_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_account_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_ad_sense_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetAdSenseLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetAdSenseLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetAdSenseLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AdSenseLink", - "shortName": "get_ad_sense_link" - }, - "description": "Sample for GetAdSenseLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_ad_sense_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAdSenseLink_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_ad_sense_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_ad_sense_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetAdSenseLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetAdSenseLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetAdSenseLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AdSenseLink", - "shortName": "get_ad_sense_link" - }, - "description": "Sample for GetAdSenseLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_ad_sense_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAdSenseLink_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_ad_sense_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_attribution_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetAttributionSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetAttributionSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetAttributionSettingsRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AttributionSettings", - "shortName": "get_attribution_settings" - }, - "description": "Sample for GetAttributionSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_attribution_settings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAttributionSettings_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_attribution_settings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_attribution_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetAttributionSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetAttributionSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetAttributionSettingsRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AttributionSettings", - "shortName": "get_attribution_settings" - }, - "description": "Sample for GetAttributionSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_attribution_settings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAttributionSettings_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_attribution_settings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_audience", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetAudience", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetAudience" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetAudienceRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Audience", - "shortName": "get_audience" - }, - "description": "Sample for GetAudience", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_audience_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAudience_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_audience_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_audience", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetAudience", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetAudience" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetAudienceRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Audience", - "shortName": "get_audience" - }, - "description": "Sample for GetAudience", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_audience_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetAudience_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_audience_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_big_query_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetBigQueryLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetBigQueryLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetBigQueryLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BigQueryLink", - "shortName": "get_big_query_link" - }, - "description": "Sample for GetBigQueryLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_big_query_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetBigQueryLink_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_big_query_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_big_query_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetBigQueryLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetBigQueryLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetBigQueryLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.BigQueryLink", - "shortName": "get_big_query_link" - }, - "description": "Sample for GetBigQueryLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_big_query_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetBigQueryLink_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_big_query_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_channel_group", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetChannelGroup", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetChannelGroup" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetChannelGroupRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ChannelGroup", - "shortName": "get_channel_group" - }, - "description": "Sample for GetChannelGroup", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_channel_group_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetChannelGroup_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_channel_group_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_channel_group", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetChannelGroup", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetChannelGroup" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetChannelGroupRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ChannelGroup", - "shortName": "get_channel_group" - }, - "description": "Sample for GetChannelGroup", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_channel_group_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetChannelGroup_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_channel_group_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_conversion_event", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetConversionEvent", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetConversionEvent" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetConversionEventRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ConversionEvent", - "shortName": "get_conversion_event" - }, - "description": "Sample for GetConversionEvent", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_conversion_event_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetConversionEvent_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_conversion_event_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_conversion_event", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetConversionEvent", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetConversionEvent" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetConversionEventRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ConversionEvent", - "shortName": "get_conversion_event" - }, - "description": "Sample for GetConversionEvent", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_conversion_event_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetConversionEvent_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_conversion_event_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_custom_dimension", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetCustomDimension", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetCustomDimension" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetCustomDimensionRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CustomDimension", - "shortName": "get_custom_dimension" - }, - "description": "Sample for GetCustomDimension", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_dimension_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomDimension_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_dimension_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_custom_dimension", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetCustomDimension", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetCustomDimension" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetCustomDimensionRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CustomDimension", - "shortName": "get_custom_dimension" - }, - "description": "Sample for GetCustomDimension", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_dimension_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomDimension_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_dimension_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_custom_metric", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetCustomMetric", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetCustomMetric" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetCustomMetricRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CustomMetric", - "shortName": "get_custom_metric" - }, - "description": "Sample for GetCustomMetric", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_metric_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomMetric_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_metric_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_custom_metric", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetCustomMetric", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetCustomMetric" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetCustomMetricRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CustomMetric", - "shortName": "get_custom_metric" - }, - "description": "Sample for GetCustomMetric", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_metric_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetCustomMetric_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_custom_metric_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_data_retention_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetDataRetentionSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetDataRetentionSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetDataRetentionSettingsRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DataRetentionSettings", - "shortName": "get_data_retention_settings" - }, - "description": "Sample for GetDataRetentionSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_retention_settings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataRetentionSettings_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_retention_settings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_data_retention_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetDataRetentionSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetDataRetentionSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetDataRetentionSettingsRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DataRetentionSettings", - "shortName": "get_data_retention_settings" - }, - "description": "Sample for GetDataRetentionSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_retention_settings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataRetentionSettings_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_retention_settings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_data_sharing_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetDataSharingSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetDataSharingSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetDataSharingSettingsRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DataSharingSettings", - "shortName": "get_data_sharing_settings" - }, - "description": "Sample for GetDataSharingSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_sharing_settings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataSharingSettings_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_sharing_settings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_data_sharing_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetDataSharingSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetDataSharingSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetDataSharingSettingsRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DataSharingSettings", - "shortName": "get_data_sharing_settings" - }, - "description": "Sample for GetDataSharingSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_sharing_settings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataSharingSettings_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_sharing_settings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_data_stream", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetDataStream", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetDataStream" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetDataStreamRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DataStream", - "shortName": "get_data_stream" - }, - "description": "Sample for GetDataStream", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_stream_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataStream_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_stream_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_data_stream", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetDataStream", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetDataStream" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetDataStreamRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DataStream", - "shortName": "get_data_stream" - }, - "description": "Sample for GetDataStream", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_stream_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDataStream_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_data_stream_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_display_video360_advertiser_link_proposal", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetDisplayVideo360AdvertiserLinkProposal", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetDisplayVideo360AdvertiserLinkProposal" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkProposalRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal", - "shortName": "get_display_video360_advertiser_link_proposal" - }, - "description": "Sample for GetDisplayVideo360AdvertiserLinkProposal", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_proposal_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLinkProposal_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_proposal_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_display_video360_advertiser_link_proposal", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetDisplayVideo360AdvertiserLinkProposal", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetDisplayVideo360AdvertiserLinkProposal" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkProposalRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal", - "shortName": "get_display_video360_advertiser_link_proposal" - }, - "description": "Sample for GetDisplayVideo360AdvertiserLinkProposal", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_proposal_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLinkProposal_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_proposal_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_display_video360_advertiser_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetDisplayVideo360AdvertiserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetDisplayVideo360AdvertiserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink", - "shortName": "get_display_video360_advertiser_link" - }, - "description": "Sample for GetDisplayVideo360AdvertiserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLink_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_display_video360_advertiser_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetDisplayVideo360AdvertiserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetDisplayVideo360AdvertiserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink", - "shortName": "get_display_video360_advertiser_link" - }, - "description": "Sample for GetDisplayVideo360AdvertiserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetDisplayVideo360AdvertiserLink_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_display_video360_advertiser_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_enhanced_measurement_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetEnhancedMeasurementSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetEnhancedMeasurementSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetEnhancedMeasurementSettingsRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings", - "shortName": "get_enhanced_measurement_settings" - }, - "description": "Sample for GetEnhancedMeasurementSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_enhanced_measurement_settings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetEnhancedMeasurementSettings_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_enhanced_measurement_settings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_enhanced_measurement_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetEnhancedMeasurementSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetEnhancedMeasurementSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetEnhancedMeasurementSettingsRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings", - "shortName": "get_enhanced_measurement_settings" - }, - "description": "Sample for GetEnhancedMeasurementSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_enhanced_measurement_settings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetEnhancedMeasurementSettings_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_enhanced_measurement_settings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_event_create_rule", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetEventCreateRule", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetEventCreateRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetEventCreateRuleRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.EventCreateRule", - "shortName": "get_event_create_rule" - }, - "description": "Sample for GetEventCreateRule", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_event_create_rule_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetEventCreateRule_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_event_create_rule_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_event_create_rule", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetEventCreateRule", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetEventCreateRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetEventCreateRuleRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.EventCreateRule", - "shortName": "get_event_create_rule" - }, - "description": "Sample for GetEventCreateRule", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_event_create_rule_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetEventCreateRule_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_event_create_rule_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_expanded_data_set", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetExpandedDataSet", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetExpandedDataSet" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetExpandedDataSetRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ExpandedDataSet", - "shortName": "get_expanded_data_set" - }, - "description": "Sample for GetExpandedDataSet", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_expanded_data_set_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetExpandedDataSet_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_expanded_data_set_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_expanded_data_set", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetExpandedDataSet", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetExpandedDataSet" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetExpandedDataSetRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ExpandedDataSet", - "shortName": "get_expanded_data_set" - }, - "description": "Sample for GetExpandedDataSet", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_expanded_data_set_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetExpandedDataSet_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_expanded_data_set_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_global_site_tag", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetGlobalSiteTag", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetGlobalSiteTag" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetGlobalSiteTagRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.GlobalSiteTag", - "shortName": "get_global_site_tag" - }, - "description": "Sample for GetGlobalSiteTag", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_global_site_tag_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGlobalSiteTag_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_global_site_tag_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_global_site_tag", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetGlobalSiteTag", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetGlobalSiteTag" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetGlobalSiteTagRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.GlobalSiteTag", - "shortName": "get_global_site_tag" - }, - "description": "Sample for GetGlobalSiteTag", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_global_site_tag_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGlobalSiteTag_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_global_site_tag_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_google_signals_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetGoogleSignalsSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetGoogleSignalsSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetGoogleSignalsSettingsRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.GoogleSignalsSettings", - "shortName": "get_google_signals_settings" - }, - "description": "Sample for GetGoogleSignalsSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_google_signals_settings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGoogleSignalsSettings_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_google_signals_settings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_google_signals_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetGoogleSignalsSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetGoogleSignalsSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetGoogleSignalsSettingsRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.GoogleSignalsSettings", - "shortName": "get_google_signals_settings" - }, - "description": "Sample for GetGoogleSignalsSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_google_signals_settings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetGoogleSignalsSettings_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_google_signals_settings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_measurement_protocol_secret", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetMeasurementProtocolSecret", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetMeasurementProtocolSecret" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetMeasurementProtocolSecretRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.MeasurementProtocolSecret", - "shortName": "get_measurement_protocol_secret" - }, - "description": "Sample for GetMeasurementProtocolSecret", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_measurement_protocol_secret_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetMeasurementProtocolSecret_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_measurement_protocol_secret_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_measurement_protocol_secret", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetMeasurementProtocolSecret", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetMeasurementProtocolSecret" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetMeasurementProtocolSecretRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.MeasurementProtocolSecret", - "shortName": "get_measurement_protocol_secret" - }, - "description": "Sample for GetMeasurementProtocolSecret", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_measurement_protocol_secret_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetMeasurementProtocolSecret_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_measurement_protocol_secret_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_property", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetProperty", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetProperty" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetPropertyRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Property", - "shortName": "get_property" - }, - "description": "Sample for GetProperty", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_property_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetProperty_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_property_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_property", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetProperty", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetProperty" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetPropertyRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Property", - "shortName": "get_property" - }, - "description": "Sample for GetProperty", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_property_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetProperty_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_property_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_sk_ad_network_conversion_value_schema", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetSKAdNetworkConversionValueSchema", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetSKAdNetworkConversionValueSchema" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetSKAdNetworkConversionValueSchemaRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema", - "shortName": "get_sk_ad_network_conversion_value_schema" - }, - "description": "Sample for GetSKAdNetworkConversionValueSchema", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_sk_ad_network_conversion_value_schema_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetSKAdNetworkConversionValueSchema_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_sk_ad_network_conversion_value_schema_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_sk_ad_network_conversion_value_schema", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetSKAdNetworkConversionValueSchema", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetSKAdNetworkConversionValueSchema" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetSKAdNetworkConversionValueSchemaRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema", - "shortName": "get_sk_ad_network_conversion_value_schema" - }, - "description": "Sample for GetSKAdNetworkConversionValueSchema", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_sk_ad_network_conversion_value_schema_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetSKAdNetworkConversionValueSchema_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_sk_ad_network_conversion_value_schema_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_search_ads360_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetSearchAds360Link", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetSearchAds360Link" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetSearchAds360LinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SearchAds360Link", - "shortName": "get_search_ads360_link" - }, - "description": "Sample for GetSearchAds360Link", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_search_ads360_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetSearchAds360Link_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_search_ads360_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_search_ads360_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetSearchAds360Link", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetSearchAds360Link" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetSearchAds360LinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SearchAds360Link", - "shortName": "get_search_ads360_link" - }, - "description": "Sample for GetSearchAds360Link", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_search_ads360_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetSearchAds360Link_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_search_ads360_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.get_user_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetUserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetUserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetUserLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.UserLink", - "shortName": "get_user_link" - }, - "description": "Sample for GetUserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_user_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetUserLink_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_user_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.get_user_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.GetUserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "GetUserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.GetUserLinkRequest" - }, - { - "name": "name", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.UserLink", - "shortName": "get_user_link" - }, - "description": "Sample for GetUserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_user_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_GetUserLink_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_get_user_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_access_bindings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListAccessBindings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListAccessBindings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListAccessBindingsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccessBindingsAsyncPager", - "shortName": "list_access_bindings" - }, - "description": "Sample for ListAccessBindings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_access_bindings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccessBindings_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_access_bindings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_access_bindings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListAccessBindings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListAccessBindings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListAccessBindingsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccessBindingsPager", - "shortName": "list_access_bindings" - }, - "description": "Sample for ListAccessBindings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_access_bindings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccessBindings_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_access_bindings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_account_summaries", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListAccountSummaries", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListAccountSummaries" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListAccountSummariesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccountSummariesAsyncPager", - "shortName": "list_account_summaries" - }, - "description": "Sample for ListAccountSummaries", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_account_summaries_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccountSummaries_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_account_summaries_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_account_summaries", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListAccountSummaries", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListAccountSummaries" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListAccountSummariesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccountSummariesPager", - "shortName": "list_account_summaries" - }, - "description": "Sample for ListAccountSummaries", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_account_summaries_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccountSummaries_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_account_summaries_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_accounts", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListAccounts", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListAccounts" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListAccountsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccountsAsyncPager", - "shortName": "list_accounts" - }, - "description": "Sample for ListAccounts", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_accounts_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccounts_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_accounts_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_accounts", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListAccounts", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListAccounts" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListAccountsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAccountsPager", - "shortName": "list_accounts" - }, - "description": "Sample for ListAccounts", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_accounts_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAccounts_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_accounts_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_ad_sense_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListAdSenseLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListAdSenseLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListAdSenseLinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAdSenseLinksAsyncPager", - "shortName": "list_ad_sense_links" - }, - "description": "Sample for ListAdSenseLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_ad_sense_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAdSenseLinks_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_ad_sense_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_ad_sense_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListAdSenseLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListAdSenseLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListAdSenseLinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAdSenseLinksPager", - "shortName": "list_ad_sense_links" - }, - "description": "Sample for ListAdSenseLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_ad_sense_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAdSenseLinks_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_ad_sense_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_audiences", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListAudiences", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListAudiences" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListAudiencesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAudiencesAsyncPager", - "shortName": "list_audiences" - }, - "description": "Sample for ListAudiences", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_audiences_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAudiences_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_audiences_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_audiences", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListAudiences", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListAudiences" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListAudiencesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListAudiencesPager", - "shortName": "list_audiences" - }, - "description": "Sample for ListAudiences", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_audiences_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListAudiences_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_audiences_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_big_query_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListBigQueryLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListBigQueryLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListBigQueryLinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListBigQueryLinksAsyncPager", - "shortName": "list_big_query_links" - }, - "description": "Sample for ListBigQueryLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_big_query_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListBigQueryLinks_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_big_query_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_big_query_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListBigQueryLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListBigQueryLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListBigQueryLinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListBigQueryLinksPager", - "shortName": "list_big_query_links" - }, - "description": "Sample for ListBigQueryLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_big_query_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListBigQueryLinks_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_big_query_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_channel_groups", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListChannelGroups", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListChannelGroups" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListChannelGroupsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListChannelGroupsAsyncPager", - "shortName": "list_channel_groups" - }, - "description": "Sample for ListChannelGroups", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_channel_groups_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListChannelGroups_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_channel_groups_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_channel_groups", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListChannelGroups", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListChannelGroups" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListChannelGroupsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListChannelGroupsPager", - "shortName": "list_channel_groups" - }, - "description": "Sample for ListChannelGroups", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_channel_groups_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListChannelGroups_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_channel_groups_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_connected_site_tags", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListConnectedSiteTags", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListConnectedSiteTags" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListConnectedSiteTagsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ListConnectedSiteTagsResponse", - "shortName": "list_connected_site_tags" - }, - "description": "Sample for ListConnectedSiteTags", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_connected_site_tags_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConnectedSiteTags_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_connected_site_tags_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_connected_site_tags", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListConnectedSiteTags", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListConnectedSiteTags" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListConnectedSiteTagsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ListConnectedSiteTagsResponse", - "shortName": "list_connected_site_tags" - }, - "description": "Sample for ListConnectedSiteTags", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_connected_site_tags_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConnectedSiteTags_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_connected_site_tags_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_conversion_events", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListConversionEvents", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListConversionEvents" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListConversionEventsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListConversionEventsAsyncPager", - "shortName": "list_conversion_events" - }, - "description": "Sample for ListConversionEvents", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_conversion_events_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConversionEvents_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_conversion_events_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_conversion_events", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListConversionEvents", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListConversionEvents" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListConversionEventsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListConversionEventsPager", - "shortName": "list_conversion_events" - }, - "description": "Sample for ListConversionEvents", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_conversion_events_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListConversionEvents_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_conversion_events_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_custom_dimensions", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListCustomDimensions", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListCustomDimensions" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListCustomDimensionsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomDimensionsAsyncPager", - "shortName": "list_custom_dimensions" - }, - "description": "Sample for ListCustomDimensions", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_dimensions_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomDimensions_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_dimensions_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_custom_dimensions", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListCustomDimensions", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListCustomDimensions" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListCustomDimensionsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomDimensionsPager", - "shortName": "list_custom_dimensions" - }, - "description": "Sample for ListCustomDimensions", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_dimensions_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomDimensions_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_dimensions_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_custom_metrics", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListCustomMetrics", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListCustomMetrics" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListCustomMetricsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomMetricsAsyncPager", - "shortName": "list_custom_metrics" - }, - "description": "Sample for ListCustomMetrics", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_metrics_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomMetrics_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_metrics_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_custom_metrics", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListCustomMetrics", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListCustomMetrics" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListCustomMetricsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomMetricsPager", - "shortName": "list_custom_metrics" - }, - "description": "Sample for ListCustomMetrics", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_metrics_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListCustomMetrics_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_custom_metrics_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_data_streams", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListDataStreams", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListDataStreams" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListDataStreamsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDataStreamsAsyncPager", - "shortName": "list_data_streams" - }, - "description": "Sample for ListDataStreams", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_data_streams_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDataStreams_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_data_streams_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_data_streams", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListDataStreams", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListDataStreams" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListDataStreamsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDataStreamsPager", - "shortName": "list_data_streams" - }, - "description": "Sample for ListDataStreams", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_data_streams_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDataStreams_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_data_streams_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_display_video360_advertiser_link_proposals", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListDisplayVideo360AdvertiserLinkProposals", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListDisplayVideo360AdvertiserLinkProposals" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager", - "shortName": "list_display_video360_advertiser_link_proposals" - }, - "description": "Sample for ListDisplayVideo360AdvertiserLinkProposals", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_link_proposals_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDisplayVideo360AdvertiserLinkProposals_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_link_proposals_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_display_video360_advertiser_link_proposals", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListDisplayVideo360AdvertiserLinkProposals", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListDisplayVideo360AdvertiserLinkProposals" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinkProposalsPager", - "shortName": "list_display_video360_advertiser_link_proposals" - }, - "description": "Sample for ListDisplayVideo360AdvertiserLinkProposals", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_link_proposals_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDisplayVideo360AdvertiserLinkProposals_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_link_proposals_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_display_video360_advertiser_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListDisplayVideo360AdvertiserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListDisplayVideo360AdvertiserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinksAsyncPager", - "shortName": "list_display_video360_advertiser_links" - }, - "description": "Sample for ListDisplayVideo360AdvertiserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDisplayVideo360AdvertiserLinks_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_display_video360_advertiser_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListDisplayVideo360AdvertiserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListDisplayVideo360AdvertiserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinksPager", - "shortName": "list_display_video360_advertiser_links" - }, - "description": "Sample for ListDisplayVideo360AdvertiserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListDisplayVideo360AdvertiserLinks_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_display_video360_advertiser_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_event_create_rules", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListEventCreateRules", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListEventCreateRules" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListEventCreateRulesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListEventCreateRulesAsyncPager", - "shortName": "list_event_create_rules" - }, - "description": "Sample for ListEventCreateRules", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_event_create_rules_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListEventCreateRules_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_event_create_rules_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_event_create_rules", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListEventCreateRules", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListEventCreateRules" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListEventCreateRulesRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListEventCreateRulesPager", - "shortName": "list_event_create_rules" - }, - "description": "Sample for ListEventCreateRules", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_event_create_rules_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListEventCreateRules_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_event_create_rules_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_expanded_data_sets", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListExpandedDataSets", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListExpandedDataSets" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListExpandedDataSetsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListExpandedDataSetsAsyncPager", - "shortName": "list_expanded_data_sets" - }, - "description": "Sample for ListExpandedDataSets", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_expanded_data_sets_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListExpandedDataSets_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_expanded_data_sets_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_expanded_data_sets", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListExpandedDataSets", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListExpandedDataSets" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListExpandedDataSetsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListExpandedDataSetsPager", - "shortName": "list_expanded_data_sets" - }, - "description": "Sample for ListExpandedDataSets", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_expanded_data_sets_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListExpandedDataSets_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_expanded_data_sets_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_firebase_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListFirebaseLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListFirebaseLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListFirebaseLinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListFirebaseLinksAsyncPager", - "shortName": "list_firebase_links" - }, - "description": "Sample for ListFirebaseLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_firebase_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListFirebaseLinks_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_firebase_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_firebase_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListFirebaseLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListFirebaseLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListFirebaseLinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListFirebaseLinksPager", - "shortName": "list_firebase_links" - }, - "description": "Sample for ListFirebaseLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_firebase_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListFirebaseLinks_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_firebase_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_google_ads_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListGoogleAdsLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListGoogleAdsLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListGoogleAdsLinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListGoogleAdsLinksAsyncPager", - "shortName": "list_google_ads_links" - }, - "description": "Sample for ListGoogleAdsLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_google_ads_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListGoogleAdsLinks_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_google_ads_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_google_ads_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListGoogleAdsLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListGoogleAdsLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListGoogleAdsLinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListGoogleAdsLinksPager", - "shortName": "list_google_ads_links" - }, - "description": "Sample for ListGoogleAdsLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_google_ads_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListGoogleAdsLinks_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_google_ads_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_measurement_protocol_secrets", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListMeasurementProtocolSecrets", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListMeasurementProtocolSecrets" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListMeasurementProtocolSecretsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListMeasurementProtocolSecretsAsyncPager", - "shortName": "list_measurement_protocol_secrets" - }, - "description": "Sample for ListMeasurementProtocolSecrets", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_measurement_protocol_secrets_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListMeasurementProtocolSecrets_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_measurement_protocol_secrets_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_measurement_protocol_secrets", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListMeasurementProtocolSecrets", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListMeasurementProtocolSecrets" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListMeasurementProtocolSecretsRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListMeasurementProtocolSecretsPager", - "shortName": "list_measurement_protocol_secrets" - }, - "description": "Sample for ListMeasurementProtocolSecrets", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_measurement_protocol_secrets_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListMeasurementProtocolSecrets_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_measurement_protocol_secrets_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_properties", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListProperties", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListProperties" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListPropertiesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListPropertiesAsyncPager", - "shortName": "list_properties" - }, - "description": "Sample for ListProperties", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_properties_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListProperties_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_properties_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_properties", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListProperties", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListProperties" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListPropertiesRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListPropertiesPager", - "shortName": "list_properties" - }, - "description": "Sample for ListProperties", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_properties_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListProperties_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_properties_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_sk_ad_network_conversion_value_schemas", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListSKAdNetworkConversionValueSchemas", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListSKAdNetworkConversionValueSchemas" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListSKAdNetworkConversionValueSchemasRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSKAdNetworkConversionValueSchemasAsyncPager", - "shortName": "list_sk_ad_network_conversion_value_schemas" - }, - "description": "Sample for ListSKAdNetworkConversionValueSchemas", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_sk_ad_network_conversion_value_schemas_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListSKAdNetworkConversionValueSchemas_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_sk_ad_network_conversion_value_schemas_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_sk_ad_network_conversion_value_schemas", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListSKAdNetworkConversionValueSchemas", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListSKAdNetworkConversionValueSchemas" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListSKAdNetworkConversionValueSchemasRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSKAdNetworkConversionValueSchemasPager", - "shortName": "list_sk_ad_network_conversion_value_schemas" - }, - "description": "Sample for ListSKAdNetworkConversionValueSchemas", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_sk_ad_network_conversion_value_schemas_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListSKAdNetworkConversionValueSchemas_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_sk_ad_network_conversion_value_schemas_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_search_ads360_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListSearchAds360Links", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListSearchAds360Links" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListSearchAds360LinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSearchAds360LinksAsyncPager", - "shortName": "list_search_ads360_links" - }, - "description": "Sample for ListSearchAds360Links", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_search_ads360_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListSearchAds360Links_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_search_ads360_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_search_ads360_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListSearchAds360Links", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListSearchAds360Links" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListSearchAds360LinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListSearchAds360LinksPager", - "shortName": "list_search_ads360_links" - }, - "description": "Sample for ListSearchAds360Links", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_search_ads360_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListSearchAds360Links_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_search_ads360_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.list_user_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListUserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListUserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListUserLinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListUserLinksAsyncPager", - "shortName": "list_user_links" - }, - "description": "Sample for ListUserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_user_links_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListUserLinks_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_user_links_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.list_user_links", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ListUserLinks", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ListUserLinks" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ListUserLinksRequest" - }, - { - "name": "parent", - "type": "str" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListUserLinksPager", - "shortName": "list_user_links" - }, - "description": "Sample for ListUserLinks", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_user_links_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ListUserLinks_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_list_user_links_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.provision_account_ticket", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ProvisionAccountTicket", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ProvisionAccountTicket" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ProvisionAccountTicketRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ProvisionAccountTicketResponse", - "shortName": "provision_account_ticket" - }, - "description": "Sample for ProvisionAccountTicket", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_provision_account_ticket_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ProvisionAccountTicket_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_provision_account_ticket_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.provision_account_ticket", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.ProvisionAccountTicket", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "ProvisionAccountTicket" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.ProvisionAccountTicketRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ProvisionAccountTicketResponse", - "shortName": "provision_account_ticket" - }, - "description": "Sample for ProvisionAccountTicket", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_provision_account_ticket_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_ProvisionAccountTicket_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_provision_account_ticket_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.run_access_report", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.RunAccessReport", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "RunAccessReport" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.RunAccessReportRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.RunAccessReportResponse", - "shortName": "run_access_report" - }, - "description": "Sample for RunAccessReport", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_run_access_report_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_RunAccessReport_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_run_access_report_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.run_access_report", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.RunAccessReport", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "RunAccessReport" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.RunAccessReportRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.RunAccessReportResponse", - "shortName": "run_access_report" - }, - "description": "Sample for RunAccessReport", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_run_access_report_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_RunAccessReport_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_run_access_report_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.search_change_history_events", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.SearchChangeHistoryEvents", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "SearchChangeHistoryEvents" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.SearchChangeHistoryEventsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.SearchChangeHistoryEventsAsyncPager", - "shortName": "search_change_history_events" - }, - "description": "Sample for SearchChangeHistoryEvents", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_search_change_history_events_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_SearchChangeHistoryEvents_async", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_search_change_history_events_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.search_change_history_events", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.SearchChangeHistoryEvents", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "SearchChangeHistoryEvents" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.SearchChangeHistoryEventsRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.SearchChangeHistoryEventsPager", - "shortName": "search_change_history_events" - }, - "description": "Sample for SearchChangeHistoryEvents", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_search_change_history_events_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_SearchChangeHistoryEvents_sync", - "segments": [ - { - "end": 52, - "start": 27, - "type": "FULL" - }, - { - "end": 52, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 53, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_search_change_history_events_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.set_automated_ga4_configuration_opt_out", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.SetAutomatedGa4ConfigurationOptOut", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "SetAutomatedGa4ConfigurationOptOut" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutResponse", - "shortName": "set_automated_ga4_configuration_opt_out" - }, - "description": "Sample for SetAutomatedGa4ConfigurationOptOut", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_set_automated_ga4_configuration_opt_out_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_SetAutomatedGa4ConfigurationOptOut_async", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_set_automated_ga4_configuration_opt_out_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.set_automated_ga4_configuration_opt_out", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.SetAutomatedGa4ConfigurationOptOut", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "SetAutomatedGa4ConfigurationOptOut" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutRequest" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SetAutomatedGa4ConfigurationOptOutResponse", - "shortName": "set_automated_ga4_configuration_opt_out" - }, - "description": "Sample for SetAutomatedGa4ConfigurationOptOut", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_set_automated_ga4_configuration_opt_out_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_SetAutomatedGa4ConfigurationOptOut_sync", - "segments": [ - { - "end": 51, - "start": 27, - "type": "FULL" - }, - { - "end": 51, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 45, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 48, - "start": 46, - "type": "REQUEST_EXECUTION" - }, - { - "end": 52, - "start": 49, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_set_automated_ga4_configuration_opt_out_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_access_binding", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateAccessBinding", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateAccessBinding" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateAccessBindingRequest" - }, - { - "name": "access_binding", - "type": "google.analytics.admin_v1alpha.types.AccessBinding" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AccessBinding", - "shortName": "update_access_binding" - }, - "description": "Sample for UpdateAccessBinding", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_access_binding_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAccessBinding_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_access_binding_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_access_binding", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateAccessBinding", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateAccessBinding" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateAccessBindingRequest" - }, - { - "name": "access_binding", - "type": "google.analytics.admin_v1alpha.types.AccessBinding" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AccessBinding", - "shortName": "update_access_binding" - }, - "description": "Sample for UpdateAccessBinding", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_access_binding_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAccessBinding_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_access_binding_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_account", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateAccount", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateAccount" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateAccountRequest" - }, - { - "name": "account", - "type": "google.analytics.admin_v1alpha.types.Account" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Account", - "shortName": "update_account" - }, - "description": "Sample for UpdateAccount", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_account_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAccount_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_account_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_account", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateAccount", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateAccount" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateAccountRequest" - }, - { - "name": "account", - "type": "google.analytics.admin_v1alpha.types.Account" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Account", - "shortName": "update_account" - }, - "description": "Sample for UpdateAccount", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_account_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAccount_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_account_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_attribution_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateAttributionSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateAttributionSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateAttributionSettingsRequest" - }, - { - "name": "attribution_settings", - "type": "google.analytics.admin_v1alpha.types.AttributionSettings" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AttributionSettings", - "shortName": "update_attribution_settings" - }, - "description": "Sample for UpdateAttributionSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_attribution_settings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAttributionSettings_async", - "segments": [ - { - "end": 57, - "start": 27, - "type": "FULL" - }, - { - "end": 57, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 54, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 58, - "start": 55, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_attribution_settings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_attribution_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateAttributionSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateAttributionSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateAttributionSettingsRequest" - }, - { - "name": "attribution_settings", - "type": "google.analytics.admin_v1alpha.types.AttributionSettings" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.AttributionSettings", - "shortName": "update_attribution_settings" - }, - "description": "Sample for UpdateAttributionSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_attribution_settings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAttributionSettings_sync", - "segments": [ - { - "end": 57, - "start": 27, - "type": "FULL" - }, - { - "end": 57, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 54, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 58, - "start": 55, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_attribution_settings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_audience", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateAudience", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateAudience" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateAudienceRequest" - }, - { - "name": "audience", - "type": "google.analytics.admin_v1alpha.types.Audience" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Audience", - "shortName": "update_audience" - }, - "description": "Sample for UpdateAudience", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_audience_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAudience_async", - "segments": [ - { - "end": 58, - "start": 27, - "type": "FULL" - }, - { - "end": 58, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 55, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 59, - "start": 56, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_audience_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_audience", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateAudience", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateAudience" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateAudienceRequest" - }, - { - "name": "audience", - "type": "google.analytics.admin_v1alpha.types.Audience" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Audience", - "shortName": "update_audience" - }, - "description": "Sample for UpdateAudience", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_audience_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateAudience_sync", - "segments": [ - { - "end": 58, - "start": 27, - "type": "FULL" - }, - { - "end": 58, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 52, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 55, - "start": 53, - "type": "REQUEST_EXECUTION" - }, - { - "end": 59, - "start": 56, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_audience_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_channel_group", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateChannelGroup", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateChannelGroup" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateChannelGroupRequest" - }, - { - "name": "channel_group", - "type": "google.analytics.admin_v1alpha.types.ChannelGroup" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ChannelGroup", - "shortName": "update_channel_group" - }, - "description": "Sample for UpdateChannelGroup", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_channel_group_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateChannelGroup_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_channel_group_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_channel_group", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateChannelGroup", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateChannelGroup" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateChannelGroupRequest" - }, - { - "name": "channel_group", - "type": "google.analytics.admin_v1alpha.types.ChannelGroup" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ChannelGroup", - "shortName": "update_channel_group" - }, - "description": "Sample for UpdateChannelGroup", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_channel_group_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateChannelGroup_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_channel_group_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_conversion_event", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateConversionEvent", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateConversionEvent" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateConversionEventRequest" - }, - { - "name": "conversion_event", - "type": "google.analytics.admin_v1alpha.types.ConversionEvent" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ConversionEvent", - "shortName": "update_conversion_event" - }, - "description": "Sample for UpdateConversionEvent", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateConversionEvent_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_conversion_event", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateConversionEvent", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateConversionEvent" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateConversionEventRequest" - }, - { - "name": "conversion_event", - "type": "google.analytics.admin_v1alpha.types.ConversionEvent" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ConversionEvent", - "shortName": "update_conversion_event" - }, - "description": "Sample for UpdateConversionEvent", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateConversionEvent_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_custom_dimension", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateCustomDimension", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateCustomDimension" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateCustomDimensionRequest" - }, - { - "name": "custom_dimension", - "type": "google.analytics.admin_v1alpha.types.CustomDimension" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CustomDimension", - "shortName": "update_custom_dimension" - }, - "description": "Sample for UpdateCustomDimension", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_dimension_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomDimension_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_dimension_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_custom_dimension", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateCustomDimension", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateCustomDimension" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateCustomDimensionRequest" - }, - { - "name": "custom_dimension", - "type": "google.analytics.admin_v1alpha.types.CustomDimension" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CustomDimension", - "shortName": "update_custom_dimension" - }, - "description": "Sample for UpdateCustomDimension", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_dimension_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomDimension_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_dimension_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_custom_metric", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateCustomMetric", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateCustomMetric" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateCustomMetricRequest" - }, - { - "name": "custom_metric", - "type": "google.analytics.admin_v1alpha.types.CustomMetric" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CustomMetric", - "shortName": "update_custom_metric" - }, - "description": "Sample for UpdateCustomMetric", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_metric_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomMetric_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_metric_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_custom_metric", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateCustomMetric", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateCustomMetric" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateCustomMetricRequest" - }, - { - "name": "custom_metric", - "type": "google.analytics.admin_v1alpha.types.CustomMetric" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.CustomMetric", - "shortName": "update_custom_metric" - }, - "description": "Sample for UpdateCustomMetric", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_metric_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateCustomMetric_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_custom_metric_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_data_retention_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateDataRetentionSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateDataRetentionSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateDataRetentionSettingsRequest" - }, - { - "name": "data_retention_settings", - "type": "google.analytics.admin_v1alpha.types.DataRetentionSettings" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DataRetentionSettings", - "shortName": "update_data_retention_settings" - }, - "description": "Sample for UpdateDataRetentionSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_retention_settings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataRetentionSettings_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_retention_settings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_data_retention_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateDataRetentionSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateDataRetentionSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateDataRetentionSettingsRequest" - }, - { - "name": "data_retention_settings", - "type": "google.analytics.admin_v1alpha.types.DataRetentionSettings" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DataRetentionSettings", - "shortName": "update_data_retention_settings" - }, - "description": "Sample for UpdateDataRetentionSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_retention_settings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataRetentionSettings_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_retention_settings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_data_stream", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateDataStream", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateDataStream" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateDataStreamRequest" - }, - { - "name": "data_stream", - "type": "google.analytics.admin_v1alpha.types.DataStream" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DataStream", - "shortName": "update_data_stream" - }, - "description": "Sample for UpdateDataStream", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_stream_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataStream_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_stream_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_data_stream", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateDataStream", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateDataStream" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateDataStreamRequest" - }, - { - "name": "data_stream", - "type": "google.analytics.admin_v1alpha.types.DataStream" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DataStream", - "shortName": "update_data_stream" - }, - "description": "Sample for UpdateDataStream", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_stream_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDataStream_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_data_stream_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_display_video360_advertiser_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateDisplayVideo360AdvertiserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateDisplayVideo360AdvertiserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateDisplayVideo360AdvertiserLinkRequest" - }, - { - "name": "display_video_360_advertiser_link", - "type": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink", - "shortName": "update_display_video360_advertiser_link" - }, - "description": "Sample for UpdateDisplayVideo360AdvertiserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_display_video360_advertiser_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDisplayVideo360AdvertiserLink_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_display_video360_advertiser_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_display_video360_advertiser_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateDisplayVideo360AdvertiserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateDisplayVideo360AdvertiserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateDisplayVideo360AdvertiserLinkRequest" - }, - { - "name": "display_video_360_advertiser_link", - "type": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink", - "shortName": "update_display_video360_advertiser_link" - }, - "description": "Sample for UpdateDisplayVideo360AdvertiserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_display_video360_advertiser_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateDisplayVideo360AdvertiserLink_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_display_video360_advertiser_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_enhanced_measurement_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateEnhancedMeasurementSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateEnhancedMeasurementSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateEnhancedMeasurementSettingsRequest" - }, - { - "name": "enhanced_measurement_settings", - "type": "google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings", - "shortName": "update_enhanced_measurement_settings" - }, - "description": "Sample for UpdateEnhancedMeasurementSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_enhanced_measurement_settings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateEnhancedMeasurementSettings_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_enhanced_measurement_settings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_enhanced_measurement_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateEnhancedMeasurementSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateEnhancedMeasurementSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateEnhancedMeasurementSettingsRequest" - }, - { - "name": "enhanced_measurement_settings", - "type": "google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.EnhancedMeasurementSettings", - "shortName": "update_enhanced_measurement_settings" - }, - "description": "Sample for UpdateEnhancedMeasurementSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_enhanced_measurement_settings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateEnhancedMeasurementSettings_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_enhanced_measurement_settings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_event_create_rule", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateEventCreateRule", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateEventCreateRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateEventCreateRuleRequest" - }, - { - "name": "event_create_rule", - "type": "google.analytics.admin_v1alpha.types.EventCreateRule" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.EventCreateRule", - "shortName": "update_event_create_rule" - }, - "description": "Sample for UpdateEventCreateRule", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_event_create_rule_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateEventCreateRule_async", - "segments": [ - { - "end": 57, - "start": 27, - "type": "FULL" - }, - { - "end": 57, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 54, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 58, - "start": 55, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_event_create_rule_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_event_create_rule", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateEventCreateRule", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateEventCreateRule" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateEventCreateRuleRequest" - }, - { - "name": "event_create_rule", - "type": "google.analytics.admin_v1alpha.types.EventCreateRule" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.EventCreateRule", - "shortName": "update_event_create_rule" - }, - "description": "Sample for UpdateEventCreateRule", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_event_create_rule_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateEventCreateRule_sync", - "segments": [ - { - "end": 57, - "start": 27, - "type": "FULL" - }, - { - "end": 57, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 51, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 54, - "start": 52, - "type": "REQUEST_EXECUTION" - }, - { - "end": 58, - "start": 55, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_event_create_rule_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_expanded_data_set", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateExpandedDataSet", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateExpandedDataSet" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateExpandedDataSetRequest" - }, - { - "name": "expanded_data_set", - "type": "google.analytics.admin_v1alpha.types.ExpandedDataSet" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ExpandedDataSet", - "shortName": "update_expanded_data_set" - }, - "description": "Sample for UpdateExpandedDataSet", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_expanded_data_set_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateExpandedDataSet_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_expanded_data_set_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_expanded_data_set", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateExpandedDataSet", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateExpandedDataSet" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateExpandedDataSetRequest" - }, - { - "name": "expanded_data_set", - "type": "google.analytics.admin_v1alpha.types.ExpandedDataSet" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.ExpandedDataSet", - "shortName": "update_expanded_data_set" - }, - "description": "Sample for UpdateExpandedDataSet", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_expanded_data_set_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateExpandedDataSet_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_expanded_data_set_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_google_ads_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateGoogleAdsLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateGoogleAdsLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateGoogleAdsLinkRequest" - }, - { - "name": "google_ads_link", - "type": "google.analytics.admin_v1alpha.types.GoogleAdsLink" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.GoogleAdsLink", - "shortName": "update_google_ads_link" - }, - "description": "Sample for UpdateGoogleAdsLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_ads_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleAdsLink_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_ads_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_google_ads_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateGoogleAdsLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateGoogleAdsLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateGoogleAdsLinkRequest" - }, - { - "name": "google_ads_link", - "type": "google.analytics.admin_v1alpha.types.GoogleAdsLink" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.GoogleAdsLink", - "shortName": "update_google_ads_link" - }, - "description": "Sample for UpdateGoogleAdsLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_ads_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleAdsLink_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_ads_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_google_signals_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateGoogleSignalsSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateGoogleSignalsSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateGoogleSignalsSettingsRequest" - }, - { - "name": "google_signals_settings", - "type": "google.analytics.admin_v1alpha.types.GoogleSignalsSettings" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.GoogleSignalsSettings", - "shortName": "update_google_signals_settings" - }, - "description": "Sample for UpdateGoogleSignalsSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_signals_settings_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleSignalsSettings_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_signals_settings_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_google_signals_settings", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateGoogleSignalsSettings", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateGoogleSignalsSettings" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateGoogleSignalsSettingsRequest" - }, - { - "name": "google_signals_settings", - "type": "google.analytics.admin_v1alpha.types.GoogleSignalsSettings" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.GoogleSignalsSettings", - "shortName": "update_google_signals_settings" - }, - "description": "Sample for UpdateGoogleSignalsSettings", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_signals_settings_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateGoogleSignalsSettings_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_google_signals_settings_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_measurement_protocol_secret", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateMeasurementProtocolSecret", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateMeasurementProtocolSecret" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateMeasurementProtocolSecretRequest" - }, - { - "name": "measurement_protocol_secret", - "type": "google.analytics.admin_v1alpha.types.MeasurementProtocolSecret" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.MeasurementProtocolSecret", - "shortName": "update_measurement_protocol_secret" - }, - "description": "Sample for UpdateMeasurementProtocolSecret", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_measurement_protocol_secret_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateMeasurementProtocolSecret_async", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_measurement_protocol_secret_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_measurement_protocol_secret", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateMeasurementProtocolSecret", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateMeasurementProtocolSecret" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateMeasurementProtocolSecretRequest" - }, - { - "name": "measurement_protocol_secret", - "type": "google.analytics.admin_v1alpha.types.MeasurementProtocolSecret" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.MeasurementProtocolSecret", - "shortName": "update_measurement_protocol_secret" - }, - "description": "Sample for UpdateMeasurementProtocolSecret", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_measurement_protocol_secret_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateMeasurementProtocolSecret_sync", - "segments": [ - { - "end": 54, - "start": 27, - "type": "FULL" - }, - { - "end": 54, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 48, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 51, - "start": 49, - "type": "REQUEST_EXECUTION" - }, - { - "end": 55, - "start": 52, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_measurement_protocol_secret_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_property", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateProperty", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateProperty" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdatePropertyRequest" - }, - { - "name": "property", - "type": "google.analytics.admin_v1alpha.types.Property" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Property", - "shortName": "update_property" - }, - "description": "Sample for UpdateProperty", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_property_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateProperty_async", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_property_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_property", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateProperty", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateProperty" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdatePropertyRequest" - }, - { - "name": "property", - "type": "google.analytics.admin_v1alpha.types.Property" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.Property", - "shortName": "update_property" - }, - "description": "Sample for UpdateProperty", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_property_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateProperty_sync", - "segments": [ - { - "end": 55, - "start": 27, - "type": "FULL" - }, - { - "end": 55, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 49, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 52, - "start": 50, - "type": "REQUEST_EXECUTION" - }, - { - "end": 56, - "start": 53, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_property_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_sk_ad_network_conversion_value_schema", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateSKAdNetworkConversionValueSchema", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateSKAdNetworkConversionValueSchema" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateSKAdNetworkConversionValueSchemaRequest" - }, - { - "name": "skadnetwork_conversion_value_schema", - "type": "google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema", - "shortName": "update_sk_ad_network_conversion_value_schema" - }, - "description": "Sample for UpdateSKAdNetworkConversionValueSchema", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_sk_ad_network_conversion_value_schema_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateSKAdNetworkConversionValueSchema_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_sk_ad_network_conversion_value_schema_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_sk_ad_network_conversion_value_schema", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateSKAdNetworkConversionValueSchema", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateSKAdNetworkConversionValueSchema" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateSKAdNetworkConversionValueSchemaRequest" - }, - { - "name": "skadnetwork_conversion_value_schema", - "type": "google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SKAdNetworkConversionValueSchema", - "shortName": "update_sk_ad_network_conversion_value_schema" - }, - "description": "Sample for UpdateSKAdNetworkConversionValueSchema", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_sk_ad_network_conversion_value_schema_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateSKAdNetworkConversionValueSchema_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_sk_ad_network_conversion_value_schema_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_search_ads360_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateSearchAds360Link", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateSearchAds360Link" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateSearchAds360LinkRequest" - }, - { - "name": "search_ads_360_link", - "type": "google.analytics.admin_v1alpha.types.SearchAds360Link" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SearchAds360Link", - "shortName": "update_search_ads360_link" - }, - "description": "Sample for UpdateSearchAds360Link", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_search_ads360_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateSearchAds360Link_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_search_ads360_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_search_ads360_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateSearchAds360Link", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateSearchAds360Link" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateSearchAds360LinkRequest" - }, - { - "name": "search_ads_360_link", - "type": "google.analytics.admin_v1alpha.types.SearchAds360Link" - }, - { - "name": "update_mask", - "type": "google.protobuf.field_mask_pb2.FieldMask" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.SearchAds360Link", - "shortName": "update_search_ads360_link" - }, - "description": "Sample for UpdateSearchAds360Link", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_search_ads360_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateSearchAds360Link_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_search_ads360_link_sync.py" - }, - { - "canonical": true, - "clientMethod": { - "async": true, - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", - "shortName": "AnalyticsAdminServiceAsyncClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_user_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateUserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateUserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateUserLinkRequest" - }, - { - "name": "user_link", - "type": "google.analytics.admin_v1alpha.types.UserLink" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.UserLink", - "shortName": "update_user_link" - }, - "description": "Sample for UpdateUserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_user_link_async.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateUserLink_async", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_user_link_async.py" - }, - { - "canonical": true, - "clientMethod": { - "client": { - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", - "shortName": "AnalyticsAdminServiceClient" - }, - "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_user_link", - "method": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateUserLink", - "service": { - "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", - "shortName": "AnalyticsAdminService" - }, - "shortName": "UpdateUserLink" - }, - "parameters": [ - { - "name": "request", - "type": "google.analytics.admin_v1alpha.types.UpdateUserLinkRequest" - }, - { - "name": "user_link", - "type": "google.analytics.admin_v1alpha.types.UserLink" - }, - { - "name": "retry", - "type": "google.api_core.retry.Retry" - }, - { - "name": "timeout", - "type": "float" - }, - { - "name": "metadata", - "type": "Sequence[Tuple[str, str]" - } - ], - "resultType": "google.analytics.admin_v1alpha.types.UserLink", - "shortName": "update_user_link" - }, - "description": "Sample for UpdateUserLink", - "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_user_link_sync.py", - "language": "PYTHON", - "origin": "API_DEFINITION", - "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateUserLink_sync", - "segments": [ - { - "end": 50, - "start": 27, - "type": "FULL" - }, - { - "end": 50, - "start": 27, - "type": "SHORT" - }, - { - "end": 40, - "start": 38, - "type": "CLIENT_INITIALIZATION" - }, - { - "end": 44, - "start": 41, - "type": "REQUEST_INITIALIZATION" - }, - { - "end": 47, - "start": 45, - "type": "REQUEST_EXECUTION" - }, - { - "end": 51, - "start": 48, - "type": "RESPONSE_HANDLING" - } - ], - "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_user_link_sync.py" - } - ] -} diff --git a/samples/generated_samples/snippet_metadata_google.analytics.admin.v1beta.json b/samples/generated_samples/snippet_metadata_google.analytics.admin.v1beta.json index 96359370..537cb94c 100644 --- a/samples/generated_samples/snippet_metadata_google.analytics.admin.v1beta.json +++ b/samples/generated_samples/snippet_metadata_google.analytics.admin.v1beta.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-analytics-admin", - "version": "0.21.0" + "version": "0.22.0" }, "snippets": [ { diff --git a/samples/noxfile.py b/samples/noxfile.py deleted file mode 100644 index de104dbc..00000000 --- a/samples/noxfile.py +++ /dev/null @@ -1,292 +0,0 @@ -# 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 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from __future__ import print_function - -import glob -import os -from pathlib import Path -import sys -from typing import Callable, Dict, Optional - -import nox - -# WARNING - WARNING - WARNING - WARNING - WARNING -# WARNING - WARNING - WARNING - WARNING - WARNING -# DO NOT EDIT THIS FILE EVER! -# WARNING - WARNING - WARNING - WARNING - WARNING -# WARNING - WARNING - WARNING - WARNING - WARNING - -BLACK_VERSION = "black==22.3.0" -ISORT_VERSION = "isort==5.10.1" - -# Copy `noxfile_config.py` to your directory and modify it instead. - -# `TEST_CONFIG` dict is a configuration hook that allows users to -# modify the test configurations. The values here should be in sync -# with `noxfile_config.py`. Users will copy `noxfile_config.py` into -# their directory and modify it. - -TEST_CONFIG = { - # You can opt out from the test for specific Python versions. - "ignored_versions": [], - # Old samples are opted out of enforcing Python type hints - # All new samples should feature them - "enforce_type_hints": False, - # An envvar key for determining the project id to use. Change it - # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a - # build specific Cloud project. You can also use your own string - # to use your own Cloud project. - "gcloud_project_env": "GOOGLE_CLOUD_PROJECT", - # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT', - # If you need to use a specific version of pip, - # change pip_version_override to the string representation - # of the version number, for example, "20.2.4" - "pip_version_override": None, - # A dictionary you want to inject into your test. Don't put any - # secrets here. These values will override predefined values. - "envs": {}, -} - - -try: - # Ensure we can import noxfile_config in the project's directory. - sys.path.append(".") - from noxfile_config import TEST_CONFIG_OVERRIDE -except ImportError as e: - print("No user noxfile_config found: detail: {}".format(e)) - TEST_CONFIG_OVERRIDE = {} - -# Update the TEST_CONFIG with the user supplied values. -TEST_CONFIG.update(TEST_CONFIG_OVERRIDE) - - -def get_pytest_env_vars() -> Dict[str, str]: - """Returns a dict for pytest invocation.""" - ret = {} - - # Override the GCLOUD_PROJECT and the alias. - env_key = TEST_CONFIG["gcloud_project_env"] - # This should error out if not set. - ret["GOOGLE_CLOUD_PROJECT"] = os.environ[env_key] - - # Apply user supplied envs. - ret.update(TEST_CONFIG["envs"]) - return ret - - -# DO NOT EDIT - automatically generated. -# All versions used to test samples. -ALL_VERSIONS = ["3.7", "3.8", "3.9", "3.10", "3.11"] - -# Any default versions that should be ignored. -IGNORED_VERSIONS = TEST_CONFIG["ignored_versions"] - -TESTED_VERSIONS = sorted([v for v in ALL_VERSIONS if v not in IGNORED_VERSIONS]) - -INSTALL_LIBRARY_FROM_SOURCE = os.environ.get("INSTALL_LIBRARY_FROM_SOURCE", False) in ( - "True", - "true", -) - -# Error if a python version is missing -nox.options.error_on_missing_interpreters = True - -# -# Style Checks -# - - -# Linting with flake8. -# -# We ignore the following rules: -# E203: whitespace before ‘:’ -# E266: too many leading ‘#’ for block comment -# E501: line too long -# I202: Additional newline in a section of imports -# -# We also need to specify the rules which are ignored by default: -# ['E226', 'W504', 'E126', 'E123', 'W503', 'E24', 'E704', 'E121'] -FLAKE8_COMMON_ARGS = [ - "--show-source", - "--builtin=gettext", - "--max-complexity=20", - "--exclude=.nox,.cache,env,lib,generated_pb2,*_pb2.py,*_pb2_grpc.py", - "--ignore=E121,E123,E126,E203,E226,E24,E266,E501,E704,W503,W504,I202", - "--max-line-length=88", -] - - -@nox.session -def lint(session: nox.sessions.Session) -> None: - if not TEST_CONFIG["enforce_type_hints"]: - session.install("flake8") - else: - session.install("flake8", "flake8-annotations") - - args = FLAKE8_COMMON_ARGS + [ - ".", - ] - session.run("flake8", *args) - - -# -# Black -# - - -@nox.session -def blacken(session: nox.sessions.Session) -> None: - """Run black. Format code to uniform standard.""" - session.install(BLACK_VERSION) - python_files = [path for path in os.listdir(".") if path.endswith(".py")] - - session.run("black", *python_files) - - -# -# format = isort + black -# - - -@nox.session -def format(session: nox.sessions.Session) -> None: - """ - Run isort to sort imports. Then run black - to format code to uniform standard. - """ - session.install(BLACK_VERSION, ISORT_VERSION) - python_files = [path for path in os.listdir(".") if path.endswith(".py")] - - # Use the --fss option to sort imports using strict alphabetical order. - # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sections - session.run("isort", "--fss", *python_files) - session.run("black", *python_files) - - -# -# Sample Tests -# - - -PYTEST_COMMON_ARGS = ["--junitxml=sponge_log.xml"] - - -def _session_tests( - session: nox.sessions.Session, post_install: Callable = None -) -> None: - # check for presence of tests - test_list = glob.glob("**/*_test.py", recursive=True) + glob.glob( - "**/test_*.py", recursive=True - ) - test_list.extend(glob.glob("**/tests", recursive=True)) - - if len(test_list) == 0: - print("No tests found, skipping directory.") - return - - if TEST_CONFIG["pip_version_override"]: - pip_version = TEST_CONFIG["pip_version_override"] - session.install(f"pip=={pip_version}") - """Runs py.test for a particular project.""" - concurrent_args = [] - if os.path.exists("requirements.txt"): - if os.path.exists("constraints.txt"): - session.install("-r", "requirements.txt", "-c", "constraints.txt") - else: - session.install("-r", "requirements.txt") - with open("requirements.txt") as rfile: - packages = rfile.read() - - if os.path.exists("requirements-test.txt"): - if os.path.exists("constraints-test.txt"): - session.install("-r", "requirements-test.txt", "-c", "constraints-test.txt") - else: - session.install("-r", "requirements-test.txt") - with open("requirements-test.txt") as rtfile: - packages += rtfile.read() - - if INSTALL_LIBRARY_FROM_SOURCE: - session.install("-e", _get_repo_root()) - - if post_install: - post_install(session) - - if "pytest-parallel" in packages: - concurrent_args.extend(["--workers", "auto", "--tests-per-worker", "auto"]) - elif "pytest-xdist" in packages: - concurrent_args.extend(["-n", "auto"]) - - session.run( - "pytest", - *(PYTEST_COMMON_ARGS + session.posargs + concurrent_args), - # Pytest will return 5 when no tests are collected. This can happen - # on travis where slow and flaky tests are excluded. - # See http://doc.pytest.org/en/latest/_modules/_pytest/main.html - success_codes=[0, 5], - env=get_pytest_env_vars(), - ) - - -@nox.session(python=ALL_VERSIONS) -def py(session: nox.sessions.Session) -> None: - """Runs py.test for a sample using the specified version of Python.""" - if session.python in TESTED_VERSIONS: - _session_tests(session) - else: - session.skip( - "SKIPPED: {} tests are disabled for this sample.".format(session.python) - ) - - -# -# Readmegen -# - - -def _get_repo_root() -> Optional[str]: - """Returns the root folder of the project.""" - # Get root of this repository. Assume we don't have directories nested deeper than 10 items. - p = Path(os.getcwd()) - for i in range(10): - if p is None: - break - if Path(p / ".git").exists(): - return str(p) - # .git is not available in repos cloned via Cloud Build - # setup.py is always in the library's root, so use that instead - # https://github.com/googleapis/synthtool/issues/792 - if Path(p / "setup.py").exists(): - return str(p) - p = p.parent - raise Exception("Unable to detect repository root.") - - -GENERATED_READMES = sorted([x for x in Path(".").rglob("*.rst.in")]) - - -@nox.session -@nox.parametrize("path", GENERATED_READMES) -def readmegen(session: nox.sessions.Session, path: str) -> None: - """(Re-)generates the readme for a sample.""" - session.install("jinja2", "pyyaml") - dir_ = os.path.dirname(path) - - if os.path.exists(os.path.join(dir_, "requirements.txt")): - session.install("-r", os.path.join(dir_, "requirements.txt")) - - in_file = os.path.join(dir_, "README.rst.in") - session.run( - "python", _get_repo_root() + "/scripts/readme-gen/readme_gen.py", in_file - ) diff --git a/samples/noxfile_config.py b/samples/noxfile_config.py deleted file mode 100644 index 03ab539a..00000000 --- a/samples/noxfile_config.py +++ /dev/null @@ -1,19 +0,0 @@ -TEST_CONFIG_OVERRIDE = { - # An envvar key for determining the project id to use. Change it - # to 'BUILD_SPECIFIC_GCLOUD_PROJECT' if you want to opt in using a - # build specific Cloud project. You can also use your own string - # to use your own Cloud project. - "gcloud_project_env": "BUILD_SPECIFIC_GCLOUD_PROJECT", - # 'gcloud_project_env': 'BUILD_SPECIFIC_GCLOUD_PROJECT', - # A dictionary you want to inject into your test. Don't put any - # secrets here. These values will override predefined values. - "envs": { - "GA_TEST_PROPERTY_ID": "276206997", - "GA_TEST_ACCOUNT_ID": "199820965", - "GA_TEST_USER_LINK_ID": "103401743041912607932", - "GA_TEST_PROPERTY_USER_LINK_ID": "105231969274497648555", - "GA_TEST_WEB_DATA_STREAM_ID": "2828068992", - "GA_TEST_WEB_DATA_SECRET_ID": "2994983412", - "GA_TEST_CONVERSION_EVENT_ID": "2719963095", - }, -} diff --git a/samples/properties_conversion_events_create.py b/samples/properties_conversion_events_create.py deleted file mode 100644 index 528ae838..00000000 --- a/samples/properties_conversion_events_create.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which creates a conversion -event for the Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents/create -for more information. -""" -# [START analyticsadmin_properties_conversion_events_create] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha import ConversionEvent - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics account ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - create_conversion_event(property_id) - - -def create_conversion_event(property_id: str, transport: str = None): - """ - Creates a conversion event for the Google Analytics 4 property. - - Args: - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - conversion_event = client.create_conversion_event( - parent=f"properties/{property_id}", - conversion_event=ConversionEvent(event_name="test_purchase"), - ) - - print("Result:") - print(f"Resource name: {conversion_event.name}") - print(f"Event name: {conversion_event.event_name}") - print(f"Create time: {conversion_event.create_time}") - print(f"Deletable: {conversion_event.deletable}") - print(f"Custom: {conversion_event.custom}") - - -# [END analyticsadmin_properties_conversion_events_create] - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_conversion_events_create_test.py b/samples/properties_conversion_events_create_test.py deleted file mode 100644 index 5012bdc1..00000000 --- a/samples/properties_conversion_events_create_test.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_conversion_events_create - -FAKE_PROPERTY_ID = "1" - - -def test_properties_conversion_events_create(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_conversion_events_create.create_conversion_event( - FAKE_PROPERTY_ID, transport=transport - ) diff --git a/samples/properties_conversion_events_delete.py b/samples/properties_conversion_events_delete.py deleted file mode 100644 index da463420..00000000 --- a/samples/properties_conversion_events_delete.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which deletes a conversion -event for the Google Analytics 4 property. - - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents/delete -for more information. -""" -# [START analyticsadmin_properties_conversion_events_delete] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your conversion event ID - # (e.g. "123456") before running the sample. - conversion_event_id = "YOUR-CONVERSION-EVENT-ID" - - delete_conversion_event(property_id, conversion_event_id) - - -def delete_conversion_event( - property_id: str, conversion_event_id: str, transport: str = None -): - """ - Deletes the conversion event for the Google Analytics 4 property. - - Args: - property_id(str): The Google Analytics Property ID. - conversion_event_id(str): The conversion event ID - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - client.delete_conversion_event( - name=f"properties/{property_id}/conversionEvents/{conversion_event_id}" - ) - print("Conversion event deleted") - - -# [END analyticsadmin_properties_conversion_events_delete] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_conversion_events_delete_test.py b/samples/properties_conversion_events_delete_test.py deleted file mode 100644 index 2a85c816..00000000 --- a/samples/properties_conversion_events_delete_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_conversion_events_delete - -FAKE_PROPERTY_ID = "1" -FAKE_CONVERSION_EVENT_ID = "1" - - -def test_properties_conversion_events_delete(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_conversion_events_delete.delete_conversion_event( - FAKE_PROPERTY_ID, FAKE_CONVERSION_EVENT_ID, transport=transport - ) diff --git a/samples/properties_conversion_events_get.py b/samples/properties_conversion_events_get.py deleted file mode 100644 index 6a8a4359..00000000 --- a/samples/properties_conversion_events_get.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints the conversion -event details. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents/get -for more information. -""" -# [START analyticsadmin_properties_conversion_events_get] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your conversion event ID - # (e.g. "123456") before running the sample. - conversion_event_id = "YOUR-CONVERSION-EVENT-ID" - - get_conversion_event(property_id, conversion_event_id) - - -def get_conversion_event( - property_id: str, conversion_event_id: str, transport: str = None -): - """ - Retrieves the details for the conversion event. - Args: - property_id(str): The Google Analytics Property ID. - conversion_event_id(str): The conversion event ID - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - conversion_event = client.get_conversion_event( - name=f"properties/{property_id}/conversionEvents/{conversion_event_id}" - ) - - print("Result:") - print(f"Resource name: {conversion_event.name}") - print(f"Event name: {conversion_event.event_name}") - print(f"Create time: {conversion_event.create_time}") - print(f"Deletable: {conversion_event.deletable}") - print(f"Custom: {conversion_event.custom}") - - -# [END analyticsadmin_properties_conversion_events_get] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_conversion_events_get_test.py b/samples/properties_conversion_events_get_test.py deleted file mode 100644 index 719c95dd..00000000 --- a/samples/properties_conversion_events_get_test.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_conversion_events_get - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") -TEST_CONVERSION_EVENT_ID = os.getenv("GA_TEST_CONVERSION_EVENT_ID") - - -def test_properties_conversion_events_get(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_conversion_events_get.get_conversion_event( - TEST_PROPERTY_ID, TEST_CONVERSION_EVENT_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_conversion_events_list.py b/samples/properties_conversion_events_list.py deleted file mode 100644 index 41c7a437..00000000 --- a/samples/properties_conversion_events_list.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which lists conversion events -for the Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.conversionEvents/list -for more information. -""" -# [START analyticsadmin_properties_conversion_events_list] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - list_conversion_events(property_id) - - -def list_conversion_events(property_id: str, transport: str = None): - """ - Lists conversion events for the Google Analytics 4 property. - - Args: - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - results = client.list_conversion_events(parent=f"properties/{property_id}") - - print("Result:") - for conversion_event in results: - print(f"Resource name: {conversion_event.name}") - print(f"Event name: {conversion_event.event_name}") - print(f"Create time: {conversion_event.create_time}") - print(f"Deletable: {conversion_event.deletable}") - print(f"Custom: {conversion_event.custom}") - print() - - -# [END analyticsadmin_properties_conversion_events_list] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_conversion_events_list_test.py b/samples/properties_conversion_events_list_test.py deleted file mode 100644 index 8687599d..00000000 --- a/samples/properties_conversion_events_list_test.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_conversion_events_list - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") - - -def test_properties_conversion_events_list(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_conversion_events_list.list_conversion_events( - TEST_PROPERTY_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_create.py b/samples/properties_create.py deleted file mode 100644 index 4b5cf8bc..00000000 --- a/samples/properties_create.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which creates a Google -Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/create -for more information. -""" -# [START analyticsadmin_properties_create] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import Property - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics account ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - create_property(account_id) - - -def create_property(account_id: str, transport: str = None): - """ - Creates a Google Analytics 4 property. - - Args: - account_id(str): The Google Analytics Account ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - property_ = client.create_property( - property=Property( - parent=f"accounts/{account_id}", - currency_code="USD", - display_name="Test property", - industry_category="OTHER", - time_zone="America/Los_Angeles", - ) - ) - - print("Result:") - print(property_) - - -# [END analyticsadmin_properties_create] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_create_test.py b/samples/properties_create_test.py deleted file mode 100644 index e935ad33..00000000 --- a/samples/properties_create_test.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_create - -FAKE_ACCOUNT_ID = "1" - - -def test_properties_create(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_create.create_property(FAKE_ACCOUNT_ID, transport=transport) diff --git a/samples/properties_data_streams_create.py b/samples/properties_data_streams_create.py deleted file mode 100644 index a8194470..00000000 --- a/samples/properties_data_streams_create.py +++ /dev/null @@ -1,70 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which creates a data stream -for the Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams/create -for more information. -""" -# [START analyticsadmin_properties_data_streams_create] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import DataStream - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics account ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - create_data_stream(property_id) - - -def create_data_stream(property_id: str, transport: str = None): - """ - Creates a data stream for the Google Analytics 4 property. - - Args: - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - data_stream = DataStream( - display_name="Test web data stream", - web_stream_data=DataStream.WebStreamData(default_uri="https://www.google.com"), - ) - data_stream.type_ = "WEB_DATA_STREAM" - result = client.create_data_stream( - parent=f"properties/{property_id}", - data_stream=data_stream, - ) - - print("Result:") - print(result) - - -# [END analyticsadmin_properties_data_streams_create] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_data_streams_create_test.py b/samples/properties_data_streams_create_test.py deleted file mode 100644 index b6f7d697..00000000 --- a/samples/properties_data_streams_create_test.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_data_streams_create - -FAKE_PROPERTY_ID = "1" - - -def test_properties_data_streams_create(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_data_streams_create.create_data_stream( - FAKE_PROPERTY_ID, transport=transport - ) diff --git a/samples/properties_data_streams_delete.py b/samples/properties_data_streams_delete.py deleted file mode 100644 index 7fe37fa4..00000000 --- a/samples/properties_data_streams_delete.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which deletes the data -stream from the Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams/delete -for more information. -""" -# [START analyticsadmin_properties_data_streams_delete] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your data stream ID - # (e.g. "123456") before running the sample. - stream_id = "YOUR-DATA-STREAM-ID" - - delete_data_stream(property_id, stream_id) - - -def delete_data_stream(property_id: str, stream_id: str, transport: str = None): - """ - Deletes the data stream from the Google Analytics 4 property. - - Args: - property_id(str): The Google Analytics Property ID. - stream_id(str): The data stream ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - client.delete_data_stream(name=f"properties/{property_id}/dataStreams/{stream_id}") - print("Data stream deleted") - - -# [END analyticsadmin_properties_data_streams_delete] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_data_streams_delete_test.py b/samples/properties_data_streams_delete_test.py deleted file mode 100644 index 75ec1a84..00000000 --- a/samples/properties_data_streams_delete_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_data_streams_delete - -FAKE_PROPERTY_ID = "1" -FAKE_STREAM_ID = "1" - - -def test_properties_data_streams_delete(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_data_streams_delete.delete_data_stream( - FAKE_PROPERTY_ID, FAKE_STREAM_ID, transport=transport - ) diff --git a/samples/properties_data_streams_get.py b/samples/properties_data_streams_get.py deleted file mode 100644 index 789fb197..00000000 --- a/samples/properties_data_streams_get.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints the details for -the data stream. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams/get -for more information. -""" -# [START analyticsadmin_properties_data_streams_get] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your data stream ID - # (e.g. "123456") before running the sample. - stream_id = "YOUR-DATA-STREAM-ID" - - get_data_stream(property_id, stream_id) - - -def get_data_stream(property_id: str, stream_id: str, transport: str = None): - """ - Retrieves the details for the data stream. - - Args: - property_id(str): The Google Analytics Property ID. - stream_id(str): The data stream ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - data_stream = client.get_data_stream( - name=f"properties/{property_id}/dataStreams/{stream_id}" - ) - - print("Result:") - print_data_stream(data_stream) - - -def print_data_stream(data_stream): - """Prints the data stream details.""" - print(f"Resource name: {data_stream.name}") - print(f"Display name: {data_stream.display_name}") - print(f"Type: {data_stream.type}") - print(f"Default URI: {data_stream.web_stream_data.default_uri}") - print(f"Measurement ID: {data_stream.web_stream_data.measurement_id}") - print(f"Firebase App ID: {data_stream.web_stream_data.firebase_app_id}") - print(f"Create time: {data_stream.create_time}") - print(f"Update time: {data_stream.update_time}") - - -# [END analyticsadmin_properties_data_streams_get] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_data_streams_get_global_site_tag.py b/samples/properties_data_streams_get_global_site_tag.py deleted file mode 100644 index 9bffcaaa..00000000 --- a/samples/properties_data_streams_get_global_site_tag.py +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints the Site Tag data -for the specified web stream. -""" -# [START analyticsadmin_properties_data_streams_get_global_site_tag] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your data stream ID - # (e.g. "123456") before running the sample. - stream_id = "YOUR-DATA-STREAM-ID" - - get_global_site_tag(property_id, stream_id) - - -def get_global_site_tag(property_id: str, stream_id: str, transport: str = None): - """ - Retrieves the Site Tag for the specified data stream. - - Args: - property_id(str): The Google Analytics Property ID. - stream_id(str): The data stream ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - global_site_tag = client.get_global_site_tag( - name=f"properties/{property_id}/dataStreams/{stream_id}/globalSiteTag" - ) - - print("Result:") - print(global_site_tag.snippet) - - -# [END analyticsadmin_properties_data_streams_get_global_site_tag] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_data_streams_get_global_site_tag_test.py b/samples/properties_data_streams_get_global_site_tag_test.py deleted file mode 100644 index 05d4b362..00000000 --- a/samples/properties_data_streams_get_global_site_tag_test.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_data_streams_get_global_site_tag - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") -TEST_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID") - - -def test_properties_data_streams_get_global_site_tag(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_data_streams_get_global_site_tag.get_global_site_tag( - TEST_PROPERTY_ID, TEST_DATA_STREAM_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_data_streams_get_test.py b/samples/properties_data_streams_get_test.py deleted file mode 100644 index c56e6964..00000000 --- a/samples/properties_data_streams_get_test.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_data_streams_get - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") -TEST_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID") - - -def test_properties_data_streams_get(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_data_streams_get.get_data_stream( - TEST_PROPERTY_ID, TEST_DATA_STREAM_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_data_streams_list.py b/samples/properties_data_streams_list.py deleted file mode 100644 index 18c64ff2..00000000 --- a/samples/properties_data_streams_list.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints data streams -for the Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams/list -for more information. -""" -# [START analyticsadmin_properties_data_streams_list] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - list_data_streams(property_id) - - -def list_data_streams(property_id: str, transport: str = None): - """ - Lists data streams for the Google Analytics 4 property. - - Args: - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - results = client.list_data_streams(parent=f"properties/{property_id}") - - print("Result:") - for data_stream in results: - print(data_stream) - print() - - -# [END analyticsadmin_properties_data_streams_list] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_data_streams_list_test.py b/samples/properties_data_streams_list_test.py deleted file mode 100644 index b988595b..00000000 --- a/samples/properties_data_streams_list_test.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_data_streams_list - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") - - -def test_properties_data_streams_list(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_data_streams_list.list_data_streams( - TEST_PROPERTY_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_data_streams_measurement_protocol_secrets_create.py b/samples/properties_data_streams_measurement_protocol_secrets_create.py deleted file mode 100644 index a7926d7f..00000000 --- a/samples/properties_data_streams_measurement_protocol_secrets_create.py +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which creates a measurement -protocol secret for the data stream. - -""" -# [START analyticsadmin_properties_data_streams_measurement_protocol_secrets_create] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha import MeasurementProtocolSecret - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your data stream ID - # (e.g. "123456") before running the sample. - stream_id = "YOUR-DATA-STREAM-ID" - - create_measurement_protocol_secret(property_id, stream_id) - - -def create_measurement_protocol_secret( - property_id: str, stream_id: str, transport: str = None -): - """ - Creates a measurement protocol secret for the data stream. - - Args: - property_id(str): The Google Analytics Property ID. - stream_id(str): The data stream ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - measurement_protocol_secret = client.create_measurement_protocol_secret( - parent=f"properties/{property_id}/dataStreams/{stream_id}", - measurement_protocol_secret=MeasurementProtocolSecret( - display_name="New secret" - ), - ) - - print("Result:") - print(f"Resource name: {measurement_protocol_secret.name}") - print(f"Secret value: {measurement_protocol_secret.secret_value}") - print(f"Display name: {measurement_protocol_secret.display_name}") - - -# [END analyticsadmin_properties_data_streams_measurement_protocol_secrets_create] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_data_streams_measurement_protocol_secrets_create_test.py b/samples/properties_data_streams_measurement_protocol_secrets_create_test.py deleted file mode 100644 index 298d0dc0..00000000 --- a/samples/properties_data_streams_measurement_protocol_secrets_create_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_data_streams_measurement_protocol_secrets_create - -FAKE_PROPERTY_ID = "1" -FAKE_STREAM_ID = "1" - - -def test_properties_data_streams_measurement_protocol_secrets_create(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_data_streams_measurement_protocol_secrets_create.create_measurement_protocol_secret( - FAKE_PROPERTY_ID, FAKE_STREAM_ID, transport=transport - ) diff --git a/samples/properties_data_streams_measurement_protocol_secrets_delete.py b/samples/properties_data_streams_measurement_protocol_secrets_delete.py deleted file mode 100644 index 81b19181..00000000 --- a/samples/properties_data_streams_measurement_protocol_secrets_delete.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which deletes a measurement -protocol secret for the data stream. - -""" -# [START analyticsadmin_properties_data_streams_measurement_protocol_secrets_delete] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your data stream ID - # (e.g. "123456") before running the sample. - stream_id = "YOUR-DATA-STREAM-ID" - - # TODO(developer): Replace this variable with your measurement protocol - # secret ID (e.g. "123456") before running the sample. - secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID" - - delete_measurement_protocol_secret(property_id, stream_id, secret_id) - - -def delete_measurement_protocol_secret( - property_id: str, stream_id: str, secret_id: str, transport: str = None -): - """ - Deletes a measurement protocol secret for the data stream. - - Args: - property_id(str): The Google Analytics Property ID. - stream_id(str): The data stream ID. - secret_id(str): The measurement protocol secret ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - client.delete_measurement_protocol_secret( - name=f"properties/{property_id}/dataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}" - ) - print("Measurement protocol secret deleted") - - -# [END analyticsadmin_properties_data_streams_measurement_protocol_secrets_delete] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_data_streams_measurement_protocol_secrets_delete_test.py b/samples/properties_data_streams_measurement_protocol_secrets_delete_test.py deleted file mode 100644 index d892c89c..00000000 --- a/samples/properties_data_streams_measurement_protocol_secrets_delete_test.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_data_streams_measurement_protocol_secrets_delete - -FAKE_PROPERTY_ID = "1" -FAKE_STREAM_ID = "1" -FAKE_SECRET_ID = "1" - - -def test_properties_data_streams_measurement_protocol_secrets_delete(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_data_streams_measurement_protocol_secrets_delete.delete_measurement_protocol_secret( - FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID, transport=transport - ) diff --git a/samples/properties_data_streams_measurement_protocol_secrets_get.py b/samples/properties_data_streams_measurement_protocol_secrets_get.py deleted file mode 100644 index 15720f8a..00000000 --- a/samples/properties_data_streams_measurement_protocol_secrets_get.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which retrieves the details -for the measurement protocol secret. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams.measurementProtocolSecrets/get -for more information. -""" -# [START analyticsadmin_properties_data_streams_measurement_protocol_secrets_get] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your data stream ID - # (e.g. "123456") before running the sample. - stream_id = "YOUR-DATA-STREAM-ID" - - # TODO(developer): Replace this variable with your measurement protocol - # secret ID (e.g. "123456") before running the sample. - secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID" - - get_measurement_protocol_secret(property_id, stream_id, secret_id) - - -def get_measurement_protocol_secret( - property_id: str, stream_id: str, secret_id: str, transport: str = None -): - """ - Retrieves the details for the measurement protocol secret. - - Args: - property_id(str): The Google Analytics Property ID. - stream_id(str): The data stream ID. - secret_id(str): The measurement protocol secret ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - measurement_protocol_secret = client.get_measurement_protocol_secret( - name=f"properties/{property_id}/dataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}" - ) - - print("Result:") - print(f"Resource name: {measurement_protocol_secret.name}") - print(f"Secret value: {measurement_protocol_secret.secret_value}") - print(f"Display name: {measurement_protocol_secret.display_name}") - - -# [END analyticsadmin_properties_data_streams_measurement_protocol_secrets_get] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_data_streams_measurement_protocol_secrets_get_test.py b/samples/properties_data_streams_measurement_protocol_secrets_get_test.py deleted file mode 100644 index 1e55aba9..00000000 --- a/samples/properties_data_streams_measurement_protocol_secrets_get_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_data_streams_measurement_protocol_secrets_get - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") -TEST_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID") -TEST_SECRET_ID = os.getenv("GA_TEST_WEB_DATA_SECRET_ID") - - -def test_properties_data_streams_measurement_protocol_secrets_get(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_data_streams_measurement_protocol_secrets_get.get_measurement_protocol_secret( - TEST_PROPERTY_ID, TEST_STREAM_ID, TEST_SECRET_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_data_streams_measurement_protocol_secrets_list.py b/samples/properties_data_streams_measurement_protocol_secrets_list.py deleted file mode 100644 index beeea207..00000000 --- a/samples/properties_data_streams_measurement_protocol_secrets_list.py +++ /dev/null @@ -1,67 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which lists measurement -protocol secrets for the data stream. - -""" -# [START analyticsadmin_properties_data_streams_measurement_protocol_secrets_list] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your data stream ID - # (e.g. "123456") before running the sample. - stream_id = "YOUR-DATA-STREAM-ID" - list_measurement_protocol_secrets(property_id, stream_id) - - -def list_measurement_protocol_secrets( - property_id: str, stream_id: str, transport: str = None -): - """ - Lists measurement protocol secrets for the data stream. - - Args: - property_id(str): The Google Analytics Property ID. - stream_id(str): The data stream ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - results = client.list_measurement_protocol_secrets( - parent=f"properties/{property_id}/dataStreams/{stream_id}" - ) - - print("Result:") - for measurement_protocol_secret in results: - print("Result:") - print(f"Resource name: {measurement_protocol_secret.name}") - print(f"Secret value: {measurement_protocol_secret.secret_value}") - print(f"Display name: {measurement_protocol_secret.display_name}") - print() - - -# [END analyticsadmin_properties_data_streams_measurement_protocol_secrets_list] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_data_streams_measurement_protocol_secrets_list_test.py b/samples/properties_data_streams_measurement_protocol_secrets_list_test.py deleted file mode 100644 index 7b0238fd..00000000 --- a/samples/properties_data_streams_measurement_protocol_secrets_list_test.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_data_streams_measurement_protocol_secrets_list - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") -TEST_DATA_STREAM_ID = os.getenv("GA_TEST_WEB_DATA_STREAM_ID") - - -def test_properties_data_streams_measurement_protocol_secrets_list(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_data_streams_measurement_protocol_secrets_list.list_measurement_protocol_secrets( - TEST_PROPERTY_ID, TEST_DATA_STREAM_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_data_streams_measurement_protocol_secrets_update.py b/samples/properties_data_streams_measurement_protocol_secrets_update.py deleted file mode 100644 index b37335d8..00000000 --- a/samples/properties_data_streams_measurement_protocol_secrets_update.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which updates the measurement -protocol secret for the data stream. - -""" -# [START analyticsadmin_properties_data_streams_measurement_protocol_secrets_update] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha import MeasurementProtocolSecret -from google.protobuf.field_mask_pb2 import FieldMask - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your data stream ID - # (e.g. "123456") before running the sample. - stream_id = "YOUR-DATA-STREAM-ID" - - # TODO(developer): Replace this variable with your measurement protocol - # secret ID (e.g. "123456") before running the sample. - secret_id = "YOUR-MEASUREMENT-PROTOCOL-SECRET-ID" - - update_measurement_protocol_secret(property_id, stream_id, secret_id) - - -def update_measurement_protocol_secret( - property_id: str, stream_id: str, secret_id: str, transport: str = None -): - """ - Updates the measurement protocol secret. - - Args: - property_id(str): The Google Analytics Property ID. - stream_id(str): The data stream ID. - secret_id(str): The measurement protocol secret ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - # This call updates the display name of the measurement protocol secret, as - # indicated by the value of the `update_mask` field. The measurement - # protocol secret to update is specified in the `name` field of the - # `MeasurementProtocolSecret` instance. - measurement_protocol_secret = client.update_measurement_protocol_secret( - measurement_protocol_secret=MeasurementProtocolSecret( - name=f"properties/{property_id}/dataStreams/{stream_id}/measurementProtocolSecrets/{secret_id}", - display_name="This is an updated measurement protocol secret", - ), - update_mask=FieldMask(paths=["display_name"]), - ) - - print("Result:") - print(f"Resource name: {measurement_protocol_secret.name}") - print(f"Secret value: {measurement_protocol_secret.secret_value}") - print(f"Display name: {measurement_protocol_secret.display_name}") - - -# [END analyticsadmin_properties_data_streams_measurement_protocol_secrets_update] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_data_streams_measurement_protocol_secrets_update_test.py b/samples/properties_data_streams_measurement_protocol_secrets_update_test.py deleted file mode 100644 index 5a6455ca..00000000 --- a/samples/properties_data_streams_measurement_protocol_secrets_update_test.py +++ /dev/null @@ -1,32 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_data_streams_measurement_protocol_secrets_update - -FAKE_PROPERTY_ID = "1" -FAKE_STREAM_ID = "1" -FAKE_SECRET_ID = "1" - - -def test_properties_data_streams_measurement_protocol_secrets_update(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_data_streams_measurement_protocol_secrets_update.update_measurement_protocol_secret( - FAKE_PROPERTY_ID, FAKE_STREAM_ID, FAKE_SECRET_ID, transport=transport - ) diff --git a/samples/properties_data_streams_update.py b/samples/properties_data_streams_update.py deleted file mode 100644 index e3de375f..00000000 --- a/samples/properties_data_streams_update.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which updates the data -stream. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.dataStreams/update -for more information. -""" -# [START analyticsadmin_properties_data_streams_update] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import DataStream -from google.protobuf.field_mask_pb2 import FieldMask - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your data stream ID - # (e.g. "123456") before running the sample. - stream_id = "YOUR-DATA-STREAM-ID" - - update_data_stream(property_id, stream_id) - - -def update_data_stream(property_id: str, stream_id: str, transport: str = None): - """ - Updates the data stream. - - Args: - property_id(str): The Google Analytics Property ID. - stream_id(str): The data stream ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - # This call updates the display name of the data stream, as indicated by - # the value of the `update_mask` field. The data stream to update is - # specified in the `name` field of the `dataStream` instance. - data_stream = client.update_data_stream( - data_stream=DataStream( - name=f"properties/{property_id}/dataStreams/{stream_id}", - display_name="This is an updated test data stream", - ), - update_mask=FieldMask(paths=["display_name"]), - ) - - print("Result:") - print(data_stream) - - -# [END analyticsadmin_properties_data_streams_update] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_data_streams_update_test.py b/samples/properties_data_streams_update_test.py deleted file mode 100644 index 0cae9341..00000000 --- a/samples/properties_data_streams_update_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_data_streams_update - -FAKE_PROPERTY_ID = "1" -FAKE_STREAM_ID = "1" - - -def test_properties_data_streams_update(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_data_streams_update.update_data_stream( - FAKE_PROPERTY_ID, FAKE_STREAM_ID, transport=transport - ) diff --git a/samples/properties_delete.py b/samples/properties_delete.py deleted file mode 100644 index 2e05f3c0..00000000 --- a/samples/properties_delete.py +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which deletes the Google -Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/delete -for more information. -""" -# [START analyticsadmin_properties_delete] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - delete_property(property_id) - - -def delete_property(property_id: str, transport: str = None): - """ - Deletes the Google Analytics 4 property. - - Args: - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - client.delete_property(name=f"properties/{property_id}") - print("Property deleted") - - -# [END analyticsadmin_properties_delete] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_delete_test.py b/samples/properties_delete_test.py deleted file mode 100644 index 7b929eaa..00000000 --- a/samples/properties_delete_test.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_delete - -FAKE_PROPERTY_ID = "1" - - -def test_properties_delete(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_delete.delete_property(FAKE_PROPERTY_ID, transport=transport) diff --git a/samples/properties_firebase_links_create.py b/samples/properties_firebase_links_create.py deleted file mode 100644 index 34ea83a9..00000000 --- a/samples/properties_firebase_links_create.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which creates a Firebase link -for the Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.firebaseLinks/create -for more information. -""" -# [START analyticsadmin_properties_firebase_links_create] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import FirebaseLink - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics account ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with a Firebase project id. - # This project will be linked to the GA4 property. - firebase_project_id = "YOUR-FIREBASE-PROJECT-ID" - - create_firebase_link(property_id, firebase_project_id) - - -def create_firebase_link( - property_id: str, firebase_project_id: str, transport: str = None -): - """ - Creates a Firebase link for the Google Analytics 4 property. - - Args: - property_id(str): The Google Analytics Property ID. - firebase_project_id: Firebase project ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - firebase_link = client.create_firebase_link( - parent=f"properties/{property_id}", - firebase_link=FirebaseLink(project=f"projects/{firebase_project_id}"), - ) - - print("Result:") - print(firebase_link) - - -# [END analyticsadmin_properties_firebase_links_create] - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_firebase_links_create_test.py b/samples/properties_firebase_links_create_test.py deleted file mode 100644 index d19702a4..00000000 --- a/samples/properties_firebase_links_create_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_firebase_links_create - -FAKE_PROPERTY_ID = "1" -FAKE_FIREBASE_PROJECT_ID = "1" - - -def test_properties_firebase_links_create(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_firebase_links_create.create_firebase_link( - FAKE_PROPERTY_ID, FAKE_FIREBASE_PROJECT_ID, transport=transport - ) diff --git a/samples/properties_firebase_links_delete.py b/samples/properties_firebase_links_delete.py deleted file mode 100644 index a6a76f7d..00000000 --- a/samples/properties_firebase_links_delete.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which deletes the Firebase -link from the Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.firebaseLinks/delete -for more information. -""" -# [START analyticsadmin_properties_firebase_links_delete] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your Firebase link ID - # (e.g. "123456") before running the sample. - firebase_link_id = "YOUR-FIREBASE-LINK-ID" - - delete_firebase_link(property_id, firebase_link_id) - - -def delete_firebase_link( - property_id: str, firebase_link_id: str, transport: str = None -): - """ - Deletes the Firebase link. - - Args: - property_id(str): The Google Analytics Property ID. - firebase_link_id: The Firebase link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - client.delete_firebase_link( - name=f"properties/{property_id}/firebaseLinks/{firebase_link_id}" - ) - print("Firebase link deleted") - - -# [END analyticsadmin_properties_firebase_links_delete] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_firebase_links_delete_test.py b/samples/properties_firebase_links_delete_test.py deleted file mode 100644 index c8b1db33..00000000 --- a/samples/properties_firebase_links_delete_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_firebase_links_delete - -FAKE_PROPERTY_ID = "1" -FAKE_FIREBASE_LINK_ID = "1" - - -def test_properties_firebase_links_delete(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_firebase_links_delete.delete_firebase_link( - FAKE_PROPERTY_ID, FAKE_FIREBASE_LINK_ID, transport=transport - ) diff --git a/samples/properties_firebase_links_list.py b/samples/properties_firebase_links_list.py deleted file mode 100644 index 6c27b75e..00000000 --- a/samples/properties_firebase_links_list.py +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints Firebase links -under the specified parent Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.firebaseLinks/list -for more information. -""" -# [START analyticsadmin_properties_firebase_links_list] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - list_firebase_links(property_id) - - -def list_firebase_links(property_id: str, transport: str = None): - """ - Lists Firebase links under the specified parent Google Analytics 4 - property. - - Args: - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - results = client.list_firebase_links(parent=f"properties/{property_id}") - - print("Result:") - for firebase_link in results: - print_firebase_link(firebase_link) - print() - - -def print_firebase_link(firebase_link): - """Prints the Firebase link details.""" - print(f"Resource name: {firebase_link.name}") - print(f"Firebase project: {firebase_link.project}") - print(f"Create time: {firebase_link.create_time}") - - -# [END analyticsadmin_properties_firebase_links_list] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_firebase_links_list_test.py b/samples/properties_firebase_links_list_test.py deleted file mode 100644 index 936bd621..00000000 --- a/samples/properties_firebase_links_list_test.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_firebase_links_list - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") - - -def test_properties_firebase_links_list(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_firebase_links_list.list_firebase_links( - TEST_PROPERTY_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_get.py b/samples/properties_get.py deleted file mode 100644 index ccbee42c..00000000 --- a/samples/properties_get.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which print the Google -Analytics 4 property details. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/get -for more information. -""" -# [START analyticsadmin_properties_get] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import IndustryCategory - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - get_property(property_id) - - -def get_property(property_id: str, transport: str = None): - """ - Retrieves the Google Analytics 4 property details. - - Args: - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - property_ = client.get_property(name=f"properties/{property_id}") - - print("Result:") - print_property(property_) - - -def print_property(property): - """Prints the Google Analytics 4 property details.""" - print(f"Resource name: {property.name}") - print(f"Parent: {property.parent}") - print(f"Display name: {property.display_name}") - print(f"Create time: {property.create_time}") - print(f"Update time: {property.update_time}") - # print(f"Delete time: {property.delete_time}") - # print(f"Expire time: {property.expire_time}") - - if property.industry_category: - print(f"Industry category: {IndustryCategory(property.industry_category).name}") - - print(f"Time zone: {property.time_zone}") - print(f"Currency code: {property.currency_code}") - - -# [END analyticsadmin_properties_get] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_get_test.py b/samples/properties_get_test.py deleted file mode 100644 index db071837..00000000 --- a/samples/properties_get_test.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_get - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") -TEST_USER_LINK_ID = os.getenv("GA_USER_LINK_ID") - - -def test_properties_get(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_get.get_property(TEST_PROPERTY_ID, transport=transport) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_google_ads_links_create.py b/samples/properties_google_ads_links_create.py deleted file mode 100644 index 9abf5755..00000000 --- a/samples/properties_google_ads_links_create.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which creates a Google Ads -link for the Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.googleAdsLinks/create -for more information. -""" -# [START analyticsadmin_properties_google_ads_links_create] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import GoogleAdsLink - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics account ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with a ten-digit Google Ads - # customer ID (digits only, e.g. "1234567890"). - # This Google Ads account will be linked to the GA4 property. - google_ads_customer_id = "YOUR-GOOGLE-ADS-CUSTOMER-ID" - - create_google_ads_link(property_id, google_ads_customer_id) - - -def create_google_ads_link( - property_id: str, google_ads_customer_id: str, transport: str = None -): - """ - Creates a Google Ads link for the Google Analytics 4 property. - - Args: - property_id(str): The Google Analytics Property ID. - google_ads_customer_id(str): The Google Analytics Ads Customer Id. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - google_ads_link = client.create_google_ads_link( - parent=f"properties/{property_id}", - google_ads_link=GoogleAdsLink(customer_id=f"{google_ads_customer_id}"), - ) - - print("Result:") - print(google_ads_link) - - -# [END analyticsadmin_properties_google_ads_links_create] - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_google_ads_links_create_test.py b/samples/properties_google_ads_links_create_test.py deleted file mode 100644 index 1e19e5c6..00000000 --- a/samples/properties_google_ads_links_create_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_google_ads_links_create - -FAKE_PROPERTY_ID = "1" -FAKE_ADS_CUSTOMER_ID = "1234567890" - - -def test_properties_google_ads_links_create(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_google_ads_links_create.create_google_ads_link( - FAKE_PROPERTY_ID, FAKE_ADS_CUSTOMER_ID, transport=transport - ) diff --git a/samples/properties_google_ads_links_delete.py b/samples/properties_google_ads_links_delete.py deleted file mode 100644 index b3451c1e..00000000 --- a/samples/properties_google_ads_links_delete.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application deletes the Google Ads link -from the specified Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.googleAdsLinks/delete -for more information. -""" -# [START analyticsadmin_properties_google_ads_links_delete] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your Google Analytics Ads - # link ID (e.g. "123456") before running the sample. - google_ads_link_id = "YOUR-GOOGLE-ADS-LINK-ID" - - delete_google_ads_link(property_id, google_ads_link_id) - - -def delete_google_ads_link( - property_id: str, google_ads_link_id: str, transport: str = None -): - """ - Deletes the Google Ads link. - - Args: - property_id(str): The Google Analytics Property ID. - google_ads_link_id(str): The Google Analytics Ads Link Id. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - client.delete_google_ads_link( - name=f"properties/{property_id}/googleAdsLinks/{google_ads_link_id}" - ) - print("Google Ads link deleted") - - -# [END analyticsadmin_properties_google_ads_links_delete] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_google_ads_links_delete_test.py b/samples/properties_google_ads_links_delete_test.py deleted file mode 100644 index 527e29b5..00000000 --- a/samples/properties_google_ads_links_delete_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_google_ads_links_delete - -FAKE_PROPERTY_ID = "1" -FAKE_GOOGLE_ADS_LINK_ID = "1" - - -def test_properties_google_ads_links_delete(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_google_ads_links_delete.delete_google_ads_link( - FAKE_PROPERTY_ID, FAKE_GOOGLE_ADS_LINK_ID, transport=transport - ) diff --git a/samples/properties_google_ads_links_list.py b/samples/properties_google_ads_links_list.py deleted file mode 100644 index c23f0417..00000000 --- a/samples/properties_google_ads_links_list.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints Google Ads links -under the specified parent Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.googleAdsLinks/list -for more information. -""" -# [START analyticsadmin_properties_google_ads_links_list] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - list_google_ads_links(property_id) - - -def list_google_ads_links(property_id: str, transport: str = None): - """ - Lists Google Ads links under the specified parent Google Analytics 4 - property. - - Args: - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - results = client.list_google_ads_links(parent=f"properties/{property_id}") - - print("Result:") - for google_ads_link in results: - print_google_ads_link(google_ads_link) - print() - - -def print_google_ads_link(google_ads_link): - """Prints the Google Ads link details.""" - print(f"Resource name: {google_ads_link.name}") - print(f"Google Ads customer ID: {google_ads_link.customer_id}") - print(f"Can manage clients: {google_ads_link.can_manage_clients}") - print(f"Ads personalization enabled: {google_ads_link.ads_personalization_enabled}") - print(f"Email address of the link creator: {google_ads_link.creator_email_address}") - print(f"Create time: {google_ads_link.create_time}") - print(f"Update time: {google_ads_link.update_time}") - - -# [END analyticsadmin_properties_google_ads_links_list] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_google_ads_links_list_test.py b/samples/properties_google_ads_links_list_test.py deleted file mode 100644 index e8252b90..00000000 --- a/samples/properties_google_ads_links_list_test.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_google_ads_links_list - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") - - -def test_properties_google_ads_links_list(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_google_ads_links_list.list_google_ads_links( - TEST_PROPERTY_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_google_ads_links_update.py b/samples/properties_google_ads_links_update.py deleted file mode 100644 index b5e13954..00000000 --- a/samples/properties_google_ads_links_update.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application updates the Google Ads link. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.googleAdsLinks/update -for more information. -""" -# [START analyticsadmin_properties_google_ads_links_update] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import GoogleAdsLink -from google.protobuf.field_mask_pb2 import FieldMask - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your Google Analytics Ads - # link ID (e.g. "123456") before running the sample. - google_ads_link_id = "YOUR-GOOGLE-ADS-LINK-ID" - - update_google_ads_link(property_id, google_ads_link_id) - - -def update_google_ads_link( - property_id: str, google_ads_link_id: str, transport: str = None -): - """ - Updates the Google Ads link. - - Args: - property_id(str): The Google Analytics Property ID. - google_ads_link_id(str): The Google Analytics Ads Link Id. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - # This call updates the adsPersonalizationEnabled setting of the - # Google Ads link as indicated by the value of the `update_mask` field. - # The Google Ads link to update is specified in the `name` field of the - # `Google AdsLink` instance. - google_ads_link = client.update_google_ads_link( - google_ads_link=GoogleAdsLink( - name=f"properties/{property_id}/googleAdsLinks/{google_ads_link_id}", - ads_personalization_enabled=False, - ), - update_mask=FieldMask(paths=["ads_personalization_enabled"]), - ) - - print("Result:") - print(google_ads_link) - - -# [END analyticsadmin_properties_google_ads_links_update] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_google_ads_links_update_test.py b/samples/properties_google_ads_links_update_test.py deleted file mode 100644 index 1cc4b2d5..00000000 --- a/samples/properties_google_ads_links_update_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_google_ads_links_update - -FAKE_PROPERTY_ID = "1" -FAKE_GOOGLE_ADS_LINK_ID = "1" - - -def test_properties_google_ads_links_update(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_google_ads_links_update.update_google_ads_link( - FAKE_PROPERTY_ID, FAKE_GOOGLE_ADS_LINK_ID, transport=transport - ) diff --git a/samples/properties_list.py b/samples/properties_list.py deleted file mode 100644 index e467fbc5..00000000 --- a/samples/properties_list.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints Google Analytics 4 -properties under the specified parent account that are available to the -current user. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/list -for more information. -""" -# [START analyticsadmin_properties_list] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import ListPropertiesRequest - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics - # account ID (e.g. "123456") before running the sample. - account_id = "YOUR-GA-ACCOUNT-ID" - list_properties(account_id) - - -def list_properties(account_id: str, transport: str = None): - """ - Lists Google Analytics 4 properties under the specified parent account - that are available to the current user. - - Args: - account_id(str): The Google Analytics account ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - results = client.list_properties( - ListPropertiesRequest(filter=f"parent:accounts/{account_id}", show_deleted=True) - ) - - print("Result:") - for property_ in results: - print(property_) - print() - - -# [END analyticsadmin_properties_list] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_list_test.py b/samples/properties_list_test.py deleted file mode 100644 index e9f4667f..00000000 --- a/samples/properties_list_test.py +++ /dev/null @@ -1,27 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_list - -TEST_ACCOUNT_ID = os.getenv("GA_TEST_ACCOUNT_ID") - - -def test_properties_get(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_list.list_properties(TEST_ACCOUNT_ID, transport=transport) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_run_access_report.py b/samples/properties_run_access_report.py deleted file mode 100644 index 6cad3fed..00000000 --- a/samples/properties_run_access_report.py +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2022 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which runs an access report -on a property. -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/runAccessReport -for more information. -""" -# [START analyticsadmin_properties_run_access_report] -from datetime import datetime - -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import ( - AccessDateRange, - AccessDimension, - AccessMetric, - RunAccessReportRequest, -) - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - run_access_report(property_id) - - -def run_access_report(property_id: str, transport: str = None): - """ - Runs an access report for a Google Analytics property. The report will - aggregate over dimensions `userEmail`, `accessedPropertyId`, - `propertyUserLink`, `reportType`, `revenueDataReturned`, `costDataReturned`, - `userIP`, and return the access count, as well as the most recent access - time for each combination. - See https://developers.google.com/analytics/devguides/config/admin/v1/access-api-schema - for the description of each field used in a data access report query. - Args: - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - request = RunAccessReportRequest( - entity=f"properties/{property_id}", - dimensions=[ - AccessDimension(dimension_name="userEmail"), - AccessDimension(dimension_name="accessedPropertyId"), - AccessDimension(dimension_name="propertyUserLink"), - AccessDimension(dimension_name="reportType"), - AccessDimension(dimension_name="revenueDataReturned"), - AccessDimension(dimension_name="costDataReturned"), - AccessDimension(dimension_name="userIP"), - AccessDimension(dimension_name="mostRecentAccessEpochTimeMicros"), - ], - metrics=[AccessMetric(metric_name="accessCount")], - date_ranges=[AccessDateRange(start_date="yesterday", end_date="today")], - ) - - access_report = client.run_access_report(request) - - print("Result:") - print_access_report(access_report) - - -def print_access_report(response): - """Prints the access report.""" - print(f"{response.row_count} rows received") - for dimensionHeader in response.dimension_headers: - print(f"Dimension header name: {dimensionHeader.dimension_name}") - for metricHeader in response.metric_headers: - print(f"Metric header name: {metricHeader.metric_name})") - - for rowIdx, row in enumerate(response.rows): - print(f"\nRow {rowIdx}") - for i, dimension_value in enumerate(row.dimension_values): - dimension_name = response.dimension_headers[i].dimension_name - if dimension_name.endswith("Micros"): - # Convert microseconds since Unix Epoch to datetime object. - dimension_value_formatted = datetime.utcfromtimestamp( - int(dimension_value.value) / 1000000 - ) - else: - dimension_value_formatted = dimension_value.value - print(f"{dimension_name}: {dimension_value_formatted}") - - for i, metric_value in enumerate(row.metric_values): - metric_name = response.metric_headers[i].metric_name - print(f"{metric_name}: {metric_value.value}") - - -# [END analyticsadmin_properties_run_access_report] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_run_access_report_test.py b/samples/properties_run_access_report_test.py deleted file mode 100644 index a7d3c8d7..00000000 --- a/samples/properties_run_access_report_test.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright 2022 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import pytest - -import properties_run_access_report - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") - - -def test_properties_run_access_report(capsys): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises( - Exception, - match="Access record reports are only allowed on Google Analytics 360 properties.", - ): - properties_run_access_report.run_access_report( - TEST_PROPERTY_ID, transport=transport - ) diff --git a/samples/properties_update.py b/samples/properties_update.py deleted file mode 100644 index e6c32649..00000000 --- a/samples/properties_update.py +++ /dev/null @@ -1,74 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties/update -for more information. -""" -# [START analyticsadmin_properties_update] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import Property -from google.protobuf.field_mask_pb2 import FieldMask - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - update_property(property_id) - - -def update_property(property_id: str, transport: str = None): - """ - Updates the Google Analytics 4 property. - - Args: - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - # This call updates the display name, industry category and time zone of the - # property, as indicated by the value of the `update_mask` field. - # The property to update is specified in the `name` field of the `Property` - # instance. - property_ = client.update_property( - property=Property( - name=f"properties/{property_id}", - display_name="This is an updated test property", - industry_category="GAMES", - time_zone="America/New_York", - ), - update_mask=FieldMask(paths=["display_name", "time_zone", "industry_category"]), - ) - - print("Result:") - print(property_) - - -# [END analyticsadmin_properties_update] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_update_test.py b/samples/properties_update_test.py deleted file mode 100644 index b55e5d4d..00000000 --- a/samples/properties_update_test.py +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_update - -FAKE_PROPERTY_ID = "1" - - -def test_properties_update(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_update.update_property(FAKE_PROPERTY_ID, transport=transport) diff --git a/samples/properties_user_links_audit.py b/samples/properties_user_links_audit.py deleted file mode 100644 index e02b9ba1..00000000 --- a/samples/properties_user_links_audit.py +++ /dev/null @@ -1,68 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints user links audit -data on the Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/audit -for more information. -""" -# [START analyticsadmin_properties_user_links_audit] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import AuditUserLinksRequest - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - audit_property_user_links(property_id) - - -def audit_property_user_links(property_id: str, transport: str = None): - """ - Lists all user links on the Google Analytics 4 property, including - implicit ones that come from effective permissions granted by groups or - organization admin roles. - - Args: - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - results = client.audit_user_links( - AuditUserLinksRequest(parent=f"properties/{property_id}") - ) - - print("Result:") - for user_link in results: - print(f"Resource name: {user_link.name}") - print(f"Email address: {user_link.email_address}") - for direct_role in user_link.direct_roles: - print(f"Direct role: {direct_role}") - - for effective_role in user_link.effective_roles: - print(f"Effective role: {effective_role}") - print() - - -# [END analyticsadmin_properties_user_links_audit] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_user_links_audit_test.py b/samples/properties_user_links_audit_test.py deleted file mode 100644 index 5236cdb3..00000000 --- a/samples/properties_user_links_audit_test.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_user_links_audit - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") - - -def test_properties_user_links_audit(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_user_links_audit.audit_property_user_links( - TEST_PROPERTY_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_user_links_batch_create.py b/samples/properties_user_links_batch_create.py deleted file mode 100644 index 5ee4cc10..00000000 --- a/samples/properties_user_links_batch_create.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which creates a user link for -the Google Analytics 4 property using a batch call. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/batchCreate -for more information. -""" -# [START analyticsadmin_properties_user_links_batch_create] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import ( - BatchCreateUserLinksRequest, - CreateUserLinkRequest, - UserLink, -) - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics account ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with an email address of the user to - # link. This user will be given access to your account after running the - # sample. - email_address = "TEST-EMAIL-ADDRESS" - - batch_create_property_user_link(property_id, email_address) - - -def batch_create_property_user_link( - property_id: str, email_address: str, transport: str = None -): - """ - Creates a user link for the Google Analytics 4 property using a batch - call. - - Args: - property_id(str): The Google Analytics Property ID. - email_address(str): Email address of the user to link. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - response = client.batch_create_user_links( - BatchCreateUserLinksRequest( - parent=f"properties/{property_id}", - requests=[ - CreateUserLinkRequest( - user_link=UserLink( - email_address=email_address, - direct_roles=["predefinedRoles/read"], - ) - ) - ], - notify_new_users=True, - ) - ) - - print("Result:") - for user_link in response.user_links: - print(user_link) - print() - - -# [END analyticsadmin_properties_user_links_batch_create] - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_user_links_batch_create_test.py b/samples/properties_user_links_batch_create_test.py deleted file mode 100644 index b463cbb1..00000000 --- a/samples/properties_user_links_batch_create_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_user_links_batch_create - -FAKE_PROPERTY_ID = "1" -FAKE_EMAIL_ADDRESS = "test@google.com" - - -def test_properties_user_links_batch_create(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_user_links_batch_create.batch_create_property_user_link( - FAKE_PROPERTY_ID, FAKE_EMAIL_ADDRESS, transport=transport - ) diff --git a/samples/properties_user_links_batch_delete.py b/samples/properties_user_links_batch_delete.py deleted file mode 100644 index 3e277cd2..00000000 --- a/samples/properties_user_links_batch_delete.py +++ /dev/null @@ -1,80 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which delete the user link for -the Google Analytics 4 property using a batch call. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/batchDelete -for more information. -""" -# [START analyticsadmin_properties_user_links_batch_delete] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import ( - BatchDeleteUserLinksRequest, - DeleteUserLinkRequest, -) - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your Google Analytics - # account user link ID (e.g. "123456") before running the sample. - property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID" - - batch_delete_property_user_link(property_id, property_user_link_id) - - -def batch_delete_property_user_link( - property_id: str, property_user_link_id: str, transport: str = None -): - """ - Deletes the GA4 property user link using a batch call. - - Args: - property_id(str): The Google Analytics Property ID. - property_user_link_id(str): Google Analytics account user link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - client.batch_delete_user_links( - BatchDeleteUserLinksRequest( - parent=f"properties/{property_id}", - requests=[ - DeleteUserLinkRequest( - name=f"properties/{property_id}/userLinks/{property_user_link_id}" - ) - ], - ) - ) - print("User link deleted") - - -# [END analyticsadmin_properties_user_links_batch_delete] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_user_links_batch_delete_test.py b/samples/properties_user_links_batch_delete_test.py deleted file mode 100644 index 5aee6f44..00000000 --- a/samples/properties_user_links_batch_delete_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_user_links_batch_delete - -FAKE_PROPERTY_ID = "1" -FAKE_USER_LINK_ID = "1" - - -def test_properties_user_links_batch_delete(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_user_links_batch_delete.batch_delete_property_user_link( - FAKE_PROPERTY_ID, FAKE_USER_LINK_ID, transport=transport - ) diff --git a/samples/properties_user_links_batch_get.py b/samples/properties_user_links_batch_get.py deleted file mode 100644 index 5c40e7e4..00000000 --- a/samples/properties_user_links_batch_get.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints details for the -Google Analytics 4 property user link using a batch call. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/batchGet -for more information. -""" -# [START analyticsadmin_properties_user_links_batch_get] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import BatchGetUserLinksRequest - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your Google Analytics - # account user link ID (e.g. "123456") before running the sample. - property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID" - - batch_get_property_user_link(property_id, property_user_link_id) - - -def batch_get_property_user_link( - property_id: str, property_user_link_id: str, transport: str = None -): - """ - Retrieves details for the Google Analytics 4 property user link using a - batch call. - - Args: - property_id(str): The Google Analytics Property ID. - property_user_link_id(str): Google Analytics account user link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - response = client.batch_get_user_links( - BatchGetUserLinksRequest( - parent=f"properties/{property_id}", - names=[f"properties/{property_id}/userLinks/{property_user_link_id}"], - ) - ) - - print("Result:") - for user_link in response.user_links: - print(user_link) - print() - - -# [END analyticsadmin_properties_user_links_batch_get] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_user_links_batch_get_test.py b/samples/properties_user_links_batch_get_test.py deleted file mode 100644 index 9fb31a44..00000000 --- a/samples/properties_user_links_batch_get_test.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_user_links_batch_get - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") -TEST_USER_LINK_ID = os.getenv("GA_TEST_PROPERTY_USER_LINK_ID") - - -def test_properties_user_links_batch_get(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_user_links_batch_get.batch_get_property_user_link( - TEST_PROPERTY_ID, TEST_USER_LINK_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_user_links_batch_update.py b/samples/properties_user_links_batch_update.py deleted file mode 100644 index c1a4d2e7..00000000 --- a/samples/properties_user_links_batch_update.py +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which updates the Google -Analytics 4 property user link using a batch call. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/batchUpdate -for more information. -""" -# [START analyticsadmin_properties_user_links_batch_update] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import ( - BatchUpdateUserLinksRequest, - UpdateUserLinkRequest, - UserLink, -) - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your Google Analytics - # account user link ID (e.g. "123456") before running the sample. - property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID" - - batch_update_property_user_link(property_id, property_user_link_id) - - -def batch_update_property_user_link( - property_id: str, property_user_link_id: str, transport: str = None -): - """ - Updates the Google Analytics 4 property user link using a batch call. - - Args: - property_id(str): The Google Analytics Property ID. - property_user_link_id(str): Google Analytics account user link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - # This call updates the email address and direct roles of the user link. - # The user link to update is specified in the `name` field of the `UserLink` - # instance. - response = client.batch_update_user_links( - BatchUpdateUserLinksRequest( - parent=f"properties/{property_id}", - requests=[ - UpdateUserLinkRequest( - user_link=UserLink( - name=f"properties/{property_id}/userLinks/{property_user_link_id}", - direct_roles=["predefinedRoles/collaborate"], - ), - ) - ], - ) - ) - - print("Result:") - for user_link in response.user_links: - print(user_link) - print() - - -# [END analyticsadmin_properties_user_links_batch_update] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_user_links_batch_update_test.py b/samples/properties_user_links_batch_update_test.py deleted file mode 100644 index 08b64b7f..00000000 --- a/samples/properties_user_links_batch_update_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_user_links_batch_update - -FAKE_PROPERTY_ID = "1" -FAKE_USER_LINK_ID = "1" - - -def test_properties_user_links_batch_update(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_user_links_batch_update.batch_update_property_user_link( - FAKE_PROPERTY_ID, FAKE_USER_LINK_ID, transport=transport - ) diff --git a/samples/properties_user_links_create.py b/samples/properties_user_links_create.py deleted file mode 100644 index 24627b6d..00000000 --- a/samples/properties_user_links_create.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which creates a user link for -the Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/create -for more information. -""" -# [START analyticsadmin_properties_user_links_create] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import CreateUserLinkRequest, UserLink - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics account ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with an email address of the user to - # link. This user will be given access to your account after running the - # sample. - email_address = "TEST-EMAIL-ADDRESS" - - create_property_user_link(property_id, email_address) - - -def create_property_user_link( - property_id: str, email_address: str, transport: str = None -): - """ - Creates a user link for the Google Analytics 4 property. - - Args: - property_id(str): The Google Analytics Property ID. - email_address(str): Email address of the user to link. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - user_link = client.create_user_link( - CreateUserLinkRequest( - parent=f"properties/{property_id}", - user_link=UserLink( - email_address=email_address, direct_roles=["predefinedRoles/read"] - ), - notify_new_user=True, - ) - ) - - print("Result:") - print(user_link) - - -# [END analyticsadmin_properties_user_links_create] - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_user_links_create_test.py b/samples/properties_user_links_create_test.py deleted file mode 100644 index 3f79d85d..00000000 --- a/samples/properties_user_links_create_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_user_links_create - -FAKE_PROPERTY_ID = "1" -FAKE_EMAIL_ADDRESS = "test@google.com" - - -def test_properties_user_links_create(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_user_links_create.create_property_user_link( - FAKE_PROPERTY_ID, FAKE_EMAIL_ADDRESS, transport=transport - ) diff --git a/samples/properties_user_links_delete.py b/samples/properties_user_links_delete.py deleted file mode 100644 index b70b75c5..00000000 --- a/samples/properties_user_links_delete.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which deletes the user link -from the Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/delete -for more information. -""" -# [START analyticsadmin_properties_user_links_delete] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import DeleteUserLinkRequest - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your Google Analytics - # account user link ID (e.g. "123456") before running the sample. - property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID" - - delete_property_user_link(property_id, property_user_link_id) - - -def delete_property_user_link( - property_id: str, property_user_link_id: str, transport: str = None -): - """ - Deletes the user link from the Google Analytics 4 property. - - Args: - property_id(str): The Google Analytics Property ID. - property_user_link_id(str): Google Analytics account user link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - client.delete_user_link( - DeleteUserLinkRequest( - name=f"properties/{property_id}/userLinks/{property_user_link_id}" - ) - ) - print("User link deleted") - - -# [END analyticsadmin_properties_user_links_delete] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_user_links_delete_test.py b/samples/properties_user_links_delete_test.py deleted file mode 100644 index c5f4dd67..00000000 --- a/samples/properties_user_links_delete_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_user_links_delete - -FAKE_PROPERTY_ID = "1" -FAKE_USER_LINK_ID = "1" - - -def test_properties_user_links_delete(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_user_links_delete.delete_property_user_link( - FAKE_PROPERTY_ID, FAKE_USER_LINK_ID, transport=transport - ) diff --git a/samples/properties_user_links_get.py b/samples/properties_user_links_get.py deleted file mode 100644 index 9aa97e5f..00000000 --- a/samples/properties_user_links_get.py +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints the Google -Analytics 4 property user link details. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/get -for more information. -""" -# [START analyticsadmin_properties_user_links_get] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your Google Analytics - # account user link ID (e.g. "123456") before running the sample. - property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID" - - get_property_user_link(property_id, property_user_link_id) - - -def get_property_user_link( - property_id: str, property_user_link_id: str, transport: str = None -): - """ - Retrieves the Google Analytics 4 property user link details. - - Args: - property_id(str): The Google Analytics Property ID. - property_user_link_id(str): Google Analytics account user link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - user_link = client.get_user_link( - name=f"properties/{property_id}/userLinks/{property_user_link_id}" - ) - - print("Result:") - print_user_link(user_link) - - -def print_user_link(user_link): - """Prints the user link details.""" - print(f"Resource name: {user_link.name}") - print(f"Email address: {user_link.email_address}") - for direct_role in user_link.direct_roles: - print(f"Direct role: {direct_role}") - - -# [END analyticsadmin_properties_user_links_get] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_user_links_get_test.py b/samples/properties_user_links_get_test.py deleted file mode 100644 index b05b19f3..00000000 --- a/samples/properties_user_links_get_test.py +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_user_links_get - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") -TEST_USER_LINK_ID = os.getenv("GA_TEST_PROPERTY_USER_LINK_ID") - - -def test_properties_user_links_get(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_user_links_get.get_property_user_link( - TEST_PROPERTY_ID, TEST_USER_LINK_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_user_links_list.py b/samples/properties_user_links_list.py deleted file mode 100644 index ef6e8770..00000000 --- a/samples/properties_user_links_list.py +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which prints user links under -the specified parent Google Analytics 4 property. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/list -for more information. -""" -# [START analyticsadmin_properties_user_links_list] -from google.analytics.admin import AnalyticsAdminServiceClient - - -def run_sample(): - """Runs the sample.""" - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - list_property_user_links(property_id) - - -def list_property_user_links(property_id: str, transport: str = None): - """ - Lists user links under the specified parent Google Analytics 4 - property. - - Args: - property_id(str): The Google Analytics Property ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - results = client.list_user_links(parent=f"properties/{property_id}") - - print("Result:") - for user_link in results: - print(user_link) - print() - - -# [END analyticsadmin_properties_user_links_list] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_user_links_list_test.py b/samples/properties_user_links_list_test.py deleted file mode 100644 index a47d7122..00000000 --- a/samples/properties_user_links_list_test.py +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import os - -import properties_user_links_list - -TEST_PROPERTY_ID = os.getenv("GA_TEST_PROPERTY_ID") - - -def test_properties_user_links_list(capsys): - transports = ["grpc", "rest"] - for transport in transports: - properties_user_links_list.list_property_user_links( - TEST_PROPERTY_ID, transport=transport - ) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/properties_user_links_update.py b/samples/properties_user_links_update.py deleted file mode 100644 index f20b04f8..00000000 --- a/samples/properties_user_links_update.py +++ /dev/null @@ -1,78 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample application which updates the Google -Analytics 4 property user link. - -See https://developers.google.com/analytics/devguides/config/admin/v1/rest/v1alpha/properties.userLinks/update -for more information. -""" -# [START analyticsadmin_properties_user_links_update] -from google.analytics.admin import AnalyticsAdminServiceClient -from google.analytics.admin_v1alpha.types import UserLink - - -def run_sample(): - """Runs the sample.""" - - # !!! ATTENTION !!! - # Running this sample may change/delete your Google Analytics account - # configuration. Make sure to not use the Google Analytics property ID from - # your production environment below. - - # TODO(developer): Replace this variable with your Google Analytics 4 - # property ID (e.g. "123456") before running the sample. - property_id = "YOUR-GA4-PROPERTY-ID" - - # TODO(developer): Replace this variable with your Google Analytics - # account user link ID (e.g. "123456") before running the sample. - property_user_link_id = "YOUR-ACCOUNT-USER-LINK-ID" - - update_property_user_link(property_id, property_user_link_id) - - -def update_property_user_link( - property_id: str, property_user_link_id: str, transport: str = None -): - """ - Updates the Google Analytics 4 property user link. - - Args: - property_id(str): The Google Analytics Property ID. - property_user_link_id(str): Google Analytics account user link ID. - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - client = AnalyticsAdminServiceClient(transport=transport) - # This call updates the email address and direct roles of the user link. - # The user link to update is specified in the `name` field of the `UserLink` - # instance. - user_link = client.update_user_link( - user_link=UserLink( - name=f"properties/{property_id}/userLinks/{property_user_link_id}", - direct_roles=["predefinedRoles/collaborate"], - ), - ) - - print("Result:") - print(user_link) - - -# [END analyticsadmin_properties_user_links_update] - - -if __name__ == "__main__": - run_sample() diff --git a/samples/properties_user_links_update_test.py b/samples/properties_user_links_update_test.py deleted file mode 100644 index bd471b78..00000000 --- a/samples/properties_user_links_update_test.py +++ /dev/null @@ -1,31 +0,0 @@ -# Copyright 2021 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import pytest - -import properties_user_links_update - -FAKE_PROPERTY_ID = "1" -FAKE_USER_LINK_ID = "1" - - -def test_properties_user_links_update(): - transports = ["grpc", "rest"] - for transport in transports: - # This test ensures that the call is valid and reaches the server, even - # though the operation does not succeed due to permission error. - with pytest.raises(Exception, match="The caller does not have permission"): - properties_user_links_update.update_property_user_link( - FAKE_PROPERTY_ID, FAKE_USER_LINK_ID, transport=transport - ) diff --git a/samples/quickstart.py b/samples/quickstart.py deleted file mode 100644 index 8cdca97c..00000000 --- a/samples/quickstart.py +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env python - -# Copyright 2020 Google Inc. All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -"""Google Analytics Admin API sample quickstart application. -Example usage: - python quickstart.py - -This application demonstrates the usage of the Analytics Admin API using -service account credentials. For more information on service accounts, see - -https://cloud.google.com/iam/docs/understanding-service-accounts - -The following document provides instructions on setting service account -credentials for your application: - - https://cloud.google.com/docs/authentication/production - -In a nutshell, you need to: -1. Create a service account and download the key JSON file. - -https://cloud.google.com/docs/authentication/production#creating_a_service_account - -2. Provide service account credentials using one of the following options: -- set the GOOGLE_APPLICATION_CREDENTIALS environment variable, the API -client will use the value of this variable to find the service account key -JSON file. - -https://cloud.google.com/docs/authentication/production#setting_the_environment_variable - -OR -- manually pass the path to the service account key JSON file to the API client -by specifying the keyFilename parameter in the constructor: -https://cloud.google.com/docs/authentication/production#passing_the_path_to_the_service_account_key_in_code - -To install the latest published package dependency, execute the following: - pip install google-analytics-admin -""" - - -# [START ga_admin_list_accounts] -def list_accounts(transport: str = None): - """ - Lists the available Google Analytics accounts. - - Args: - transport(str): The transport to use. For example, "grpc" - or "rest". If set to None, a transport is chosen automatically. - """ - from google.analytics.admin import AnalyticsAdminServiceClient - - # Using a default constructor instructs the client to use the credentials - # specified in GOOGLE_APPLICATION_CREDENTIALS environment variable. - client = AnalyticsAdminServiceClient(transport=transport) - - results = client.list_accounts() - - # Displays the configuration information for all Google Analytics accounts - # available to the authenticated user. - print("Result:") - for account in results: - print(account) - - -# [END ga_admin_list_accounts] - - -if __name__ == "__main__": - list_accounts() diff --git a/samples/quickstart_test.py b/samples/quickstart_test.py deleted file mode 100644 index 0b703c28..00000000 --- a/samples/quickstart_test.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2022 Google LLC All Rights Reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import quickstart - - -def test_accounts_list(capsys): - transports = ["grpc", "rest"] - for transport in transports: - quickstart.list_accounts(transport=transport) - out, _ = capsys.readouterr() - assert "Result" in out diff --git a/samples/requirements-test.txt b/samples/requirements-test.txt deleted file mode 100644 index bd5fef9b..00000000 --- a/samples/requirements-test.txt +++ /dev/null @@ -1 +0,0 @@ -pytest==7.4.1 \ No newline at end of file diff --git a/samples/requirements.txt b/samples/requirements.txt deleted file mode 100644 index ae0fc999..00000000 --- a/samples/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -google-analytics-admin==0.20.0 -google-auth-oauthlib==1.0.0 \ No newline at end of file diff --git a/scripts/fixup_admin_v1alpha_keywords.py b/scripts/fixup_admin_v1alpha_keywords.py index 6a86c632..992fcdbe 100644 --- a/scripts/fixup_admin_v1alpha_keywords.py +++ b/scripts/fixup_admin_v1alpha_keywords.py @@ -44,15 +44,10 @@ class adminCallTransformer(cst.CSTTransformer): 'archive_audience': ('name', ), 'archive_custom_dimension': ('name', ), 'archive_custom_metric': ('name', ), - 'audit_user_links': ('parent', 'page_size', 'page_token', ), 'batch_create_access_bindings': ('parent', 'requests', ), - 'batch_create_user_links': ('parent', 'requests', 'notify_new_users', ), 'batch_delete_access_bindings': ('parent', 'requests', ), - 'batch_delete_user_links': ('parent', 'requests', ), 'batch_get_access_bindings': ('parent', 'names', ), - 'batch_get_user_links': ('parent', 'names', ), 'batch_update_access_bindings': ('parent', 'requests', ), - 'batch_update_user_links': ('parent', 'requests', ), 'cancel_display_video360_advertiser_link_proposal': ('name', ), 'create_access_binding': ('parent', 'access_binding', ), 'create_ad_sense_link': ('parent', 'adsense_link', ), @@ -71,9 +66,12 @@ class adminCallTransformer(cst.CSTTransformer): 'create_google_ads_link': ('parent', 'google_ads_link', ), 'create_measurement_protocol_secret': ('parent', 'measurement_protocol_secret', ), 'create_property': ('property', ), + 'create_rollup_property': ('rollup_property', 'source_properties', ), + 'create_rollup_property_source_link': ('parent', 'rollup_property_source_link', ), 'create_search_ads360_link': ('parent', 'search_ads_360_link', ), 'create_sk_ad_network_conversion_value_schema': ('parent', 'skadnetwork_conversion_value_schema', ), - 'create_user_link': ('parent', 'user_link', 'notify_new_user', ), + 'create_subproperty': ('parent', 'subproperty', 'subproperty_event_filter', ), + 'create_subproperty_event_filter': ('parent', 'subproperty_event_filter', ), 'delete_access_binding': ('name', ), 'delete_account': ('name', ), 'delete_ad_sense_link': ('name', ), @@ -89,9 +87,10 @@ class adminCallTransformer(cst.CSTTransformer): 'delete_google_ads_link': ('name', ), 'delete_measurement_protocol_secret': ('name', ), 'delete_property': ('name', ), + 'delete_rollup_property_source_link': ('name', ), 'delete_search_ads360_link': ('name', ), 'delete_sk_ad_network_conversion_value_schema': ('name', ), - 'delete_user_link': ('name', ), + 'delete_subproperty_event_filter': ('name', ), 'fetch_automated_ga4_configuration_opt_out': ('property', ), 'fetch_connected_ga4_property': ('property', ), 'get_access_binding': ('name', ), @@ -104,6 +103,7 @@ class adminCallTransformer(cst.CSTTransformer): 'get_conversion_event': ('name', ), 'get_custom_dimension': ('name', ), 'get_custom_metric': ('name', ), + 'get_data_redaction_settings': ('name', ), 'get_data_retention_settings': ('name', ), 'get_data_sharing_settings': ('name', ), 'get_data_stream': ('name', ), @@ -116,9 +116,9 @@ class adminCallTransformer(cst.CSTTransformer): 'get_google_signals_settings': ('name', ), 'get_measurement_protocol_secret': ('name', ), 'get_property': ('name', ), + 'get_rollup_property_source_link': ('name', ), 'get_search_ads360_link': ('name', ), 'get_sk_ad_network_conversion_value_schema': ('name', ), - 'get_user_link': ('name', ), 'list_access_bindings': ('parent', 'page_size', 'page_token', ), 'list_accounts': ('page_size', 'page_token', 'show_deleted', ), 'list_account_summaries': ('page_size', 'page_token', ), @@ -139,11 +139,11 @@ class adminCallTransformer(cst.CSTTransformer): 'list_google_ads_links': ('parent', 'page_size', 'page_token', ), 'list_measurement_protocol_secrets': ('parent', 'page_size', 'page_token', ), 'list_properties': ('filter', 'page_size', 'page_token', 'show_deleted', ), + 'list_rollup_property_source_links': ('parent', 'page_size', 'page_token', ), 'list_search_ads360_links': ('parent', 'page_size', 'page_token', ), 'list_sk_ad_network_conversion_value_schemas': ('parent', 'page_size', 'page_token', ), - 'list_user_links': ('parent', 'page_size', 'page_token', ), 'provision_account_ticket': ('account', 'redirect_uri', ), - 'run_access_report': ('entity', 'dimensions', 'metrics', 'date_ranges', 'dimension_filter', 'metric_filter', 'offset', 'limit', 'time_zone', 'order_bys', 'return_entity_quota', ), + 'run_access_report': ('entity', 'dimensions', 'metrics', 'date_ranges', 'dimension_filter', 'metric_filter', 'offset', 'limit', 'time_zone', 'order_bys', 'return_entity_quota', 'include_all_users', 'expand_groups', ), 'search_change_history_events': ('account', 'property', 'resource_type', 'action', 'actor_email', 'earliest_change_time', 'latest_change_time', 'page_size', 'page_token', ), 'set_automated_ga4_configuration_opt_out': ('property', 'opt_out', ), 'update_access_binding': ('access_binding', ), @@ -154,6 +154,7 @@ class adminCallTransformer(cst.CSTTransformer): 'update_conversion_event': ('conversion_event', 'update_mask', ), 'update_custom_dimension': ('update_mask', 'custom_dimension', ), 'update_custom_metric': ('update_mask', 'custom_metric', ), + 'update_data_redaction_settings': ('data_redaction_settings', 'update_mask', ), 'update_data_retention_settings': ('data_retention_settings', 'update_mask', ), 'update_data_stream': ('update_mask', 'data_stream', ), 'update_display_video360_advertiser_link': ('update_mask', 'display_video_360_advertiser_link', ), @@ -166,7 +167,6 @@ class adminCallTransformer(cst.CSTTransformer): 'update_property': ('property', 'update_mask', ), 'update_search_ads360_link': ('update_mask', 'search_ads_360_link', ), 'update_sk_ad_network_conversion_value_schema': ('skadnetwork_conversion_value_schema', 'update_mask', ), - 'update_user_link': ('user_link', ), } def leave_Call(self, original: cst.Call, updated: cst.Call) -> cst.CSTNode: diff --git a/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py b/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py index caf06160..e88572ff 100644 --- a/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py +++ b/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py @@ -56,6 +56,9 @@ from google.analytics.admin_v1alpha.types import ( expanded_data_set as gaa_expanded_data_set, ) +from google.analytics.admin_v1alpha.types import ( + subproperty_event_filter as gaa_subproperty_event_filter, +) from google.analytics.admin_v1alpha.types import access_report, analytics_admin from google.analytics.admin_v1alpha.types import audience from google.analytics.admin_v1alpha.types import audience as gaa_audience @@ -63,6 +66,7 @@ from google.analytics.admin_v1alpha.types import event_create_and_edit from google.analytics.admin_v1alpha.types import expanded_data_set from google.analytics.admin_v1alpha.types import resources +from google.analytics.admin_v1alpha.types import subproperty_event_filter def client_cert_source_callback(): @@ -3410,11 +3414,11 @@ async def test_update_property_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetUserLinkRequest, + analytics_admin.CreateFirebaseLinkRequest, dict, ], ) -def test_get_user_link(request_type, transport: str = "grpc"): +def test_create_firebase_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -3425,28 +3429,28 @@ def test_get_user_link(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.create_firebase_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.UserLink( + call.return_value = resources.FirebaseLink( name="name_value", - email_address="email_address_value", - direct_roles=["direct_roles_value"], + project="project_value", ) - response = client.get_user_link(request) + response = client.create_firebase_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetUserLinkRequest() + assert args[0] == analytics_admin.CreateFirebaseLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.UserLink) + assert isinstance(response, resources.FirebaseLink) assert response.name == "name_value" - assert response.email_address == "email_address_value" - assert response.direct_roles == ["direct_roles_value"] + assert response.project == "project_value" -def test_get_user_link_empty_call(): +def test_create_firebase_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -3455,16 +3459,19 @@ def test_get_user_link_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_user_link), "__call__") as call: - client.get_user_link() + with mock.patch.object( + type(client.transport.create_firebase_link), "__call__" + ) as call: + client.create_firebase_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetUserLinkRequest() + assert args[0] == analytics_admin.CreateFirebaseLinkRequest() @pytest.mark.asyncio -async def test_get_user_link_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetUserLinkRequest +async def test_create_firebase_link_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.CreateFirebaseLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3476,49 +3483,51 @@ async def test_get_user_link_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.create_firebase_link), "__call__" + ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.UserLink( + resources.FirebaseLink( name="name_value", - email_address="email_address_value", - direct_roles=["direct_roles_value"], + project="project_value", ) ) - response = await client.get_user_link(request) + response = await client.create_firebase_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetUserLinkRequest() + assert args[0] == analytics_admin.CreateFirebaseLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.UserLink) + assert isinstance(response, resources.FirebaseLink) assert response.name == "name_value" - assert response.email_address == "email_address_value" - assert response.direct_roles == ["direct_roles_value"] + assert response.project == "project_value" @pytest.mark.asyncio -async def test_get_user_link_async_from_dict(): - await test_get_user_link_async(request_type=dict) +async def test_create_firebase_link_async_from_dict(): + await test_create_firebase_link_async(request_type=dict) -def test_get_user_link_field_headers(): +def test_create_firebase_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetUserLinkRequest() + request = analytics_admin.CreateFirebaseLinkRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_user_link), "__call__") as call: - call.return_value = resources.UserLink() - client.get_user_link(request) + with mock.patch.object( + type(client.transport.create_firebase_link), "__call__" + ) as call: + call.return_value = resources.FirebaseLink() + client.create_firebase_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -3529,26 +3538,30 @@ def test_get_user_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_user_link_field_headers_async(): +async def test_create_firebase_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetUserLinkRequest() + request = analytics_admin.CreateFirebaseLinkRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_user_link), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.UserLink()) - await client.get_user_link(request) + with mock.patch.object( + type(client.transport.create_firebase_link), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.FirebaseLink() + ) + await client.create_firebase_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -3559,35 +3572,41 @@ async def test_get_user_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_user_link_flattened(): +def test_create_firebase_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.create_firebase_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.UserLink() + call.return_value = resources.FirebaseLink() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_user_link( - name="name_value", + client.create_firebase_link( + parent="parent_value", + firebase_link=resources.FirebaseLink(name="name_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].firebase_link + mock_val = resources.FirebaseLink(name="name_value") assert arg == mock_val -def test_get_user_link_flattened_error(): +def test_create_firebase_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -3595,41 +3614,50 @@ def test_get_user_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_user_link( - analytics_admin.GetUserLinkRequest(), - name="name_value", + client.create_firebase_link( + analytics_admin.CreateFirebaseLinkRequest(), + parent="parent_value", + firebase_link=resources.FirebaseLink(name="name_value"), ) @pytest.mark.asyncio -async def test_get_user_link_flattened_async(): +async def test_create_firebase_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.create_firebase_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.UserLink() + call.return_value = resources.FirebaseLink() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.UserLink()) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.FirebaseLink() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_user_link( - name="name_value", + response = await client.create_firebase_link( + parent="parent_value", + firebase_link=resources.FirebaseLink(name="name_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].firebase_link + mock_val = resources.FirebaseLink(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_get_user_link_flattened_error_async(): +async def test_create_firebase_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -3637,20 +3665,21 @@ async def test_get_user_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_user_link( - analytics_admin.GetUserLinkRequest(), - name="name_value", + await client.create_firebase_link( + analytics_admin.CreateFirebaseLinkRequest(), + parent="parent_value", + firebase_link=resources.FirebaseLink(name="name_value"), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchGetUserLinksRequest, + analytics_admin.DeleteFirebaseLinkRequest, dict, ], ) -def test_batch_get_user_links(request_type, transport: str = "grpc"): +def test_delete_firebase_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -3662,22 +3691,22 @@ def test_batch_get_user_links(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_get_user_links), "__call__" + type(client.transport.delete_firebase_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.BatchGetUserLinksResponse() - response = client.batch_get_user_links(request) + call.return_value = None + response = client.delete_firebase_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchGetUserLinksRequest() + assert args[0] == analytics_admin.DeleteFirebaseLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchGetUserLinksResponse) + assert response is None -def test_batch_get_user_links_empty_call(): +def test_delete_firebase_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -3687,18 +3716,18 @@ def test_batch_get_user_links_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_get_user_links), "__call__" + type(client.transport.delete_firebase_link), "__call__" ) as call: - client.batch_get_user_links() + client.delete_firebase_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchGetUserLinksRequest() + assert args[0] == analytics_admin.DeleteFirebaseLinkRequest() @pytest.mark.asyncio -async def test_batch_get_user_links_async( +async def test_delete_firebase_link_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.BatchGetUserLinksRequest, + request_type=analytics_admin.DeleteFirebaseLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3711,45 +3740,43 @@ async def test_batch_get_user_links_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_get_user_links), "__call__" + type(client.transport.delete_firebase_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.BatchGetUserLinksResponse() - ) - response = await client.batch_get_user_links(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_firebase_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchGetUserLinksRequest() + assert args[0] == analytics_admin.DeleteFirebaseLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchGetUserLinksResponse) + assert response is None @pytest.mark.asyncio -async def test_batch_get_user_links_async_from_dict(): - await test_batch_get_user_links_async(request_type=dict) +async def test_delete_firebase_link_async_from_dict(): + await test_delete_firebase_link_async(request_type=dict) -def test_batch_get_user_links_field_headers(): +def test_delete_firebase_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.BatchGetUserLinksRequest() + request = analytics_admin.DeleteFirebaseLinkRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_get_user_links), "__call__" + type(client.transport.delete_firebase_link), "__call__" ) as call: - call.return_value = analytics_admin.BatchGetUserLinksResponse() - client.batch_get_user_links(request) + call.return_value = None + client.delete_firebase_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -3760,30 +3787,28 @@ def test_batch_get_user_links_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_batch_get_user_links_field_headers_async(): +async def test_delete_firebase_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.BatchGetUserLinksRequest() + request = analytics_admin.DeleteFirebaseLinkRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_get_user_links), "__call__" + type(client.transport.delete_firebase_link), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.BatchGetUserLinksResponse() - ) - await client.batch_get_user_links(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_firebase_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -3794,18 +3819,102 @@ async def test_batch_get_user_links_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] +def test_delete_firebase_link_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_firebase_link), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_firebase_link( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_delete_firebase_link_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_firebase_link( + analytics_admin.DeleteFirebaseLinkRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_firebase_link_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_firebase_link), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_firebase_link( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_delete_firebase_link_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_firebase_link( + analytics_admin.DeleteFirebaseLinkRequest(), + name="name_value", + ) + + @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListUserLinksRequest, + analytics_admin.ListFirebaseLinksRequest, dict, ], ) -def test_list_user_links(request_type, transport: str = "grpc"): +def test_list_firebase_links(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -3816,24 +3925,26 @@ def test_list_user_links(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_user_links), "__call__") as call: + with mock.patch.object( + type(client.transport.list_firebase_links), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListUserLinksResponse( + call.return_value = analytics_admin.ListFirebaseLinksResponse( next_page_token="next_page_token_value", ) - response = client.list_user_links(request) + response = client.list_firebase_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListUserLinksRequest() + assert args[0] == analytics_admin.ListFirebaseLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListUserLinksPager) + assert isinstance(response, pagers.ListFirebaseLinksPager) assert response.next_page_token == "next_page_token_value" -def test_list_user_links_empty_call(): +def test_list_firebase_links_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -3842,16 +3953,19 @@ def test_list_user_links_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_user_links), "__call__") as call: - client.list_user_links() + with mock.patch.object( + type(client.transport.list_firebase_links), "__call__" + ) as call: + client.list_firebase_links() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListUserLinksRequest() + assert args[0] == analytics_admin.ListFirebaseLinksRequest() @pytest.mark.asyncio -async def test_list_user_links_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ListUserLinksRequest +async def test_list_firebase_links_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.ListFirebaseLinksRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -3863,45 +3977,49 @@ async def test_list_user_links_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_user_links), "__call__") as call: + with mock.patch.object( + type(client.transport.list_firebase_links), "__call__" + ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListUserLinksResponse( + analytics_admin.ListFirebaseLinksResponse( next_page_token="next_page_token_value", ) ) - response = await client.list_user_links(request) + response = await client.list_firebase_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListUserLinksRequest() + assert args[0] == analytics_admin.ListFirebaseLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListUserLinksAsyncPager) + assert isinstance(response, pagers.ListFirebaseLinksAsyncPager) assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_list_user_links_async_from_dict(): - await test_list_user_links_async(request_type=dict) +async def test_list_firebase_links_async_from_dict(): + await test_list_firebase_links_async(request_type=dict) -def test_list_user_links_field_headers(): +def test_list_firebase_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListUserLinksRequest() + request = analytics_admin.ListFirebaseLinksRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_user_links), "__call__") as call: - call.return_value = analytics_admin.ListUserLinksResponse() - client.list_user_links(request) + with mock.patch.object( + type(client.transport.list_firebase_links), "__call__" + ) as call: + call.return_value = analytics_admin.ListFirebaseLinksResponse() + client.list_firebase_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -3917,23 +4035,25 @@ def test_list_user_links_field_headers(): @pytest.mark.asyncio -async def test_list_user_links_field_headers_async(): +async def test_list_firebase_links_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListUserLinksRequest() + request = analytics_admin.ListFirebaseLinksRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_user_links), "__call__") as call: + with mock.patch.object( + type(client.transport.list_firebase_links), "__call__" + ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListUserLinksResponse() + analytics_admin.ListFirebaseLinksResponse() ) - await client.list_user_links(request) + await client.list_firebase_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -3948,18 +4068,20 @@ async def test_list_user_links_field_headers_async(): ) in kw["metadata"] -def test_list_user_links_flattened(): +def test_list_firebase_links_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_user_links), "__call__") as call: + with mock.patch.object( + type(client.transport.list_firebase_links), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListUserLinksResponse() + call.return_value = analytics_admin.ListFirebaseLinksResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_user_links( + client.list_firebase_links( parent="parent_value", ) @@ -3972,7 +4094,7 @@ def test_list_user_links_flattened(): assert arg == mock_val -def test_list_user_links_flattened_error(): +def test_list_firebase_links_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -3980,29 +4102,31 @@ def test_list_user_links_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_user_links( - analytics_admin.ListUserLinksRequest(), + client.list_firebase_links( + analytics_admin.ListFirebaseLinksRequest(), parent="parent_value", ) @pytest.mark.asyncio -async def test_list_user_links_flattened_async(): +async def test_list_firebase_links_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_user_links), "__call__") as call: + with mock.patch.object( + type(client.transport.list_firebase_links), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListUserLinksResponse() + call.return_value = analytics_admin.ListFirebaseLinksResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListUserLinksResponse() + analytics_admin.ListFirebaseLinksResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_user_links( + response = await client.list_firebase_links( parent="parent_value", ) @@ -4016,7 +4140,7 @@ async def test_list_user_links_flattened_async(): @pytest.mark.asyncio -async def test_list_user_links_flattened_error_async(): +async def test_list_firebase_links_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -4024,44 +4148,46 @@ async def test_list_user_links_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_user_links( - analytics_admin.ListUserLinksRequest(), + await client.list_firebase_links( + analytics_admin.ListFirebaseLinksRequest(), parent="parent_value", ) -def test_list_user_links_pager(transport_name: str = "grpc"): +def test_list_firebase_links_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials, transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_user_links), "__call__") as call: + with mock.patch.object( + type(client.transport.list_firebase_links), "__call__" + ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), - resources.UserLink(), - resources.UserLink(), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), + resources.FirebaseLink(), + resources.FirebaseLink(), ], next_page_token="abc", ), - analytics_admin.ListUserLinksResponse( - user_links=[], + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[], next_page_token="def", ), - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), ], next_page_token="ghi", ), - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), - resources.UserLink(), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), + resources.FirebaseLink(), ], ), RuntimeError, @@ -4071,95 +4197,99 @@ def test_list_user_links_pager(transport_name: str = "grpc"): metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), ) - pager = client.list_user_links(request={}) + pager = client.list_firebase_links(request={}) assert pager._metadata == metadata results = list(pager) assert len(results) == 6 - assert all(isinstance(i, resources.UserLink) for i in results) + assert all(isinstance(i, resources.FirebaseLink) for i in results) -def test_list_user_links_pages(transport_name: str = "grpc"): +def test_list_firebase_links_pages(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials, transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_user_links), "__call__") as call: + with mock.patch.object( + type(client.transport.list_firebase_links), "__call__" + ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), - resources.UserLink(), - resources.UserLink(), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), + resources.FirebaseLink(), + resources.FirebaseLink(), ], next_page_token="abc", ), - analytics_admin.ListUserLinksResponse( - user_links=[], + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[], next_page_token="def", ), - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), ], next_page_token="ghi", ), - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), - resources.UserLink(), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), + resources.FirebaseLink(), ], ), RuntimeError, ) - pages = list(client.list_user_links(request={}).pages) + pages = list(client.list_firebase_links(request={}).pages) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_list_user_links_async_pager(): +async def test_list_firebase_links_async_pager(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_user_links), "__call__", new_callable=mock.AsyncMock + type(client.transport.list_firebase_links), + "__call__", + new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), - resources.UserLink(), - resources.UserLink(), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), + resources.FirebaseLink(), + resources.FirebaseLink(), ], next_page_token="abc", ), - analytics_admin.ListUserLinksResponse( - user_links=[], + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[], next_page_token="def", ), - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), ], next_page_token="ghi", ), - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), - resources.UserLink(), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), + resources.FirebaseLink(), ], ), RuntimeError, ) - async_pager = await client.list_user_links( + async_pager = await client.list_firebase_links( request={}, ) assert async_pager.next_page_token == "abc" @@ -4168,43 +4298,45 @@ async def test_list_user_links_async_pager(): responses.append(response) assert len(responses) == 6 - assert all(isinstance(i, resources.UserLink) for i in responses) + assert all(isinstance(i, resources.FirebaseLink) for i in responses) @pytest.mark.asyncio -async def test_list_user_links_async_pages(): +async def test_list_firebase_links_async_pages(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_user_links), "__call__", new_callable=mock.AsyncMock + type(client.transport.list_firebase_links), + "__call__", + new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), - resources.UserLink(), - resources.UserLink(), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), + resources.FirebaseLink(), + resources.FirebaseLink(), ], next_page_token="abc", ), - analytics_admin.ListUserLinksResponse( - user_links=[], + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[], next_page_token="def", ), - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), ], next_page_token="ghi", ), - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), - resources.UserLink(), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), + resources.FirebaseLink(), ], ), RuntimeError, @@ -4213,7 +4345,7 @@ async def test_list_user_links_async_pages(): # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 async for page_ in ( # pragma: no branch - await client.list_user_links(request={}) + await client.list_firebase_links(request={}) ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): @@ -4223,11 +4355,11 @@ async def test_list_user_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.AuditUserLinksRequest, + analytics_admin.GetGlobalSiteTagRequest, dict, ], ) -def test_audit_user_links(request_type, transport: str = "grpc"): +def test_get_global_site_tag(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -4238,24 +4370,28 @@ def test_audit_user_links(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.audit_user_links), "__call__") as call: + with mock.patch.object( + type(client.transport.get_global_site_tag), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.AuditUserLinksResponse( - next_page_token="next_page_token_value", + call.return_value = resources.GlobalSiteTag( + name="name_value", + snippet="snippet_value", ) - response = client.audit_user_links(request) + response = client.get_global_site_tag(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.AuditUserLinksRequest() + assert args[0] == analytics_admin.GetGlobalSiteTagRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.AuditUserLinksPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.GlobalSiteTag) + assert response.name == "name_value" + assert response.snippet == "snippet_value" -def test_audit_user_links_empty_call(): +def test_get_global_site_tag_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -4264,16 +4400,19 @@ def test_audit_user_links_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.audit_user_links), "__call__") as call: - client.audit_user_links() + with mock.patch.object( + type(client.transport.get_global_site_tag), "__call__" + ) as call: + client.get_global_site_tag() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.AuditUserLinksRequest() + assert args[0] == analytics_admin.GetGlobalSiteTagRequest() @pytest.mark.asyncio -async def test_audit_user_links_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.AuditUserLinksRequest +async def test_get_global_site_tag_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.GetGlobalSiteTagRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4285,45 +4424,51 @@ async def test_audit_user_links_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.audit_user_links), "__call__") as call: + with mock.patch.object( + type(client.transport.get_global_site_tag), "__call__" + ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.AuditUserLinksResponse( - next_page_token="next_page_token_value", + resources.GlobalSiteTag( + name="name_value", + snippet="snippet_value", ) ) - response = await client.audit_user_links(request) + response = await client.get_global_site_tag(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.AuditUserLinksRequest() + assert args[0] == analytics_admin.GetGlobalSiteTagRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.AuditUserLinksAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.GlobalSiteTag) + assert response.name == "name_value" + assert response.snippet == "snippet_value" @pytest.mark.asyncio -async def test_audit_user_links_async_from_dict(): - await test_audit_user_links_async(request_type=dict) +async def test_get_global_site_tag_async_from_dict(): + await test_get_global_site_tag_async(request_type=dict) -def test_audit_user_links_field_headers(): +def test_get_global_site_tag_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.AuditUserLinksRequest() + request = analytics_admin.GetGlobalSiteTagRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.audit_user_links), "__call__") as call: - call.return_value = analytics_admin.AuditUserLinksResponse() - client.audit_user_links(request) + with mock.patch.object( + type(client.transport.get_global_site_tag), "__call__" + ) as call: + call.return_value = resources.GlobalSiteTag() + client.get_global_site_tag(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -4334,28 +4479,30 @@ def test_audit_user_links_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_audit_user_links_field_headers_async(): +async def test_get_global_site_tag_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.AuditUserLinksRequest() + request = analytics_admin.GetGlobalSiteTagRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.audit_user_links), "__call__") as call: + with mock.patch.object( + type(client.transport.get_global_site_tag), "__call__" + ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.AuditUserLinksResponse() + resources.GlobalSiteTag() ) - await client.audit_user_links(request) + await client.get_global_site_tag(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -4366,208 +4513,104 @@ async def test_audit_user_links_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_audit_user_links_pager(transport_name: str = "grpc"): +def test_get_global_site_tag_flattened(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.audit_user_links), "__call__") as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - resources.AuditUserLink(), - resources.AuditUserLink(), - ], - next_page_token="abc", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[], - next_page_token="def", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - ], - next_page_token="ghi", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - resources.AuditUserLink(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + with mock.patch.object( + type(client.transport.get_global_site_tag), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.GlobalSiteTag() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_global_site_tag( + name="name_value", ) - pager = client.audit_user_links(request={}) - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.AuditUserLink) for i in results) + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val -def test_audit_user_links_pages(transport_name: str = "grpc"): +def test_get_global_site_tag_flattened_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.audit_user_links), "__call__") as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - resources.AuditUserLink(), - resources.AuditUserLink(), - ], - next_page_token="abc", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[], - next_page_token="def", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - ], - next_page_token="ghi", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - resources.AuditUserLink(), - ], - ), - RuntimeError, + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_global_site_tag( + analytics_admin.GetGlobalSiteTagRequest(), + name="name_value", ) - pages = list(client.audit_user_links(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_audit_user_links_async_pager(): +async def test_get_global_site_tag_flattened_async(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.audit_user_links), "__call__", new_callable=mock.AsyncMock + type(client.transport.get_global_site_tag), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - resources.AuditUserLink(), - resources.AuditUserLink(), - ], - next_page_token="abc", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[], - next_page_token="def", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - ], - next_page_token="ghi", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - resources.AuditUserLink(), - ], - ), - RuntimeError, + # Designate an appropriate return value for the call. + call.return_value = resources.GlobalSiteTag() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.GlobalSiteTag() ) - async_pager = await client.audit_user_links( - request={}, + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_global_site_tag( + name="name_value", ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - assert len(responses) == 6 - assert all(isinstance(i, resources.AuditUserLink) for i in responses) + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio -async def test_audit_user_links_async_pages(): +async def test_get_global_site_tag_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.audit_user_links), "__call__", new_callable=mock.AsyncMock - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - resources.AuditUserLink(), - resources.AuditUserLink(), - ], - next_page_token="abc", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[], - next_page_token="def", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - ], - next_page_token="ghi", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - resources.AuditUserLink(), - ], - ), - RuntimeError, + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_global_site_tag( + analytics_admin.GetGlobalSiteTagRequest(), + name="name_value", ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.audit_user_links(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateUserLinkRequest, + analytics_admin.CreateGoogleAdsLinkRequest, dict, ], ) -def test_create_user_link(request_type, transport: str = "grpc"): +def test_create_google_ads_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -4578,28 +4621,32 @@ def test_create_user_link(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.create_google_ads_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.UserLink( + call.return_value = resources.GoogleAdsLink( name="name_value", - email_address="email_address_value", - direct_roles=["direct_roles_value"], + customer_id="customer_id_value", + can_manage_clients=True, + creator_email_address="creator_email_address_value", ) - response = client.create_user_link(request) + response = client.create_google_ads_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateUserLinkRequest() + assert args[0] == analytics_admin.CreateGoogleAdsLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.UserLink) + assert isinstance(response, resources.GoogleAdsLink) assert response.name == "name_value" - assert response.email_address == "email_address_value" - assert response.direct_roles == ["direct_roles_value"] + assert response.customer_id == "customer_id_value" + assert response.can_manage_clients is True + assert response.creator_email_address == "creator_email_address_value" -def test_create_user_link_empty_call(): +def test_create_google_ads_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -4608,16 +4655,19 @@ def test_create_user_link_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_user_link), "__call__") as call: - client.create_user_link() + with mock.patch.object( + type(client.transport.create_google_ads_link), "__call__" + ) as call: + client.create_google_ads_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateUserLinkRequest() + assert args[0] == analytics_admin.CreateGoogleAdsLinkRequest() @pytest.mark.asyncio -async def test_create_user_link_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.CreateUserLinkRequest +async def test_create_google_ads_link_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.CreateGoogleAdsLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4629,49 +4679,55 @@ async def test_create_user_link_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.create_google_ads_link), "__call__" + ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.UserLink( + resources.GoogleAdsLink( name="name_value", - email_address="email_address_value", - direct_roles=["direct_roles_value"], + customer_id="customer_id_value", + can_manage_clients=True, + creator_email_address="creator_email_address_value", ) ) - response = await client.create_user_link(request) + response = await client.create_google_ads_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateUserLinkRequest() + assert args[0] == analytics_admin.CreateGoogleAdsLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.UserLink) + assert isinstance(response, resources.GoogleAdsLink) assert response.name == "name_value" - assert response.email_address == "email_address_value" - assert response.direct_roles == ["direct_roles_value"] + assert response.customer_id == "customer_id_value" + assert response.can_manage_clients is True + assert response.creator_email_address == "creator_email_address_value" @pytest.mark.asyncio -async def test_create_user_link_async_from_dict(): - await test_create_user_link_async(request_type=dict) +async def test_create_google_ads_link_async_from_dict(): + await test_create_google_ads_link_async(request_type=dict) -def test_create_user_link_field_headers(): +def test_create_google_ads_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateUserLinkRequest() + request = analytics_admin.CreateGoogleAdsLinkRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_user_link), "__call__") as call: - call.return_value = resources.UserLink() - client.create_user_link(request) + with mock.patch.object( + type(client.transport.create_google_ads_link), "__call__" + ) as call: + call.return_value = resources.GoogleAdsLink() + client.create_google_ads_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -4687,21 +4743,25 @@ def test_create_user_link_field_headers(): @pytest.mark.asyncio -async def test_create_user_link_field_headers_async(): +async def test_create_google_ads_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateUserLinkRequest() + request = analytics_admin.CreateGoogleAdsLinkRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_user_link), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.UserLink()) - await client.create_user_link(request) + with mock.patch.object( + type(client.transport.create_google_ads_link), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.GoogleAdsLink() + ) + await client.create_google_ads_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -4716,20 +4776,22 @@ async def test_create_user_link_field_headers_async(): ) in kw["metadata"] -def test_create_user_link_flattened(): +def test_create_google_ads_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.create_google_ads_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.UserLink() + call.return_value = resources.GoogleAdsLink() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_user_link( + client.create_google_ads_link( parent="parent_value", - user_link=resources.UserLink(name="name_value"), + google_ads_link=resources.GoogleAdsLink(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -4739,12 +4801,12 @@ def test_create_user_link_flattened(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].user_link - mock_val = resources.UserLink(name="name_value") + arg = args[0].google_ads_link + mock_val = resources.GoogleAdsLink(name="name_value") assert arg == mock_val -def test_create_user_link_flattened_error(): +def test_create_google_ads_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -4752,30 +4814,34 @@ def test_create_user_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_user_link( - analytics_admin.CreateUserLinkRequest(), + client.create_google_ads_link( + analytics_admin.CreateGoogleAdsLinkRequest(), parent="parent_value", - user_link=resources.UserLink(name="name_value"), + google_ads_link=resources.GoogleAdsLink(name="name_value"), ) @pytest.mark.asyncio -async def test_create_user_link_flattened_async(): +async def test_create_google_ads_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.create_google_ads_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.UserLink() + call.return_value = resources.GoogleAdsLink() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.UserLink()) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.GoogleAdsLink() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_user_link( + response = await client.create_google_ads_link( parent="parent_value", - user_link=resources.UserLink(name="name_value"), + google_ads_link=resources.GoogleAdsLink(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -4785,13 +4851,13 @@ async def test_create_user_link_flattened_async(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].user_link - mock_val = resources.UserLink(name="name_value") + arg = args[0].google_ads_link + mock_val = resources.GoogleAdsLink(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_create_user_link_flattened_error_async(): +async def test_create_google_ads_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -4799,21 +4865,21 @@ async def test_create_user_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_user_link( - analytics_admin.CreateUserLinkRequest(), + await client.create_google_ads_link( + analytics_admin.CreateGoogleAdsLinkRequest(), parent="parent_value", - user_link=resources.UserLink(name="name_value"), + google_ads_link=resources.GoogleAdsLink(name="name_value"), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchCreateUserLinksRequest, + analytics_admin.UpdateGoogleAdsLinkRequest, dict, ], ) -def test_batch_create_user_links(request_type, transport: str = "grpc"): +def test_update_google_ads_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -4825,22 +4891,31 @@ def test_batch_create_user_links(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_create_user_links), "__call__" + type(client.transport.update_google_ads_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.BatchCreateUserLinksResponse() - response = client.batch_create_user_links(request) + call.return_value = resources.GoogleAdsLink( + name="name_value", + customer_id="customer_id_value", + can_manage_clients=True, + creator_email_address="creator_email_address_value", + ) + response = client.update_google_ads_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchCreateUserLinksRequest() + assert args[0] == analytics_admin.UpdateGoogleAdsLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchCreateUserLinksResponse) + assert isinstance(response, resources.GoogleAdsLink) + assert response.name == "name_value" + assert response.customer_id == "customer_id_value" + assert response.can_manage_clients is True + assert response.creator_email_address == "creator_email_address_value" -def test_batch_create_user_links_empty_call(): +def test_update_google_ads_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -4850,18 +4925,18 @@ def test_batch_create_user_links_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_create_user_links), "__call__" + type(client.transport.update_google_ads_link), "__call__" ) as call: - client.batch_create_user_links() + client.update_google_ads_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchCreateUserLinksRequest() + assert args[0] == analytics_admin.UpdateGoogleAdsLinkRequest() @pytest.mark.asyncio -async def test_batch_create_user_links_async( +async def test_update_google_ads_link_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.BatchCreateUserLinksRequest, + request_type=analytics_admin.UpdateGoogleAdsLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -4874,45 +4949,54 @@ async def test_batch_create_user_links_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_create_user_links), "__call__" + type(client.transport.update_google_ads_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.BatchCreateUserLinksResponse() + resources.GoogleAdsLink( + name="name_value", + customer_id="customer_id_value", + can_manage_clients=True, + creator_email_address="creator_email_address_value", + ) ) - response = await client.batch_create_user_links(request) + response = await client.update_google_ads_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchCreateUserLinksRequest() + assert args[0] == analytics_admin.UpdateGoogleAdsLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchCreateUserLinksResponse) + assert isinstance(response, resources.GoogleAdsLink) + assert response.name == "name_value" + assert response.customer_id == "customer_id_value" + assert response.can_manage_clients is True + assert response.creator_email_address == "creator_email_address_value" @pytest.mark.asyncio -async def test_batch_create_user_links_async_from_dict(): - await test_batch_create_user_links_async(request_type=dict) +async def test_update_google_ads_link_async_from_dict(): + await test_update_google_ads_link_async(request_type=dict) -def test_batch_create_user_links_field_headers(): +def test_update_google_ads_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.BatchCreateUserLinksRequest() + request = analytics_admin.UpdateGoogleAdsLinkRequest() - request.parent = "parent_value" + request.google_ads_link.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_create_user_links), "__call__" + type(client.transport.update_google_ads_link), "__call__" ) as call: - call.return_value = analytics_admin.BatchCreateUserLinksResponse() - client.batch_create_user_links(request) + call.return_value = resources.GoogleAdsLink() + client.update_google_ads_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -4923,30 +5007,30 @@ def test_batch_create_user_links_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "google_ads_link.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_batch_create_user_links_field_headers_async(): +async def test_update_google_ads_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.BatchCreateUserLinksRequest() + request = analytics_admin.UpdateGoogleAdsLinkRequest() - request.parent = "parent_value" + request.google_ads_link.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_create_user_links), "__call__" + type(client.transport.update_google_ads_link), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.BatchCreateUserLinksResponse() + resources.GoogleAdsLink() ) - await client.batch_create_user_links(request) + await client.update_google_ads_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -4957,18 +5041,114 @@ async def test_batch_create_user_links_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "google_ads_link.name=name_value", ) in kw["metadata"] +def test_update_google_ads_link_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_google_ads_link), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.GoogleAdsLink() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_google_ads_link( + google_ads_link=resources.GoogleAdsLink(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].google_ads_link + mock_val = resources.GoogleAdsLink(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +def test_update_google_ads_link_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_google_ads_link( + analytics_admin.UpdateGoogleAdsLinkRequest(), + google_ads_link=resources.GoogleAdsLink(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.asyncio +async def test_update_google_ads_link_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_google_ads_link), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.GoogleAdsLink() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.GoogleAdsLink() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_google_ads_link( + google_ads_link=resources.GoogleAdsLink(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].google_ads_link + mock_val = resources.GoogleAdsLink(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_update_google_ads_link_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_google_ads_link( + analytics_admin.UpdateGoogleAdsLinkRequest(), + google_ads_link=resources.GoogleAdsLink(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateUserLinkRequest, + analytics_admin.DeleteGoogleAdsLinkRequest, dict, ], ) -def test_update_user_link(request_type, transport: str = "grpc"): +def test_delete_google_ads_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -4979,28 +5159,23 @@ def test_update_user_link(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.delete_google_ads_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.UserLink( - name="name_value", - email_address="email_address_value", - direct_roles=["direct_roles_value"], - ) - response = client.update_user_link(request) + call.return_value = None + response = client.delete_google_ads_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateUserLinkRequest() + assert args[0] == analytics_admin.DeleteGoogleAdsLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.UserLink) - assert response.name == "name_value" - assert response.email_address == "email_address_value" - assert response.direct_roles == ["direct_roles_value"] + assert response is None -def test_update_user_link_empty_call(): +def test_delete_google_ads_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -5009,16 +5184,19 @@ def test_update_user_link_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_user_link), "__call__") as call: - client.update_user_link() + with mock.patch.object( + type(client.transport.delete_google_ads_link), "__call__" + ) as call: + client.delete_google_ads_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateUserLinkRequest() + assert args[0] == analytics_admin.DeleteGoogleAdsLinkRequest() @pytest.mark.asyncio -async def test_update_user_link_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.UpdateUserLinkRequest +async def test_delete_google_ads_link_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.DeleteGoogleAdsLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5030,49 +5208,44 @@ async def test_update_user_link_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.delete_google_ads_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.UserLink( - name="name_value", - email_address="email_address_value", - direct_roles=["direct_roles_value"], - ) - ) - response = await client.update_user_link(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_google_ads_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateUserLinkRequest() + assert args[0] == analytics_admin.DeleteGoogleAdsLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.UserLink) - assert response.name == "name_value" - assert response.email_address == "email_address_value" - assert response.direct_roles == ["direct_roles_value"] + assert response is None @pytest.mark.asyncio -async def test_update_user_link_async_from_dict(): - await test_update_user_link_async(request_type=dict) +async def test_delete_google_ads_link_async_from_dict(): + await test_delete_google_ads_link_async(request_type=dict) -def test_update_user_link_field_headers(): +def test_delete_google_ads_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateUserLinkRequest() + request = analytics_admin.DeleteGoogleAdsLinkRequest() - request.user_link.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_user_link), "__call__") as call: - call.return_value = resources.UserLink() - client.update_user_link(request) + with mock.patch.object( + type(client.transport.delete_google_ads_link), "__call__" + ) as call: + call.return_value = None + client.delete_google_ads_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -5083,26 +5256,28 @@ def test_update_user_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "user_link.name=name_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_user_link_field_headers_async(): +async def test_delete_google_ads_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateUserLinkRequest() + request = analytics_admin.DeleteGoogleAdsLinkRequest() - request.user_link.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_user_link), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.UserLink()) - await client.update_user_link(request) + with mock.patch.object( + type(client.transport.delete_google_ads_link), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_google_ads_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -5113,35 +5288,37 @@ async def test_update_user_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "user_link.name=name_value", + "name=name_value", ) in kw["metadata"] -def test_update_user_link_flattened(): +def test_delete_google_ads_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.delete_google_ads_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.UserLink() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_user_link( - user_link=resources.UserLink(name="name_value"), + client.delete_google_ads_link( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].user_link - mock_val = resources.UserLink(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_update_user_link_flattened_error(): +def test_delete_google_ads_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -5149,41 +5326,43 @@ def test_update_user_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_user_link( - analytics_admin.UpdateUserLinkRequest(), - user_link=resources.UserLink(name="name_value"), + client.delete_google_ads_link( + analytics_admin.DeleteGoogleAdsLinkRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_update_user_link_flattened_async(): +async def test_delete_google_ads_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.delete_google_ads_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.UserLink() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(resources.UserLink()) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_user_link( - user_link=resources.UserLink(name="name_value"), + response = await client.delete_google_ads_link( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].user_link - mock_val = resources.UserLink(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_update_user_link_flattened_error_async(): +async def test_delete_google_ads_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -5191,20 +5370,20 @@ async def test_update_user_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_user_link( - analytics_admin.UpdateUserLinkRequest(), - user_link=resources.UserLink(name="name_value"), + await client.delete_google_ads_link( + analytics_admin.DeleteGoogleAdsLinkRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchUpdateUserLinksRequest, + analytics_admin.ListGoogleAdsLinksRequest, dict, ], ) -def test_batch_update_user_links(request_type, transport: str = "grpc"): +def test_list_google_ads_links(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -5216,22 +5395,25 @@ def test_batch_update_user_links(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_update_user_links), "__call__" + type(client.transport.list_google_ads_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.BatchUpdateUserLinksResponse() - response = client.batch_update_user_links(request) + call.return_value = analytics_admin.ListGoogleAdsLinksResponse( + next_page_token="next_page_token_value", + ) + response = client.list_google_ads_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchUpdateUserLinksRequest() + assert args[0] == analytics_admin.ListGoogleAdsLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchUpdateUserLinksResponse) + assert isinstance(response, pagers.ListGoogleAdsLinksPager) + assert response.next_page_token == "next_page_token_value" -def test_batch_update_user_links_empty_call(): +def test_list_google_ads_links_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -5241,18 +5423,18 @@ def test_batch_update_user_links_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_update_user_links), "__call__" + type(client.transport.list_google_ads_links), "__call__" ) as call: - client.batch_update_user_links() + client.list_google_ads_links() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchUpdateUserLinksRequest() + assert args[0] == analytics_admin.ListGoogleAdsLinksRequest() @pytest.mark.asyncio -async def test_batch_update_user_links_async( +async def test_list_google_ads_links_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.BatchUpdateUserLinksRequest, + request_type=analytics_admin.ListGoogleAdsLinksRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5265,45 +5447,48 @@ async def test_batch_update_user_links_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_update_user_links), "__call__" + type(client.transport.list_google_ads_links), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.BatchUpdateUserLinksResponse() + analytics_admin.ListGoogleAdsLinksResponse( + next_page_token="next_page_token_value", + ) ) - response = await client.batch_update_user_links(request) + response = await client.list_google_ads_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchUpdateUserLinksRequest() + assert args[0] == analytics_admin.ListGoogleAdsLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchUpdateUserLinksResponse) + assert isinstance(response, pagers.ListGoogleAdsLinksAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_batch_update_user_links_async_from_dict(): - await test_batch_update_user_links_async(request_type=dict) +async def test_list_google_ads_links_async_from_dict(): + await test_list_google_ads_links_async(request_type=dict) -def test_batch_update_user_links_field_headers(): +def test_list_google_ads_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.BatchUpdateUserLinksRequest() + request = analytics_admin.ListGoogleAdsLinksRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_update_user_links), "__call__" + type(client.transport.list_google_ads_links), "__call__" ) as call: - call.return_value = analytics_admin.BatchUpdateUserLinksResponse() - client.batch_update_user_links(request) + call.return_value = analytics_admin.ListGoogleAdsLinksResponse() + client.list_google_ads_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -5319,25 +5504,25 @@ def test_batch_update_user_links_field_headers(): @pytest.mark.asyncio -async def test_batch_update_user_links_field_headers_async(): +async def test_list_google_ads_links_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.BatchUpdateUserLinksRequest() + request = analytics_admin.ListGoogleAdsLinksRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_update_user_links), "__call__" + type(client.transport.list_google_ads_links), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.BatchUpdateUserLinksResponse() + analytics_admin.ListGoogleAdsLinksResponse() ) - await client.batch_update_user_links(request) + await client.list_google_ads_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -5352,234 +5537,298 @@ async def test_batch_update_user_links_field_headers_async(): ) in kw["metadata"] -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.DeleteUserLinkRequest, - dict, - ], -) -def test_delete_user_link(request_type, transport: str = "grpc"): +def test_list_google_ads_links_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.list_google_ads_links), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_user_link(request) + call.return_value = analytics_admin.ListGoogleAdsLinksResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_google_ads_links( + parent="parent_value", + ) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying call was made with the expected + # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteUserLinkRequest() - - # Establish that the response is the type that we expect. - assert response is None + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val -def test_delete_user_link_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. +def test_list_google_ads_links_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_user_link), "__call__") as call: - client.delete_user_link() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteUserLinkRequest() + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_google_ads_links( + analytics_admin.ListGoogleAdsLinksRequest(), + parent="parent_value", + ) @pytest.mark.asyncio -async def test_delete_user_link_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.DeleteUserLinkRequest -): +async def test_list_google_ads_links_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_user_link), "__call__") as call: + with mock.patch.object( + type(client.transport.list_google_ads_links), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_user_link(request) + call.return_value = analytics_admin.ListGoogleAdsLinksResponse() - # Establish that the underlying gRPC stub method was called. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListGoogleAdsLinksResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_google_ads_links( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteUserLinkRequest() - - # Establish that the response is the type that we expect. - assert response is None + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio -async def test_delete_user_link_async_from_dict(): - await test_delete_user_link_async(request_type=dict) - - -def test_delete_user_link_field_headers(): - client = AnalyticsAdminServiceClient( +async def test_list_google_ads_links_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteUserLinkRequest() - - request.name = "name_value" + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_google_ads_links( + analytics_admin.ListGoogleAdsLinksRequest(), + parent="parent_value", + ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_user_link), "__call__") as call: - call.return_value = None - client.delete_user_link(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_delete_user_link_field_headers_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteUserLinkRequest() - - request.name = "name_value" +def test_list_google_ads_links_pager(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_user_link), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_user_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -def test_delete_user_link_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) + with mock.patch.object( + type(client.transport.list_google_ads_links), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[], + next_page_token="def", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + ], + ), + RuntimeError, + ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_user_link), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = None - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_user_link( - name="name_value", + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), ) + pager = client.list_google_ads_links(request={}) - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.GoogleAdsLink) for i in results) -def test_delete_user_link_flattened_error(): +def test_list_google_ads_links_pages(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_user_link( - analytics_admin.DeleteUserLinkRequest(), - name="name_value", + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_google_ads_links), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[], + next_page_token="def", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + ], + ), + RuntimeError, ) + pages = list(client.list_google_ads_links(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_delete_user_link_flattened_async(): +async def test_list_google_ads_links_async_pager(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.delete_user_link), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = None - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_user_link( - name="name_value", + with mock.patch.object( + type(client.transport.list_google_ads_links), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[], + next_page_token="def", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + ], + ), + RuntimeError, ) + async_pager = await client.list_google_ads_links( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val + assert len(responses) == 6 + assert all(isinstance(i, resources.GoogleAdsLink) for i in responses) @pytest.mark.asyncio -async def test_delete_user_link_flattened_error_async(): +async def test_list_google_ads_links_async_pages(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials, ) - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_user_link( - analytics_admin.DeleteUserLinkRequest(), - name="name_value", + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_google_ads_links), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[], + next_page_token="def", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + ], + ), + RuntimeError, ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_google_ads_links(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchDeleteUserLinksRequest, + analytics_admin.GetDataSharingSettingsRequest, dict, ], ) -def test_batch_delete_user_links(request_type, transport: str = "grpc"): +def test_get_data_sharing_settings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -5591,22 +5840,35 @@ def test_batch_delete_user_links(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_delete_user_links), "__call__" + type(client.transport.get_data_sharing_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.batch_delete_user_links(request) + call.return_value = resources.DataSharingSettings( + name="name_value", + sharing_with_google_support_enabled=True, + sharing_with_google_assigned_sales_enabled=True, + sharing_with_google_any_sales_enabled=True, + sharing_with_google_products_enabled=True, + sharing_with_others_enabled=True, + ) + response = client.get_data_sharing_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchDeleteUserLinksRequest() + assert args[0] == analytics_admin.GetDataSharingSettingsRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.DataSharingSettings) + assert response.name == "name_value" + assert response.sharing_with_google_support_enabled is True + assert response.sharing_with_google_assigned_sales_enabled is True + assert response.sharing_with_google_any_sales_enabled is True + assert response.sharing_with_google_products_enabled is True + assert response.sharing_with_others_enabled is True -def test_batch_delete_user_links_empty_call(): +def test_get_data_sharing_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -5616,18 +5878,18 @@ def test_batch_delete_user_links_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_delete_user_links), "__call__" + type(client.transport.get_data_sharing_settings), "__call__" ) as call: - client.batch_delete_user_links() + client.get_data_sharing_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchDeleteUserLinksRequest() + assert args[0] == analytics_admin.GetDataSharingSettingsRequest() @pytest.mark.asyncio -async def test_batch_delete_user_links_async( +async def test_get_data_sharing_settings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.BatchDeleteUserLinksRequest, + request_type=analytics_admin.GetDataSharingSettingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5640,43 +5902,58 @@ async def test_batch_delete_user_links_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_delete_user_links), "__call__" + type(client.transport.get_data_sharing_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.batch_delete_user_links(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DataSharingSettings( + name="name_value", + sharing_with_google_support_enabled=True, + sharing_with_google_assigned_sales_enabled=True, + sharing_with_google_any_sales_enabled=True, + sharing_with_google_products_enabled=True, + sharing_with_others_enabled=True, + ) + ) + response = await client.get_data_sharing_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchDeleteUserLinksRequest() + assert args[0] == analytics_admin.GetDataSharingSettingsRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.DataSharingSettings) + assert response.name == "name_value" + assert response.sharing_with_google_support_enabled is True + assert response.sharing_with_google_assigned_sales_enabled is True + assert response.sharing_with_google_any_sales_enabled is True + assert response.sharing_with_google_products_enabled is True + assert response.sharing_with_others_enabled is True @pytest.mark.asyncio -async def test_batch_delete_user_links_async_from_dict(): - await test_batch_delete_user_links_async(request_type=dict) +async def test_get_data_sharing_settings_async_from_dict(): + await test_get_data_sharing_settings_async(request_type=dict) -def test_batch_delete_user_links_field_headers(): +def test_get_data_sharing_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.BatchDeleteUserLinksRequest() + request = analytics_admin.GetDataSharingSettingsRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_delete_user_links), "__call__" + type(client.transport.get_data_sharing_settings), "__call__" ) as call: - call.return_value = None - client.batch_delete_user_links(request) + call.return_value = resources.DataSharingSettings() + client.get_data_sharing_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -5687,28 +5964,30 @@ def test_batch_delete_user_links_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_batch_delete_user_links_field_headers_async(): +async def test_get_data_sharing_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.BatchDeleteUserLinksRequest() + request = analytics_admin.GetDataSharingSettingsRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_delete_user_links), "__call__" + type(client.transport.get_data_sharing_settings), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.batch_delete_user_links(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DataSharingSettings() + ) + await client.get_data_sharing_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -5719,18 +5998,104 @@ async def test_batch_delete_user_links_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] +def test_get_data_sharing_settings_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_data_sharing_settings), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.DataSharingSettings() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_data_sharing_settings( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +def test_get_data_sharing_settings_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_data_sharing_settings( + analytics_admin.GetDataSharingSettingsRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_data_sharing_settings_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_data_sharing_settings), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.DataSharingSettings() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DataSharingSettings() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_data_sharing_settings( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_get_data_sharing_settings_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_data_sharing_settings( + analytics_admin.GetDataSharingSettingsRequest(), + name="name_value", + ) + + @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateFirebaseLinkRequest, + analytics_admin.GetMeasurementProtocolSecretRequest, dict, ], ) -def test_create_firebase_link(request_type, transport: str = "grpc"): +def test_get_measurement_protocol_secret(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -5742,27 +6107,29 @@ def test_create_firebase_link(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_firebase_link), "__call__" + type(client.transport.get_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.FirebaseLink( + call.return_value = resources.MeasurementProtocolSecret( name="name_value", - project="project_value", + display_name="display_name_value", + secret_value="secret_value_value", ) - response = client.create_firebase_link(request) + response = client.get_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateFirebaseLinkRequest() + assert args[0] == analytics_admin.GetMeasurementProtocolSecretRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.FirebaseLink) + assert isinstance(response, resources.MeasurementProtocolSecret) assert response.name == "name_value" - assert response.project == "project_value" + assert response.display_name == "display_name_value" + assert response.secret_value == "secret_value_value" -def test_create_firebase_link_empty_call(): +def test_get_measurement_protocol_secret_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -5772,18 +6139,18 @@ def test_create_firebase_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_firebase_link), "__call__" + type(client.transport.get_measurement_protocol_secret), "__call__" ) as call: - client.create_firebase_link() + client.get_measurement_protocol_secret() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateFirebaseLinkRequest() + assert args[0] == analytics_admin.GetMeasurementProtocolSecretRequest() @pytest.mark.asyncio -async def test_create_firebase_link_async( +async def test_get_measurement_protocol_secret_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateFirebaseLinkRequest, + request_type=analytics_admin.GetMeasurementProtocolSecretRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -5796,50 +6163,52 @@ async def test_create_firebase_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_firebase_link), "__call__" + type(client.transport.get_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.FirebaseLink( + resources.MeasurementProtocolSecret( name="name_value", - project="project_value", + display_name="display_name_value", + secret_value="secret_value_value", ) ) - response = await client.create_firebase_link(request) + response = await client.get_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateFirebaseLinkRequest() + assert args[0] == analytics_admin.GetMeasurementProtocolSecretRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.FirebaseLink) + assert isinstance(response, resources.MeasurementProtocolSecret) assert response.name == "name_value" - assert response.project == "project_value" + assert response.display_name == "display_name_value" + assert response.secret_value == "secret_value_value" @pytest.mark.asyncio -async def test_create_firebase_link_async_from_dict(): - await test_create_firebase_link_async(request_type=dict) +async def test_get_measurement_protocol_secret_async_from_dict(): + await test_get_measurement_protocol_secret_async(request_type=dict) -def test_create_firebase_link_field_headers(): +def test_get_measurement_protocol_secret_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateFirebaseLinkRequest() + request = analytics_admin.GetMeasurementProtocolSecretRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_firebase_link), "__call__" + type(client.transport.get_measurement_protocol_secret), "__call__" ) as call: - call.return_value = resources.FirebaseLink() - client.create_firebase_link(request) + call.return_value = resources.MeasurementProtocolSecret() + client.get_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -5850,30 +6219,30 @@ def test_create_firebase_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_create_firebase_link_field_headers_async(): +async def test_get_measurement_protocol_secret_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateFirebaseLinkRequest() + request = analytics_admin.GetMeasurementProtocolSecretRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_firebase_link), "__call__" + type(client.transport.get_measurement_protocol_secret), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.FirebaseLink() + resources.MeasurementProtocolSecret() ) - await client.create_firebase_link(request) + await client.get_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -5884,41 +6253,37 @@ async def test_create_firebase_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_create_firebase_link_flattened(): +def test_get_measurement_protocol_secret_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_firebase_link), "__call__" + type(client.transport.get_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.FirebaseLink() + call.return_value = resources.MeasurementProtocolSecret() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_firebase_link( - parent="parent_value", - firebase_link=resources.FirebaseLink(name="name_value"), + client.get_measurement_protocol_secret( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].firebase_link - mock_val = resources.FirebaseLink(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_create_firebase_link_flattened_error(): +def test_get_measurement_protocol_secret_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -5926,272 +6291,31 @@ def test_create_firebase_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_firebase_link( - analytics_admin.CreateFirebaseLinkRequest(), - parent="parent_value", - firebase_link=resources.FirebaseLink(name="name_value"), + client.get_measurement_protocol_secret( + analytics_admin.GetMeasurementProtocolSecretRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_create_firebase_link_flattened_async(): +async def test_get_measurement_protocol_secret_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_firebase_link), "__call__" + type(client.transport.get_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.FirebaseLink() + call.return_value = resources.MeasurementProtocolSecret() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.FirebaseLink() + resources.MeasurementProtocolSecret() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_firebase_link( - parent="parent_value", - firebase_link=resources.FirebaseLink(name="name_value"), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].firebase_link - mock_val = resources.FirebaseLink(name="name_value") - assert arg == mock_val - - -@pytest.mark.asyncio -async def test_create_firebase_link_flattened_error_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_firebase_link( - analytics_admin.CreateFirebaseLinkRequest(), - parent="parent_value", - firebase_link=resources.FirebaseLink(name="name_value"), - ) - - -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.DeleteFirebaseLinkRequest, - dict, - ], -) -def test_delete_firebase_link(request_type, transport: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_firebase_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_firebase_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteFirebaseLinkRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -def test_delete_firebase_link_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_firebase_link), "__call__" - ) as call: - client.delete_firebase_link() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteFirebaseLinkRequest() - - -@pytest.mark.asyncio -async def test_delete_firebase_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteFirebaseLinkRequest, -): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_firebase_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_firebase_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteFirebaseLinkRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.asyncio -async def test_delete_firebase_link_async_from_dict(): - await test_delete_firebase_link_async(request_type=dict) - - -def test_delete_firebase_link_field_headers(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteFirebaseLinkRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_firebase_link), "__call__" - ) as call: - call.return_value = None - client.delete_firebase_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_delete_firebase_link_field_headers_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteFirebaseLinkRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_firebase_link), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_firebase_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -def test_delete_firebase_link_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_firebase_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = None - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_firebase_link( - name="name_value", - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val - - -def test_delete_firebase_link_flattened_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_firebase_link( - analytics_admin.DeleteFirebaseLinkRequest(), - name="name_value", - ) - - -@pytest.mark.asyncio -async def test_delete_firebase_link_flattened_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_firebase_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = None - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_firebase_link( + response = await client.get_measurement_protocol_secret( name="name_value", ) @@ -6205,7 +6329,7 @@ async def test_delete_firebase_link_flattened_async(): @pytest.mark.asyncio -async def test_delete_firebase_link_flattened_error_async(): +async def test_get_measurement_protocol_secret_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -6213,8 +6337,8 @@ async def test_delete_firebase_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.delete_firebase_link( - analytics_admin.DeleteFirebaseLinkRequest(), + await client.get_measurement_protocol_secret( + analytics_admin.GetMeasurementProtocolSecretRequest(), name="name_value", ) @@ -6222,11 +6346,11 @@ async def test_delete_firebase_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListFirebaseLinksRequest, + analytics_admin.ListMeasurementProtocolSecretsRequest, dict, ], ) -def test_list_firebase_links(request_type, transport: str = "grpc"): +def test_list_measurement_protocol_secrets(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -6238,25 +6362,25 @@ def test_list_firebase_links(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_firebase_links), "__call__" + type(client.transport.list_measurement_protocol_secrets), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListFirebaseLinksResponse( + call.return_value = analytics_admin.ListMeasurementProtocolSecretsResponse( next_page_token="next_page_token_value", ) - response = client.list_firebase_links(request) + response = client.list_measurement_protocol_secrets(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListFirebaseLinksRequest() + assert args[0] == analytics_admin.ListMeasurementProtocolSecretsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListFirebaseLinksPager) + assert isinstance(response, pagers.ListMeasurementProtocolSecretsPager) assert response.next_page_token == "next_page_token_value" -def test_list_firebase_links_empty_call(): +def test_list_measurement_protocol_secrets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -6266,18 +6390,18 @@ def test_list_firebase_links_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_firebase_links), "__call__" + type(client.transport.list_measurement_protocol_secrets), "__call__" ) as call: - client.list_firebase_links() + client.list_measurement_protocol_secrets() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListFirebaseLinksRequest() + assert args[0] == analytics_admin.ListMeasurementProtocolSecretsRequest() @pytest.mark.asyncio -async def test_list_firebase_links_async( +async def test_list_measurement_protocol_secrets_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListFirebaseLinksRequest, + request_type=analytics_admin.ListMeasurementProtocolSecretsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6290,48 +6414,48 @@ async def test_list_firebase_links_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_firebase_links), "__call__" + type(client.transport.list_measurement_protocol_secrets), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListFirebaseLinksResponse( + analytics_admin.ListMeasurementProtocolSecretsResponse( next_page_token="next_page_token_value", ) ) - response = await client.list_firebase_links(request) + response = await client.list_measurement_protocol_secrets(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListFirebaseLinksRequest() + assert args[0] == analytics_admin.ListMeasurementProtocolSecretsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListFirebaseLinksAsyncPager) + assert isinstance(response, pagers.ListMeasurementProtocolSecretsAsyncPager) assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_list_firebase_links_async_from_dict(): - await test_list_firebase_links_async(request_type=dict) +async def test_list_measurement_protocol_secrets_async_from_dict(): + await test_list_measurement_protocol_secrets_async(request_type=dict) -def test_list_firebase_links_field_headers(): +def test_list_measurement_protocol_secrets_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListFirebaseLinksRequest() + request = analytics_admin.ListMeasurementProtocolSecretsRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_firebase_links), "__call__" + type(client.transport.list_measurement_protocol_secrets), "__call__" ) as call: - call.return_value = analytics_admin.ListFirebaseLinksResponse() - client.list_firebase_links(request) + call.return_value = analytics_admin.ListMeasurementProtocolSecretsResponse() + client.list_measurement_protocol_secrets(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -6347,25 +6471,25 @@ def test_list_firebase_links_field_headers(): @pytest.mark.asyncio -async def test_list_firebase_links_field_headers_async(): +async def test_list_measurement_protocol_secrets_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListFirebaseLinksRequest() + request = analytics_admin.ListMeasurementProtocolSecretsRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_firebase_links), "__call__" + type(client.transport.list_measurement_protocol_secrets), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListFirebaseLinksResponse() + analytics_admin.ListMeasurementProtocolSecretsResponse() ) - await client.list_firebase_links(request) + await client.list_measurement_protocol_secrets(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -6380,20 +6504,20 @@ async def test_list_firebase_links_field_headers_async(): ) in kw["metadata"] -def test_list_firebase_links_flattened(): +def test_list_measurement_protocol_secrets_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_firebase_links), "__call__" + type(client.transport.list_measurement_protocol_secrets), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListFirebaseLinksResponse() + call.return_value = analytics_admin.ListMeasurementProtocolSecretsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_firebase_links( + client.list_measurement_protocol_secrets( parent="parent_value", ) @@ -6406,7 +6530,7 @@ def test_list_firebase_links_flattened(): assert arg == mock_val -def test_list_firebase_links_flattened_error(): +def test_list_measurement_protocol_secrets_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -6414,31 +6538,31 @@ def test_list_firebase_links_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_firebase_links( - analytics_admin.ListFirebaseLinksRequest(), + client.list_measurement_protocol_secrets( + analytics_admin.ListMeasurementProtocolSecretsRequest(), parent="parent_value", ) @pytest.mark.asyncio -async def test_list_firebase_links_flattened_async(): +async def test_list_measurement_protocol_secrets_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_firebase_links), "__call__" + type(client.transport.list_measurement_protocol_secrets), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListFirebaseLinksResponse() + call.return_value = analytics_admin.ListMeasurementProtocolSecretsResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListFirebaseLinksResponse() + analytics_admin.ListMeasurementProtocolSecretsResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_firebase_links( + response = await client.list_measurement_protocol_secrets( parent="parent_value", ) @@ -6452,7 +6576,7 @@ async def test_list_firebase_links_flattened_async(): @pytest.mark.asyncio -async def test_list_firebase_links_flattened_error_async(): +async def test_list_measurement_protocol_secrets_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -6460,13 +6584,13 @@ async def test_list_firebase_links_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_firebase_links( - analytics_admin.ListFirebaseLinksRequest(), + await client.list_measurement_protocol_secrets( + analytics_admin.ListMeasurementProtocolSecretsRequest(), parent="parent_value", ) -def test_list_firebase_links_pager(transport_name: str = "grpc"): +def test_list_measurement_protocol_secrets_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials, transport=transport_name, @@ -6474,32 +6598,32 @@ def test_list_firebase_links_pager(transport_name: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_firebase_links), "__call__" + type(client.transport.list_measurement_protocol_secrets), "__call__" ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), - resources.FirebaseLink(), - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), ], next_page_token="abc", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[], + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[], next_page_token="def", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), ], next_page_token="ghi", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), ], ), RuntimeError, @@ -6509,16 +6633,16 @@ def test_list_firebase_links_pager(transport_name: str = "grpc"): metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), ) - pager = client.list_firebase_links(request={}) + pager = client.list_measurement_protocol_secrets(request={}) assert pager._metadata == metadata results = list(pager) assert len(results) == 6 - assert all(isinstance(i, resources.FirebaseLink) for i in results) + assert all(isinstance(i, resources.MeasurementProtocolSecret) for i in results) -def test_list_firebase_links_pages(transport_name: str = "grpc"): +def test_list_measurement_protocol_secrets_pages(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials, transport=transport_name, @@ -6526,82 +6650,82 @@ def test_list_firebase_links_pages(transport_name: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_firebase_links), "__call__" + type(client.transport.list_measurement_protocol_secrets), "__call__" ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), - resources.FirebaseLink(), - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), ], next_page_token="abc", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[], + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[], next_page_token="def", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), ], next_page_token="ghi", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), ], ), RuntimeError, ) - pages = list(client.list_firebase_links(request={}).pages) + pages = list(client.list_measurement_protocol_secrets(request={}).pages) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_list_firebase_links_async_pager(): +async def test_list_measurement_protocol_secrets_async_pager(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_firebase_links), + type(client.transport.list_measurement_protocol_secrets), "__call__", new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), - resources.FirebaseLink(), - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), ], next_page_token="abc", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[], + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[], next_page_token="def", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), ], next_page_token="ghi", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), ], ), RuntimeError, ) - async_pager = await client.list_firebase_links( + async_pager = await client.list_measurement_protocol_secrets( request={}, ) assert async_pager.next_page_token == "abc" @@ -6610,45 +6734,47 @@ async def test_list_firebase_links_async_pager(): responses.append(response) assert len(responses) == 6 - assert all(isinstance(i, resources.FirebaseLink) for i in responses) + assert all( + isinstance(i, resources.MeasurementProtocolSecret) for i in responses + ) @pytest.mark.asyncio -async def test_list_firebase_links_async_pages(): +async def test_list_measurement_protocol_secrets_async_pages(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_firebase_links), + type(client.transport.list_measurement_protocol_secrets), "__call__", new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), - resources.FirebaseLink(), - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), ], next_page_token="abc", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[], + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[], next_page_token="def", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), ], next_page_token="ghi", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), ], ), RuntimeError, @@ -6657,7 +6783,7 @@ async def test_list_firebase_links_async_pages(): # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 async for page_ in ( # pragma: no branch - await client.list_firebase_links(request={}) + await client.list_measurement_protocol_secrets(request={}) ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): @@ -6667,11 +6793,11 @@ async def test_list_firebase_links_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetGlobalSiteTagRequest, + analytics_admin.CreateMeasurementProtocolSecretRequest, dict, ], ) -def test_get_global_site_tag(request_type, transport: str = "grpc"): +def test_create_measurement_protocol_secret(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -6683,27 +6809,29 @@ def test_get_global_site_tag(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_global_site_tag), "__call__" + type(client.transport.create_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.GlobalSiteTag( + call.return_value = resources.MeasurementProtocolSecret( name="name_value", - snippet="snippet_value", + display_name="display_name_value", + secret_value="secret_value_value", ) - response = client.get_global_site_tag(request) + response = client.create_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetGlobalSiteTagRequest() + assert args[0] == analytics_admin.CreateMeasurementProtocolSecretRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.GlobalSiteTag) + assert isinstance(response, resources.MeasurementProtocolSecret) assert response.name == "name_value" - assert response.snippet == "snippet_value" + assert response.display_name == "display_name_value" + assert response.secret_value == "secret_value_value" -def test_get_global_site_tag_empty_call(): +def test_create_measurement_protocol_secret_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -6713,18 +6841,18 @@ def test_get_global_site_tag_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_global_site_tag), "__call__" + type(client.transport.create_measurement_protocol_secret), "__call__" ) as call: - client.get_global_site_tag() + client.create_measurement_protocol_secret() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetGlobalSiteTagRequest() + assert args[0] == analytics_admin.CreateMeasurementProtocolSecretRequest() @pytest.mark.asyncio -async def test_get_global_site_tag_async( +async def test_create_measurement_protocol_secret_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetGlobalSiteTagRequest, + request_type=analytics_admin.CreateMeasurementProtocolSecretRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6737,50 +6865,52 @@ async def test_get_global_site_tag_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_global_site_tag), "__call__" + type(client.transport.create_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GlobalSiteTag( + resources.MeasurementProtocolSecret( name="name_value", - snippet="snippet_value", + display_name="display_name_value", + secret_value="secret_value_value", ) ) - response = await client.get_global_site_tag(request) + response = await client.create_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetGlobalSiteTagRequest() + assert args[0] == analytics_admin.CreateMeasurementProtocolSecretRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.GlobalSiteTag) + assert isinstance(response, resources.MeasurementProtocolSecret) assert response.name == "name_value" - assert response.snippet == "snippet_value" + assert response.display_name == "display_name_value" + assert response.secret_value == "secret_value_value" @pytest.mark.asyncio -async def test_get_global_site_tag_async_from_dict(): - await test_get_global_site_tag_async(request_type=dict) +async def test_create_measurement_protocol_secret_async_from_dict(): + await test_create_measurement_protocol_secret_async(request_type=dict) -def test_get_global_site_tag_field_headers(): +def test_create_measurement_protocol_secret_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetGlobalSiteTagRequest() + request = analytics_admin.CreateMeasurementProtocolSecretRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_global_site_tag), "__call__" + type(client.transport.create_measurement_protocol_secret), "__call__" ) as call: - call.return_value = resources.GlobalSiteTag() - client.get_global_site_tag(request) + call.return_value = resources.MeasurementProtocolSecret() + client.create_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -6791,30 +6921,30 @@ def test_get_global_site_tag_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_global_site_tag_field_headers_async(): +async def test_create_measurement_protocol_secret_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetGlobalSiteTagRequest() + request = analytics_admin.CreateMeasurementProtocolSecretRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_global_site_tag), "__call__" + type(client.transport.create_measurement_protocol_secret), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GlobalSiteTag() + resources.MeasurementProtocolSecret() ) - await client.get_global_site_tag(request) + await client.create_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -6825,37 +6955,43 @@ async def test_get_global_site_tag_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_global_site_tag_flattened(): +def test_create_measurement_protocol_secret_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_global_site_tag), "__call__" + type(client.transport.create_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.GlobalSiteTag() + call.return_value = resources.MeasurementProtocolSecret() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_global_site_tag( - name="name_value", + client.create_measurement_protocol_secret( + parent="parent_value", + measurement_protocol_secret=resources.MeasurementProtocolSecret( + name="name_value" + ), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].measurement_protocol_secret + mock_val = resources.MeasurementProtocolSecret(name="name_value") assert arg == mock_val -def test_get_global_site_tag_flattened_error(): +def test_create_measurement_protocol_secret_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -6863,45 +6999,54 @@ def test_get_global_site_tag_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_global_site_tag( - analytics_admin.GetGlobalSiteTagRequest(), - name="name_value", + client.create_measurement_protocol_secret( + analytics_admin.CreateMeasurementProtocolSecretRequest(), + parent="parent_value", + measurement_protocol_secret=resources.MeasurementProtocolSecret( + name="name_value" + ), ) @pytest.mark.asyncio -async def test_get_global_site_tag_flattened_async(): +async def test_create_measurement_protocol_secret_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_global_site_tag), "__call__" + type(client.transport.create_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.GlobalSiteTag() + call.return_value = resources.MeasurementProtocolSecret() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GlobalSiteTag() + resources.MeasurementProtocolSecret() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_global_site_tag( - name="name_value", + response = await client.create_measurement_protocol_secret( + parent="parent_value", + measurement_protocol_secret=resources.MeasurementProtocolSecret( + name="name_value" + ), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].measurement_protocol_secret + mock_val = resources.MeasurementProtocolSecret(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_get_global_site_tag_flattened_error_async(): +async def test_create_measurement_protocol_secret_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -6909,20 +7054,23 @@ async def test_get_global_site_tag_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_global_site_tag( - analytics_admin.GetGlobalSiteTagRequest(), - name="name_value", + await client.create_measurement_protocol_secret( + analytics_admin.CreateMeasurementProtocolSecretRequest(), + parent="parent_value", + measurement_protocol_secret=resources.MeasurementProtocolSecret( + name="name_value" + ), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateGoogleAdsLinkRequest, + analytics_admin.DeleteMeasurementProtocolSecretRequest, dict, ], ) -def test_create_google_ads_link(request_type, transport: str = "grpc"): +def test_delete_measurement_protocol_secret(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -6934,31 +7082,22 @@ def test_create_google_ads_link(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_google_ads_link), "__call__" + type(client.transport.delete_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.GoogleAdsLink( - name="name_value", - customer_id="customer_id_value", - can_manage_clients=True, - creator_email_address="creator_email_address_value", - ) - response = client.create_google_ads_link(request) + call.return_value = None + response = client.delete_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateGoogleAdsLinkRequest() + assert args[0] == analytics_admin.DeleteMeasurementProtocolSecretRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.GoogleAdsLink) - assert response.name == "name_value" - assert response.customer_id == "customer_id_value" - assert response.can_manage_clients is True - assert response.creator_email_address == "creator_email_address_value" + assert response is None -def test_create_google_ads_link_empty_call(): +def test_delete_measurement_protocol_secret_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -6968,18 +7107,18 @@ def test_create_google_ads_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_google_ads_link), "__call__" + type(client.transport.delete_measurement_protocol_secret), "__call__" ) as call: - client.create_google_ads_link() + client.delete_measurement_protocol_secret() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateGoogleAdsLinkRequest() + assert args[0] == analytics_admin.DeleteMeasurementProtocolSecretRequest() @pytest.mark.asyncio -async def test_create_google_ads_link_async( +async def test_delete_measurement_protocol_secret_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateGoogleAdsLinkRequest, + request_type=analytics_admin.DeleteMeasurementProtocolSecretRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -6992,54 +7131,43 @@ async def test_create_google_ads_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_google_ads_link), "__call__" + type(client.transport.delete_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GoogleAdsLink( - name="name_value", - customer_id="customer_id_value", - can_manage_clients=True, - creator_email_address="creator_email_address_value", - ) - ) - response = await client.create_google_ads_link(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateGoogleAdsLinkRequest() + assert args[0] == analytics_admin.DeleteMeasurementProtocolSecretRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.GoogleAdsLink) - assert response.name == "name_value" - assert response.customer_id == "customer_id_value" - assert response.can_manage_clients is True - assert response.creator_email_address == "creator_email_address_value" + assert response is None @pytest.mark.asyncio -async def test_create_google_ads_link_async_from_dict(): - await test_create_google_ads_link_async(request_type=dict) +async def test_delete_measurement_protocol_secret_async_from_dict(): + await test_delete_measurement_protocol_secret_async(request_type=dict) -def test_create_google_ads_link_field_headers(): +def test_delete_measurement_protocol_secret_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateGoogleAdsLinkRequest() + request = analytics_admin.DeleteMeasurementProtocolSecretRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_google_ads_link), "__call__" + type(client.transport.delete_measurement_protocol_secret), "__call__" ) as call: - call.return_value = resources.GoogleAdsLink() - client.create_google_ads_link(request) + call.return_value = None + client.delete_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -7050,30 +7178,28 @@ def test_create_google_ads_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_create_google_ads_link_field_headers_async(): +async def test_delete_measurement_protocol_secret_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateGoogleAdsLinkRequest() + request = analytics_admin.DeleteMeasurementProtocolSecretRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_google_ads_link), "__call__" + type(client.transport.delete_measurement_protocol_secret), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GoogleAdsLink() - ) - await client.create_google_ads_link(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -7084,41 +7210,37 @@ async def test_create_google_ads_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_create_google_ads_link_flattened(): +def test_delete_measurement_protocol_secret_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_google_ads_link), "__call__" + type(client.transport.delete_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.GoogleAdsLink() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_google_ads_link( - parent="parent_value", - google_ads_link=resources.GoogleAdsLink(name="name_value"), + client.delete_measurement_protocol_secret( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].google_ads_link - mock_val = resources.GoogleAdsLink(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_create_google_ads_link_flattened_error(): +def test_delete_measurement_protocol_secret_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -7126,50 +7248,43 @@ def test_create_google_ads_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_google_ads_link( - analytics_admin.CreateGoogleAdsLinkRequest(), - parent="parent_value", - google_ads_link=resources.GoogleAdsLink(name="name_value"), + client.delete_measurement_protocol_secret( + analytics_admin.DeleteMeasurementProtocolSecretRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_create_google_ads_link_flattened_async(): +async def test_delete_measurement_protocol_secret_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_google_ads_link), "__call__" + type(client.transport.delete_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.GoogleAdsLink() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GoogleAdsLink() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_google_ads_link( - parent="parent_value", - google_ads_link=resources.GoogleAdsLink(name="name_value"), + response = await client.delete_measurement_protocol_secret( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].google_ads_link - mock_val = resources.GoogleAdsLink(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_create_google_ads_link_flattened_error_async(): +async def test_delete_measurement_protocol_secret_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -7177,21 +7292,20 @@ async def test_create_google_ads_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_google_ads_link( - analytics_admin.CreateGoogleAdsLinkRequest(), - parent="parent_value", - google_ads_link=resources.GoogleAdsLink(name="name_value"), + await client.delete_measurement_protocol_secret( + analytics_admin.DeleteMeasurementProtocolSecretRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateGoogleAdsLinkRequest, + analytics_admin.UpdateMeasurementProtocolSecretRequest, dict, ], ) -def test_update_google_ads_link(request_type, transport: str = "grpc"): +def test_update_measurement_protocol_secret(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -7203,31 +7317,29 @@ def test_update_google_ads_link(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_google_ads_link), "__call__" + type(client.transport.update_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.GoogleAdsLink( + call.return_value = resources.MeasurementProtocolSecret( name="name_value", - customer_id="customer_id_value", - can_manage_clients=True, - creator_email_address="creator_email_address_value", + display_name="display_name_value", + secret_value="secret_value_value", ) - response = client.update_google_ads_link(request) + response = client.update_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateGoogleAdsLinkRequest() + assert args[0] == analytics_admin.UpdateMeasurementProtocolSecretRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.GoogleAdsLink) + assert isinstance(response, resources.MeasurementProtocolSecret) assert response.name == "name_value" - assert response.customer_id == "customer_id_value" - assert response.can_manage_clients is True - assert response.creator_email_address == "creator_email_address_value" + assert response.display_name == "display_name_value" + assert response.secret_value == "secret_value_value" -def test_update_google_ads_link_empty_call(): +def test_update_measurement_protocol_secret_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -7237,18 +7349,18 @@ def test_update_google_ads_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_google_ads_link), "__call__" + type(client.transport.update_measurement_protocol_secret), "__call__" ) as call: - client.update_google_ads_link() + client.update_measurement_protocol_secret() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateGoogleAdsLinkRequest() + assert args[0] == analytics_admin.UpdateMeasurementProtocolSecretRequest() @pytest.mark.asyncio -async def test_update_google_ads_link_async( +async def test_update_measurement_protocol_secret_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateGoogleAdsLinkRequest, + request_type=analytics_admin.UpdateMeasurementProtocolSecretRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7261,54 +7373,52 @@ async def test_update_google_ads_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_google_ads_link), "__call__" + type(client.transport.update_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GoogleAdsLink( + resources.MeasurementProtocolSecret( name="name_value", - customer_id="customer_id_value", - can_manage_clients=True, - creator_email_address="creator_email_address_value", + display_name="display_name_value", + secret_value="secret_value_value", ) ) - response = await client.update_google_ads_link(request) + response = await client.update_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateGoogleAdsLinkRequest() + assert args[0] == analytics_admin.UpdateMeasurementProtocolSecretRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.GoogleAdsLink) + assert isinstance(response, resources.MeasurementProtocolSecret) assert response.name == "name_value" - assert response.customer_id == "customer_id_value" - assert response.can_manage_clients is True - assert response.creator_email_address == "creator_email_address_value" + assert response.display_name == "display_name_value" + assert response.secret_value == "secret_value_value" @pytest.mark.asyncio -async def test_update_google_ads_link_async_from_dict(): - await test_update_google_ads_link_async(request_type=dict) +async def test_update_measurement_protocol_secret_async_from_dict(): + await test_update_measurement_protocol_secret_async(request_type=dict) -def test_update_google_ads_link_field_headers(): +def test_update_measurement_protocol_secret_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateGoogleAdsLinkRequest() + request = analytics_admin.UpdateMeasurementProtocolSecretRequest() - request.google_ads_link.name = "name_value" + request.measurement_protocol_secret.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_google_ads_link), "__call__" + type(client.transport.update_measurement_protocol_secret), "__call__" ) as call: - call.return_value = resources.GoogleAdsLink() - client.update_google_ads_link(request) + call.return_value = resources.MeasurementProtocolSecret() + client.update_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -7319,30 +7429,30 @@ def test_update_google_ads_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "google_ads_link.name=name_value", + "measurement_protocol_secret.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_google_ads_link_field_headers_async(): +async def test_update_measurement_protocol_secret_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateGoogleAdsLinkRequest() + request = analytics_admin.UpdateMeasurementProtocolSecretRequest() - request.google_ads_link.name = "name_value" + request.measurement_protocol_secret.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_google_ads_link), "__call__" + type(client.transport.update_measurement_protocol_secret), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GoogleAdsLink() + resources.MeasurementProtocolSecret() ) - await client.update_google_ads_link(request) + await client.update_measurement_protocol_secret(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -7353,25 +7463,27 @@ async def test_update_google_ads_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "google_ads_link.name=name_value", + "measurement_protocol_secret.name=name_value", ) in kw["metadata"] -def test_update_google_ads_link_flattened(): +def test_update_measurement_protocol_secret_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_google_ads_link), "__call__" + type(client.transport.update_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.GoogleAdsLink() + call.return_value = resources.MeasurementProtocolSecret() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_google_ads_link( - google_ads_link=resources.GoogleAdsLink(name="name_value"), + client.update_measurement_protocol_secret( + measurement_protocol_secret=resources.MeasurementProtocolSecret( + name="name_value" + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -7379,15 +7491,15 @@ def test_update_google_ads_link_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].google_ads_link - mock_val = resources.GoogleAdsLink(name="name_value") + arg = args[0].measurement_protocol_secret + mock_val = resources.MeasurementProtocolSecret(name="name_value") assert arg == mock_val arg = args[0].update_mask mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_update_google_ads_link_flattened_error(): +def test_update_measurement_protocol_secret_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -7395,33 +7507,37 @@ def test_update_google_ads_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_google_ads_link( - analytics_admin.UpdateGoogleAdsLinkRequest(), - google_ads_link=resources.GoogleAdsLink(name="name_value"), + client.update_measurement_protocol_secret( + analytics_admin.UpdateMeasurementProtocolSecretRequest(), + measurement_protocol_secret=resources.MeasurementProtocolSecret( + name="name_value" + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_update_google_ads_link_flattened_async(): +async def test_update_measurement_protocol_secret_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_google_ads_link), "__call__" + type(client.transport.update_measurement_protocol_secret), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.GoogleAdsLink() + call.return_value = resources.MeasurementProtocolSecret() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GoogleAdsLink() + resources.MeasurementProtocolSecret() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_google_ads_link( - google_ads_link=resources.GoogleAdsLink(name="name_value"), + response = await client.update_measurement_protocol_secret( + measurement_protocol_secret=resources.MeasurementProtocolSecret( + name="name_value" + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -7429,8 +7545,8 @@ async def test_update_google_ads_link_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].google_ads_link - mock_val = resources.GoogleAdsLink(name="name_value") + arg = args[0].measurement_protocol_secret + mock_val = resources.MeasurementProtocolSecret(name="name_value") assert arg == mock_val arg = args[0].update_mask mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) @@ -7438,7 +7554,7 @@ async def test_update_google_ads_link_flattened_async(): @pytest.mark.asyncio -async def test_update_google_ads_link_flattened_error_async(): +async def test_update_measurement_protocol_secret_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -7446,9 +7562,11 @@ async def test_update_google_ads_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_google_ads_link( - analytics_admin.UpdateGoogleAdsLinkRequest(), - google_ads_link=resources.GoogleAdsLink(name="name_value"), + await client.update_measurement_protocol_secret( + analytics_admin.UpdateMeasurementProtocolSecretRequest(), + measurement_protocol_secret=resources.MeasurementProtocolSecret( + name="name_value" + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -7456,11 +7574,11 @@ async def test_update_google_ads_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteGoogleAdsLinkRequest, + analytics_admin.AcknowledgeUserDataCollectionRequest, dict, ], ) -def test_delete_google_ads_link(request_type, transport: str = "grpc"): +def test_acknowledge_user_data_collection(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -7472,22 +7590,22 @@ def test_delete_google_ads_link(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_google_ads_link), "__call__" + type(client.transport.acknowledge_user_data_collection), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_google_ads_link(request) + call.return_value = analytics_admin.AcknowledgeUserDataCollectionResponse() + response = client.acknowledge_user_data_collection(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteGoogleAdsLinkRequest() + assert args[0] == analytics_admin.AcknowledgeUserDataCollectionRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, analytics_admin.AcknowledgeUserDataCollectionResponse) -def test_delete_google_ads_link_empty_call(): +def test_acknowledge_user_data_collection_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -7497,18 +7615,18 @@ def test_delete_google_ads_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_google_ads_link), "__call__" + type(client.transport.acknowledge_user_data_collection), "__call__" ) as call: - client.delete_google_ads_link() + client.acknowledge_user_data_collection() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteGoogleAdsLinkRequest() + assert args[0] == analytics_admin.AcknowledgeUserDataCollectionRequest() @pytest.mark.asyncio -async def test_delete_google_ads_link_async( +async def test_acknowledge_user_data_collection_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteGoogleAdsLinkRequest, + request_type=analytics_admin.AcknowledgeUserDataCollectionRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7521,43 +7639,45 @@ async def test_delete_google_ads_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_google_ads_link), "__call__" + type(client.transport.acknowledge_user_data_collection), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_google_ads_link(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.AcknowledgeUserDataCollectionResponse() + ) + response = await client.acknowledge_user_data_collection(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteGoogleAdsLinkRequest() + assert args[0] == analytics_admin.AcknowledgeUserDataCollectionRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, analytics_admin.AcknowledgeUserDataCollectionResponse) @pytest.mark.asyncio -async def test_delete_google_ads_link_async_from_dict(): - await test_delete_google_ads_link_async(request_type=dict) +async def test_acknowledge_user_data_collection_async_from_dict(): + await test_acknowledge_user_data_collection_async(request_type=dict) -def test_delete_google_ads_link_field_headers(): +def test_acknowledge_user_data_collection_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteGoogleAdsLinkRequest() + request = analytics_admin.AcknowledgeUserDataCollectionRequest() - request.name = "name_value" + request.property = "property_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_google_ads_link), "__call__" + type(client.transport.acknowledge_user_data_collection), "__call__" ) as call: - call.return_value = None - client.delete_google_ads_link(request) + call.return_value = analytics_admin.AcknowledgeUserDataCollectionResponse() + client.acknowledge_user_data_collection(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -7568,28 +7688,30 @@ def test_delete_google_ads_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "property=property_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_delete_google_ads_link_field_headers_async(): +async def test_acknowledge_user_data_collection_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteGoogleAdsLinkRequest() + request = analytics_admin.AcknowledgeUserDataCollectionRequest() - request.name = "name_value" + request.property = "property_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_google_ads_link), "__call__" + type(client.transport.acknowledge_user_data_collection), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_google_ads_link(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.AcknowledgeUserDataCollectionResponse() + ) + await client.acknowledge_user_data_collection(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -7600,132 +7722,52 @@ async def test_delete_google_ads_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "property=property_value", ) in kw["metadata"] -def test_delete_google_ads_link_flattened(): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, + dict, + ], +) +def test_get_sk_ad_network_conversion_value_schema( + request_type, transport: str = "grpc" +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_google_ads_link), "__call__" + type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_google_ads_link( + call.return_value = resources.SKAdNetworkConversionValueSchema( name="name_value", + apply_conversion_values=True, ) + response = client.get_sk_ad_network_conversion_value_schema(request) - # Establish that the underlying call was made with the expected - # request object values. + # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val + assert args[0] == analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() - -def test_delete_google_ads_link_flattened_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_google_ads_link( - analytics_admin.DeleteGoogleAdsLinkRequest(), - name="name_value", - ) - - -@pytest.mark.asyncio -async def test_delete_google_ads_link_flattened_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_google_ads_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = None - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_google_ads_link( - name="name_value", - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val - - -@pytest.mark.asyncio -async def test_delete_google_ads_link_flattened_error_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_google_ads_link( - analytics_admin.DeleteGoogleAdsLinkRequest(), - name="name_value", - ) - - -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.ListGoogleAdsLinksRequest, - dict, - ], -) -def test_list_google_ads_links(request_type, transport: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_google_ads_links), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListGoogleAdsLinksResponse( - next_page_token="next_page_token_value", - ) - response = client.list_google_ads_links(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListGoogleAdsLinksRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListGoogleAdsLinksPager) - assert response.next_page_token == "next_page_token_value" + # Establish that the response is the type that we expect. + assert isinstance(response, resources.SKAdNetworkConversionValueSchema) + assert response.name == "name_value" + assert response.apply_conversion_values is True -def test_list_google_ads_links_empty_call(): +def test_get_sk_ad_network_conversion_value_schema_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -7735,18 +7777,18 @@ def test_list_google_ads_links_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_google_ads_links), "__call__" + type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" ) as call: - client.list_google_ads_links() + client.get_sk_ad_network_conversion_value_schema() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListGoogleAdsLinksRequest() + assert args[0] == analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() @pytest.mark.asyncio -async def test_list_google_ads_links_async( +async def test_get_sk_ad_network_conversion_value_schema_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListGoogleAdsLinksRequest, + request_type=analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -7759,48 +7801,50 @@ async def test_list_google_ads_links_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_google_ads_links), "__call__" + type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListGoogleAdsLinksResponse( - next_page_token="next_page_token_value", + resources.SKAdNetworkConversionValueSchema( + name="name_value", + apply_conversion_values=True, ) ) - response = await client.list_google_ads_links(request) + response = await client.get_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListGoogleAdsLinksRequest() + assert args[0] == analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListGoogleAdsLinksAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.SKAdNetworkConversionValueSchema) + assert response.name == "name_value" + assert response.apply_conversion_values is True @pytest.mark.asyncio -async def test_list_google_ads_links_async_from_dict(): - await test_list_google_ads_links_async(request_type=dict) +async def test_get_sk_ad_network_conversion_value_schema_async_from_dict(): + await test_get_sk_ad_network_conversion_value_schema_async(request_type=dict) -def test_list_google_ads_links_field_headers(): +def test_get_sk_ad_network_conversion_value_schema_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListGoogleAdsLinksRequest() + request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_google_ads_links), "__call__" + type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" ) as call: - call.return_value = analytics_admin.ListGoogleAdsLinksResponse() - client.list_google_ads_links(request) + call.return_value = resources.SKAdNetworkConversionValueSchema() + client.get_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -7811,30 +7855,30 @@ def test_list_google_ads_links_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_google_ads_links_field_headers_async(): +async def test_get_sk_ad_network_conversion_value_schema_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListGoogleAdsLinksRequest() + request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_google_ads_links), "__call__" + type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListGoogleAdsLinksResponse() + resources.SKAdNetworkConversionValueSchema() ) - await client.list_google_ads_links(request) + await client.get_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -7845,37 +7889,37 @@ async def test_list_google_ads_links_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_list_google_ads_links_flattened(): +def test_get_sk_ad_network_conversion_value_schema_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_google_ads_links), "__call__" + type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListGoogleAdsLinksResponse() + call.return_value = resources.SKAdNetworkConversionValueSchema() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_google_ads_links( - parent="parent_value", + client.get_sk_ad_network_conversion_value_schema( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_list_google_ads_links_flattened_error(): +def test_get_sk_ad_network_conversion_value_schema_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -7883,45 +7927,45 @@ def test_list_google_ads_links_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_google_ads_links( - analytics_admin.ListGoogleAdsLinksRequest(), - parent="parent_value", + client.get_sk_ad_network_conversion_value_schema( + analytics_admin.GetSKAdNetworkConversionValueSchemaRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_list_google_ads_links_flattened_async(): +async def test_get_sk_ad_network_conversion_value_schema_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_google_ads_links), "__call__" + type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListGoogleAdsLinksResponse() + call.return_value = resources.SKAdNetworkConversionValueSchema() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListGoogleAdsLinksResponse() + resources.SKAdNetworkConversionValueSchema() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_google_ads_links( - parent="parent_value", + response = await client.get_sk_ad_network_conversion_value_schema( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_list_google_ads_links_flattened_error_async(): +async def test_get_sk_ad_network_conversion_value_schema_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -7929,218 +7973,22 @@ async def test_list_google_ads_links_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_google_ads_links( - analytics_admin.ListGoogleAdsLinksRequest(), - parent="parent_value", - ) - - -def test_list_google_ads_links_pager(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_google_ads_links), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[], - next_page_token="def", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_google_ads_links(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.GoogleAdsLink) for i in results) - - -def test_list_google_ads_links_pages(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_google_ads_links), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[], - next_page_token="def", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - ], - ), - RuntimeError, - ) - pages = list(client.list_google_ads_links(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_google_ads_links_async_pager(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_google_ads_links), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[], - next_page_token="def", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_google_ads_links( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.GoogleAdsLink) for i in responses) - - -@pytest.mark.asyncio -async def test_list_google_ads_links_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_google_ads_links), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[], - next_page_token="def", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - ], - ), - RuntimeError, + await client.get_sk_ad_network_conversion_value_schema( + analytics_admin.GetSKAdNetworkConversionValueSchemaRequest(), + name="name_value", ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_google_ads_links(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataSharingSettingsRequest, + analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, dict, ], ) -def test_get_data_sharing_settings(request_type, transport: str = "grpc"): +def test_create_sk_ad_network_conversion_value_schema( + request_type, transport: str = "grpc" +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -8152,35 +8000,29 @@ def test_get_data_sharing_settings(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_data_sharing_settings), "__call__" + type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataSharingSettings( + call.return_value = resources.SKAdNetworkConversionValueSchema( name="name_value", - sharing_with_google_support_enabled=True, - sharing_with_google_assigned_sales_enabled=True, - sharing_with_google_any_sales_enabled=True, - sharing_with_google_products_enabled=True, - sharing_with_others_enabled=True, + apply_conversion_values=True, ) - response = client.get_data_sharing_settings(request) + response = client.create_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataSharingSettingsRequest() + assert ( + args[0] == analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataSharingSettings) + assert isinstance(response, resources.SKAdNetworkConversionValueSchema) assert response.name == "name_value" - assert response.sharing_with_google_support_enabled is True - assert response.sharing_with_google_assigned_sales_enabled is True - assert response.sharing_with_google_any_sales_enabled is True - assert response.sharing_with_google_products_enabled is True - assert response.sharing_with_others_enabled is True + assert response.apply_conversion_values is True -def test_get_data_sharing_settings_empty_call(): +def test_create_sk_ad_network_conversion_value_schema_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -8190,18 +8032,20 @@ def test_get_data_sharing_settings_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_data_sharing_settings), "__call__" + type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" ) as call: - client.get_data_sharing_settings() + client.create_sk_ad_network_conversion_value_schema() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataSharingSettingsRequest() + assert ( + args[0] == analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() + ) @pytest.mark.asyncio -async def test_get_data_sharing_settings_async( +async def test_create_sk_ad_network_conversion_value_schema_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetDataSharingSettingsRequest, + request_type=analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8214,58 +8058,52 @@ async def test_get_data_sharing_settings_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_data_sharing_settings), "__call__" + type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataSharingSettings( + resources.SKAdNetworkConversionValueSchema( name="name_value", - sharing_with_google_support_enabled=True, - sharing_with_google_assigned_sales_enabled=True, - sharing_with_google_any_sales_enabled=True, - sharing_with_google_products_enabled=True, - sharing_with_others_enabled=True, + apply_conversion_values=True, ) ) - response = await client.get_data_sharing_settings(request) + response = await client.create_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataSharingSettingsRequest() + assert ( + args[0] == analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataSharingSettings) + assert isinstance(response, resources.SKAdNetworkConversionValueSchema) assert response.name == "name_value" - assert response.sharing_with_google_support_enabled is True - assert response.sharing_with_google_assigned_sales_enabled is True - assert response.sharing_with_google_any_sales_enabled is True - assert response.sharing_with_google_products_enabled is True - assert response.sharing_with_others_enabled is True + assert response.apply_conversion_values is True @pytest.mark.asyncio -async def test_get_data_sharing_settings_async_from_dict(): - await test_get_data_sharing_settings_async(request_type=dict) +async def test_create_sk_ad_network_conversion_value_schema_async_from_dict(): + await test_create_sk_ad_network_conversion_value_schema_async(request_type=dict) -def test_get_data_sharing_settings_field_headers(): +def test_create_sk_ad_network_conversion_value_schema_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetDataSharingSettingsRequest() + request = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_data_sharing_settings), "__call__" + type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" ) as call: - call.return_value = resources.DataSharingSettings() - client.get_data_sharing_settings(request) + call.return_value = resources.SKAdNetworkConversionValueSchema() + client.create_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -8276,30 +8114,30 @@ def test_get_data_sharing_settings_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_data_sharing_settings_field_headers_async(): +async def test_create_sk_ad_network_conversion_value_schema_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetDataSharingSettingsRequest() + request = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_data_sharing_settings), "__call__" + type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataSharingSettings() + resources.SKAdNetworkConversionValueSchema() ) - await client.get_data_sharing_settings(request) + await client.create_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -8310,37 +8148,43 @@ async def test_get_data_sharing_settings_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_data_sharing_settings_flattened(): +def test_create_sk_ad_network_conversion_value_schema_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_data_sharing_settings), "__call__" + type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataSharingSettings() + call.return_value = resources.SKAdNetworkConversionValueSchema() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_data_sharing_settings( - name="name_value", + client.create_sk_ad_network_conversion_value_schema( + parent="parent_value", + skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( + name="name_value" + ), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].skadnetwork_conversion_value_schema + mock_val = resources.SKAdNetworkConversionValueSchema(name="name_value") + assert arg == mock_val -def test_get_data_sharing_settings_flattened_error(): +def test_create_sk_ad_network_conversion_value_schema_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -8348,45 +8192,54 @@ def test_get_data_sharing_settings_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_data_sharing_settings( - analytics_admin.GetDataSharingSettingsRequest(), - name="name_value", + client.create_sk_ad_network_conversion_value_schema( + analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest(), + parent="parent_value", + skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( + name="name_value" + ), ) @pytest.mark.asyncio -async def test_get_data_sharing_settings_flattened_async(): +async def test_create_sk_ad_network_conversion_value_schema_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_data_sharing_settings), "__call__" + type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataSharingSettings() + call.return_value = resources.SKAdNetworkConversionValueSchema() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataSharingSettings() + resources.SKAdNetworkConversionValueSchema() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_data_sharing_settings( - name="name_value", + response = await client.create_sk_ad_network_conversion_value_schema( + parent="parent_value", + skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( + name="name_value" + ), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].skadnetwork_conversion_value_schema + mock_val = resources.SKAdNetworkConversionValueSchema(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_get_data_sharing_settings_flattened_error_async(): +async def test_create_sk_ad_network_conversion_value_schema_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -8394,20 +8247,25 @@ async def test_get_data_sharing_settings_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_data_sharing_settings( - analytics_admin.GetDataSharingSettingsRequest(), - name="name_value", + await client.create_sk_ad_network_conversion_value_schema( + analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest(), + parent="parent_value", + skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( + name="name_value" + ), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetMeasurementProtocolSecretRequest, + analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, dict, ], ) -def test_get_measurement_protocol_secret(request_type, transport: str = "grpc"): +def test_delete_sk_ad_network_conversion_value_schema( + request_type, transport: str = "grpc" +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -8419,29 +8277,24 @@ def test_get_measurement_protocol_secret(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_measurement_protocol_secret), "__call__" + type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.MeasurementProtocolSecret( - name="name_value", - display_name="display_name_value", - secret_value="secret_value_value", - ) - response = client.get_measurement_protocol_secret(request) + call.return_value = None + response = client.delete_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetMeasurementProtocolSecretRequest() + assert ( + args[0] == analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, resources.MeasurementProtocolSecret) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.secret_value == "secret_value_value" + assert response is None -def test_get_measurement_protocol_secret_empty_call(): +def test_delete_sk_ad_network_conversion_value_schema_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -8451,18 +8304,20 @@ def test_get_measurement_protocol_secret_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_measurement_protocol_secret), "__call__" + type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" ) as call: - client.get_measurement_protocol_secret() + client.delete_sk_ad_network_conversion_value_schema() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetMeasurementProtocolSecretRequest() + assert ( + args[0] == analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() + ) @pytest.mark.asyncio -async def test_get_measurement_protocol_secret_async( +async def test_delete_sk_ad_network_conversion_value_schema_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetMeasurementProtocolSecretRequest, + request_type=analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8475,52 +8330,45 @@ async def test_get_measurement_protocol_secret_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_measurement_protocol_secret), "__call__" + type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.MeasurementProtocolSecret( - name="name_value", - display_name="display_name_value", - secret_value="secret_value_value", - ) - ) - response = await client.get_measurement_protocol_secret(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetMeasurementProtocolSecretRequest() + assert ( + args[0] == analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, resources.MeasurementProtocolSecret) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.secret_value == "secret_value_value" + assert response is None @pytest.mark.asyncio -async def test_get_measurement_protocol_secret_async_from_dict(): - await test_get_measurement_protocol_secret_async(request_type=dict) +async def test_delete_sk_ad_network_conversion_value_schema_async_from_dict(): + await test_delete_sk_ad_network_conversion_value_schema_async(request_type=dict) -def test_get_measurement_protocol_secret_field_headers(): +def test_delete_sk_ad_network_conversion_value_schema_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetMeasurementProtocolSecretRequest() + request = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_measurement_protocol_secret), "__call__" + type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" ) as call: - call.return_value = resources.MeasurementProtocolSecret() - client.get_measurement_protocol_secret(request) + call.return_value = None + client.delete_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -8536,25 +8384,23 @@ def test_get_measurement_protocol_secret_field_headers(): @pytest.mark.asyncio -async def test_get_measurement_protocol_secret_field_headers_async(): +async def test_delete_sk_ad_network_conversion_value_schema_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetMeasurementProtocolSecretRequest() + request = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_measurement_protocol_secret), "__call__" + type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.MeasurementProtocolSecret() - ) - await client.get_measurement_protocol_secret(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -8569,20 +8415,20 @@ async def test_get_measurement_protocol_secret_field_headers_async(): ) in kw["metadata"] -def test_get_measurement_protocol_secret_flattened(): +def test_delete_sk_ad_network_conversion_value_schema_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_measurement_protocol_secret), "__call__" + type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.MeasurementProtocolSecret() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_measurement_protocol_secret( + client.delete_sk_ad_network_conversion_value_schema( name="name_value", ) @@ -8595,7 +8441,7 @@ def test_get_measurement_protocol_secret_flattened(): assert arg == mock_val -def test_get_measurement_protocol_secret_flattened_error(): +def test_delete_sk_ad_network_conversion_value_schema_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -8603,31 +8449,29 @@ def test_get_measurement_protocol_secret_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_measurement_protocol_secret( - analytics_admin.GetMeasurementProtocolSecretRequest(), + client.delete_sk_ad_network_conversion_value_schema( + analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_get_measurement_protocol_secret_flattened_async(): +async def test_delete_sk_ad_network_conversion_value_schema_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_measurement_protocol_secret), "__call__" + type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.MeasurementProtocolSecret() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.MeasurementProtocolSecret() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_measurement_protocol_secret( + response = await client.delete_sk_ad_network_conversion_value_schema( name="name_value", ) @@ -8641,7 +8485,7 @@ async def test_get_measurement_protocol_secret_flattened_async(): @pytest.mark.asyncio -async def test_get_measurement_protocol_secret_flattened_error_async(): +async def test_delete_sk_ad_network_conversion_value_schema_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -8649,8 +8493,8 @@ async def test_get_measurement_protocol_secret_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_measurement_protocol_secret( - analytics_admin.GetMeasurementProtocolSecretRequest(), + await client.delete_sk_ad_network_conversion_value_schema( + analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest(), name="name_value", ) @@ -8658,11 +8502,13 @@ async def test_get_measurement_protocol_secret_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListMeasurementProtocolSecretsRequest, + analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, dict, ], ) -def test_list_measurement_protocol_secrets(request_type, transport: str = "grpc"): +def test_update_sk_ad_network_conversion_value_schema( + request_type, transport: str = "grpc" +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -8674,25 +8520,29 @@ def test_list_measurement_protocol_secrets(request_type, transport: str = "grpc" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_measurement_protocol_secrets), "__call__" + type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListMeasurementProtocolSecretsResponse( - next_page_token="next_page_token_value", + call.return_value = resources.SKAdNetworkConversionValueSchema( + name="name_value", + apply_conversion_values=True, ) - response = client.list_measurement_protocol_secrets(request) + response = client.update_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListMeasurementProtocolSecretsRequest() + assert ( + args[0] == analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListMeasurementProtocolSecretsPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.SKAdNetworkConversionValueSchema) + assert response.name == "name_value" + assert response.apply_conversion_values is True -def test_list_measurement_protocol_secrets_empty_call(): +def test_update_sk_ad_network_conversion_value_schema_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -8702,18 +8552,20 @@ def test_list_measurement_protocol_secrets_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_measurement_protocol_secrets), "__call__" + type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" ) as call: - client.list_measurement_protocol_secrets() + client.update_sk_ad_network_conversion_value_schema() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListMeasurementProtocolSecretsRequest() + assert ( + args[0] == analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() + ) @pytest.mark.asyncio -async def test_list_measurement_protocol_secrets_async( +async def test_update_sk_ad_network_conversion_value_schema_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListMeasurementProtocolSecretsRequest, + request_type=analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -8726,48 +8578,52 @@ async def test_list_measurement_protocol_secrets_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_measurement_protocol_secrets), "__call__" + type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListMeasurementProtocolSecretsResponse( - next_page_token="next_page_token_value", + resources.SKAdNetworkConversionValueSchema( + name="name_value", + apply_conversion_values=True, ) ) - response = await client.list_measurement_protocol_secrets(request) + response = await client.update_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListMeasurementProtocolSecretsRequest() + assert ( + args[0] == analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListMeasurementProtocolSecretsAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.SKAdNetworkConversionValueSchema) + assert response.name == "name_value" + assert response.apply_conversion_values is True @pytest.mark.asyncio -async def test_list_measurement_protocol_secrets_async_from_dict(): - await test_list_measurement_protocol_secrets_async(request_type=dict) +async def test_update_sk_ad_network_conversion_value_schema_async_from_dict(): + await test_update_sk_ad_network_conversion_value_schema_async(request_type=dict) -def test_list_measurement_protocol_secrets_field_headers(): +def test_update_sk_ad_network_conversion_value_schema_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListMeasurementProtocolSecretsRequest() + request = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() - request.parent = "parent_value" + request.skadnetwork_conversion_value_schema.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_measurement_protocol_secrets), "__call__" + type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" ) as call: - call.return_value = analytics_admin.ListMeasurementProtocolSecretsResponse() - client.list_measurement_protocol_secrets(request) + call.return_value = resources.SKAdNetworkConversionValueSchema() + client.update_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -8778,30 +8634,30 @@ def test_list_measurement_protocol_secrets_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "skadnetwork_conversion_value_schema.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_measurement_protocol_secrets_field_headers_async(): +async def test_update_sk_ad_network_conversion_value_schema_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListMeasurementProtocolSecretsRequest() + request = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() - request.parent = "parent_value" + request.skadnetwork_conversion_value_schema.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_measurement_protocol_secrets), "__call__" + type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListMeasurementProtocolSecretsResponse() + resources.SKAdNetworkConversionValueSchema() ) - await client.list_measurement_protocol_secrets(request) + await client.update_sk_ad_network_conversion_value_schema(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -8812,37 +8668,43 @@ async def test_list_measurement_protocol_secrets_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "skadnetwork_conversion_value_schema.name=name_value", ) in kw["metadata"] -def test_list_measurement_protocol_secrets_flattened(): +def test_update_sk_ad_network_conversion_value_schema_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_measurement_protocol_secrets), "__call__" + type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListMeasurementProtocolSecretsResponse() + call.return_value = resources.SKAdNetworkConversionValueSchema() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_measurement_protocol_secrets( - parent="parent_value", + client.update_sk_ad_network_conversion_value_schema( + skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].skadnetwork_conversion_value_schema + mock_val = resources.SKAdNetworkConversionValueSchema(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_list_measurement_protocol_secrets_flattened_error(): +def test_update_sk_ad_network_conversion_value_schema_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -8850,45 +8712,54 @@ def test_list_measurement_protocol_secrets_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_measurement_protocol_secrets( - analytics_admin.ListMeasurementProtocolSecretsRequest(), - parent="parent_value", + client.update_sk_ad_network_conversion_value_schema( + analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest(), + skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_list_measurement_protocol_secrets_flattened_async(): +async def test_update_sk_ad_network_conversion_value_schema_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_measurement_protocol_secrets), "__call__" + type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListMeasurementProtocolSecretsResponse() + call.return_value = resources.SKAdNetworkConversionValueSchema() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListMeasurementProtocolSecretsResponse() + resources.SKAdNetworkConversionValueSchema() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_measurement_protocol_secrets( - parent="parent_value", + response = await client.update_sk_ad_network_conversion_value_schema( + skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].skadnetwork_conversion_value_schema + mock_val = resources.SKAdNetworkConversionValueSchema(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val @pytest.mark.asyncio -async def test_list_measurement_protocol_secrets_flattened_error_async(): +async def test_update_sk_ad_network_conversion_value_schema_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -8896,333 +8767,134 @@ async def test_list_measurement_protocol_secrets_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_measurement_protocol_secrets( - analytics_admin.ListMeasurementProtocolSecretsRequest(), - parent="parent_value", + await client.update_sk_ad_network_conversion_value_schema( + analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest(), + skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_list_measurement_protocol_secrets_pager(transport_name: str = "grpc"): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, + dict, + ], +) +def test_list_sk_ad_network_conversion_value_schemas( + request_type, transport: str = "grpc" +): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_measurement_protocol_secrets), "__call__" + type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - ], - next_page_token="abc", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[], - next_page_token="def", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - ], - next_page_token="ghi", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + # Designate an appropriate return value for the call. + call.return_value = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + next_page_token="next_page_token_value", + ) ) - pager = client.list_measurement_protocol_secrets(request={}) + response = client.list_sk_ad_network_conversion_value_schemas(request) - assert pager._metadata == metadata + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.MeasurementProtocolSecret) for i in results) + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListSKAdNetworkConversionValueSchemasPager) + assert response.next_page_token == "next_page_token_value" -def test_list_measurement_protocol_secrets_pages(transport_name: str = "grpc"): +def test_list_sk_ad_network_conversion_value_schemas_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_measurement_protocol_secrets), "__call__" + type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - ], - next_page_token="abc", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[], - next_page_token="def", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - ], - next_page_token="ghi", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - ], - ), - RuntimeError, - ) - pages = list(client.list_measurement_protocol_secrets(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token + client.list_sk_ad_network_conversion_value_schemas() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() @pytest.mark.asyncio -async def test_list_measurement_protocol_secrets_async_pager(): +async def test_list_sk_ad_network_conversion_value_schemas_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, +): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_measurement_protocol_secrets), - "__call__", - new_callable=mock.AsyncMock, + type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - ], - next_page_token="abc", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[], - next_page_token="def", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - ], - next_page_token="ghi", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_measurement_protocol_secrets( - request={}, + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + next_page_token="next_page_token_value", + ) ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) + response = await client.list_sk_ad_network_conversion_value_schemas(request) - assert len(responses) == 6 - assert all( - isinstance(i, resources.MeasurementProtocolSecret) for i in responses - ) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListSKAdNetworkConversionValueSchemasAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_list_measurement_protocol_secrets_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_measurement_protocol_secrets), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - ], - next_page_token="abc", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[], - next_page_token="def", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - ], - next_page_token="ghi", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_measurement_protocol_secrets(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.CreateMeasurementProtocolSecretRequest, - dict, - ], -) -def test_create_measurement_protocol_secret(request_type, transport: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_measurement_protocol_secret), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.MeasurementProtocolSecret( - name="name_value", - display_name="display_name_value", - secret_value="secret_value_value", - ) - response = client.create_measurement_protocol_secret(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateMeasurementProtocolSecretRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, resources.MeasurementProtocolSecret) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.secret_value == "secret_value_value" - - -def test_create_measurement_protocol_secret_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_measurement_protocol_secret), "__call__" - ) as call: - client.create_measurement_protocol_secret() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateMeasurementProtocolSecretRequest() - - -@pytest.mark.asyncio -async def test_create_measurement_protocol_secret_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateMeasurementProtocolSecretRequest, -): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_measurement_protocol_secret), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.MeasurementProtocolSecret( - name="name_value", - display_name="display_name_value", - secret_value="secret_value_value", - ) - ) - response = await client.create_measurement_protocol_secret(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateMeasurementProtocolSecretRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, resources.MeasurementProtocolSecret) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.secret_value == "secret_value_value" - - -@pytest.mark.asyncio -async def test_create_measurement_protocol_secret_async_from_dict(): - await test_create_measurement_protocol_secret_async(request_type=dict) +async def test_list_sk_ad_network_conversion_value_schemas_async_from_dict(): + await test_list_sk_ad_network_conversion_value_schemas_async(request_type=dict) -def test_create_measurement_protocol_secret_field_headers(): +def test_list_sk_ad_network_conversion_value_schemas_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateMeasurementProtocolSecretRequest() + request = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_measurement_protocol_secret), "__call__" + type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" ) as call: - call.return_value = resources.MeasurementProtocolSecret() - client.create_measurement_protocol_secret(request) + call.return_value = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() + ) + client.list_sk_ad_network_conversion_value_schemas(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -9238,25 +8910,25 @@ def test_create_measurement_protocol_secret_field_headers(): @pytest.mark.asyncio -async def test_create_measurement_protocol_secret_field_headers_async(): +async def test_list_sk_ad_network_conversion_value_schemas_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateMeasurementProtocolSecretRequest() + request = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_measurement_protocol_secret), "__call__" + type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.MeasurementProtocolSecret() + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() ) - await client.create_measurement_protocol_secret(request) + await client.list_sk_ad_network_conversion_value_schemas(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -9271,24 +8943,23 @@ async def test_create_measurement_protocol_secret_field_headers_async(): ) in kw["metadata"] -def test_create_measurement_protocol_secret_flattened(): +def test_list_sk_ad_network_conversion_value_schemas_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_measurement_protocol_secret), "__call__" + type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.MeasurementProtocolSecret() + call.return_value = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_measurement_protocol_secret( + client.list_sk_ad_network_conversion_value_schemas( parent="parent_value", - measurement_protocol_secret=resources.MeasurementProtocolSecret( - name="name_value" - ), ) # Establish that the underlying call was made with the expected @@ -9298,12 +8969,9 @@ def test_create_measurement_protocol_secret_flattened(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].measurement_protocol_secret - mock_val = resources.MeasurementProtocolSecret(name="name_value") - assert arg == mock_val -def test_create_measurement_protocol_secret_flattened_error(): +def test_list_sk_ad_network_conversion_value_schemas_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -9311,38 +8979,34 @@ def test_create_measurement_protocol_secret_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_measurement_protocol_secret( - analytics_admin.CreateMeasurementProtocolSecretRequest(), + client.list_sk_ad_network_conversion_value_schemas( + analytics_admin.ListSKAdNetworkConversionValueSchemasRequest(), parent="parent_value", - measurement_protocol_secret=resources.MeasurementProtocolSecret( - name="name_value" - ), ) @pytest.mark.asyncio -async def test_create_measurement_protocol_secret_flattened_async(): +async def test_list_sk_ad_network_conversion_value_schemas_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_measurement_protocol_secret), "__call__" + type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.MeasurementProtocolSecret() + call.return_value = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() + ) call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.MeasurementProtocolSecret() + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_measurement_protocol_secret( + response = await client.list_sk_ad_network_conversion_value_schemas( parent="parent_value", - measurement_protocol_secret=resources.MeasurementProtocolSecret( - name="name_value" - ), ) # Establish that the underlying call was made with the expected @@ -9352,13 +9016,10 @@ async def test_create_measurement_protocol_secret_flattened_async(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].measurement_protocol_secret - mock_val = resources.MeasurementProtocolSecret(name="name_value") - assert arg == mock_val @pytest.mark.asyncio -async def test_create_measurement_protocol_secret_flattened_error_async(): +async def test_list_sk_ad_network_conversion_value_schemas_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -9366,23 +9027,228 @@ async def test_create_measurement_protocol_secret_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_measurement_protocol_secret( - analytics_admin.CreateMeasurementProtocolSecretRequest(), + await client.list_sk_ad_network_conversion_value_schemas( + analytics_admin.ListSKAdNetworkConversionValueSchemasRequest(), parent="parent_value", - measurement_protocol_secret=resources.MeasurementProtocolSecret( - name="name_value" + ) + + +def test_list_sk_ad_network_conversion_value_schemas_pager( + transport_name: str = "grpc", +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + ], + next_page_token="abc", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[], + next_page_token="def", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + ], + next_page_token="ghi", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_sk_ad_network_conversion_value_schemas(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all( + isinstance(i, resources.SKAdNetworkConversionValueSchema) for i in results + ) + + +def test_list_sk_ad_network_conversion_value_schemas_pages( + transport_name: str = "grpc", +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + ], + next_page_token="abc", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[], + next_page_token="def", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + ], + next_page_token="ghi", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + ], + ), + RuntimeError, + ) + pages = list( + client.list_sk_ad_network_conversion_value_schemas(request={}).pages + ) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_sk_ad_network_conversion_value_schemas_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_sk_ad_network_conversion_value_schemas), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + ], + next_page_token="abc", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[], + next_page_token="def", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + ], + next_page_token="ghi", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_sk_ad_network_conversion_value_schemas( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all( + isinstance(i, resources.SKAdNetworkConversionValueSchema) for i in responses + ) + + +@pytest.mark.asyncio +async def test_list_sk_ad_network_conversion_value_schemas_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_sk_ad_network_conversion_value_schemas), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + ], + next_page_token="abc", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[], + next_page_token="def", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + ], + next_page_token="ghi", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + ], ), + RuntimeError, ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_sk_ad_network_conversion_value_schemas(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteMeasurementProtocolSecretRequest, + analytics_admin.SearchChangeHistoryEventsRequest, dict, ], ) -def test_delete_measurement_protocol_secret(request_type, transport: str = "grpc"): +def test_search_change_history_events(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -9394,22 +9260,25 @@ def test_delete_measurement_protocol_secret(request_type, transport: str = "grpc # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_measurement_protocol_secret), "__call__" + type(client.transport.search_change_history_events), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_measurement_protocol_secret(request) + call.return_value = analytics_admin.SearchChangeHistoryEventsResponse( + next_page_token="next_page_token_value", + ) + response = client.search_change_history_events(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteMeasurementProtocolSecretRequest() + assert args[0] == analytics_admin.SearchChangeHistoryEventsRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, pagers.SearchChangeHistoryEventsPager) + assert response.next_page_token == "next_page_token_value" -def test_delete_measurement_protocol_secret_empty_call(): +def test_search_change_history_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -9419,18 +9288,18 @@ def test_delete_measurement_protocol_secret_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_measurement_protocol_secret), "__call__" + type(client.transport.search_change_history_events), "__call__" ) as call: - client.delete_measurement_protocol_secret() + client.search_change_history_events() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteMeasurementProtocolSecretRequest() + assert args[0] == analytics_admin.SearchChangeHistoryEventsRequest() @pytest.mark.asyncio -async def test_delete_measurement_protocol_secret_async( +async def test_search_change_history_events_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteMeasurementProtocolSecretRequest, + request_type=analytics_admin.SearchChangeHistoryEventsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9443,43 +9312,48 @@ async def test_delete_measurement_protocol_secret_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_measurement_protocol_secret), "__call__" + type(client.transport.search_change_history_events), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_measurement_protocol_secret(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.SearchChangeHistoryEventsResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.search_change_history_events(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteMeasurementProtocolSecretRequest() + assert args[0] == analytics_admin.SearchChangeHistoryEventsRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, pagers.SearchChangeHistoryEventsAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_delete_measurement_protocol_secret_async_from_dict(): - await test_delete_measurement_protocol_secret_async(request_type=dict) +async def test_search_change_history_events_async_from_dict(): + await test_search_change_history_events_async(request_type=dict) -def test_delete_measurement_protocol_secret_field_headers(): +def test_search_change_history_events_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteMeasurementProtocolSecretRequest() + request = analytics_admin.SearchChangeHistoryEventsRequest() - request.name = "name_value" + request.account = "account_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_measurement_protocol_secret), "__call__" + type(client.transport.search_change_history_events), "__call__" ) as call: - call.return_value = None - client.delete_measurement_protocol_secret(request) + call.return_value = analytics_admin.SearchChangeHistoryEventsResponse() + client.search_change_history_events(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -9490,28 +9364,30 @@ def test_delete_measurement_protocol_secret_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "account=account_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_delete_measurement_protocol_secret_field_headers_async(): +async def test_search_change_history_events_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteMeasurementProtocolSecretRequest() + request = analytics_admin.SearchChangeHistoryEventsRequest() - request.name = "name_value" + request.account = "account_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_measurement_protocol_secret), "__call__" + type(client.transport.search_change_history_events), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_measurement_protocol_secret(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.SearchChangeHistoryEventsResponse() + ) + await client.search_change_history_events(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -9522,102 +9398,216 @@ async def test_delete_measurement_protocol_secret_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "account=account_value", ) in kw["metadata"] -def test_delete_measurement_protocol_secret_flattened(): +def test_search_change_history_events_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_measurement_protocol_secret), "__call__" + type(client.transport.search_change_history_events), "__call__" ) as call: - # Designate an appropriate return value for the call. - call.return_value = None - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_measurement_protocol_secret( - name="name_value", + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + ], + next_page_token="abc", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[], + next_page_token="def", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + ], + next_page_token="ghi", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + ], + ), + RuntimeError, ) - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("account", ""),)), + ) + pager = client.search_change_history_events(request={}) + assert pager._metadata == metadata -def test_delete_measurement_protocol_secret_flattened_error(): + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.ChangeHistoryEvent) for i in results) + + +def test_search_change_history_events_pages(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_measurement_protocol_secret( - analytics_admin.DeleteMeasurementProtocolSecretRequest(), - name="name_value", + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.search_change_history_events), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + ], + next_page_token="abc", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[], + next_page_token="def", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + ], + next_page_token="ghi", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + ], + ), + RuntimeError, ) + pages = list(client.search_change_history_events(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_delete_measurement_protocol_secret_flattened_async(): +async def test_search_change_history_events_async_pager(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_measurement_protocol_secret), "__call__" + type(client.transport.search_change_history_events), + "__call__", + new_callable=mock.AsyncMock, ) as call: - # Designate an appropriate return value for the call. - call.return_value = None - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_measurement_protocol_secret( - name="name_value", + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + ], + next_page_token="abc", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[], + next_page_token="def", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + ], + next_page_token="ghi", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + ], + ), + RuntimeError, + ) + async_pager = await client.search_change_history_events( + request={}, ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val + assert len(responses) == 6 + assert all(isinstance(i, resources.ChangeHistoryEvent) for i in responses) @pytest.mark.asyncio -async def test_delete_measurement_protocol_secret_flattened_error_async(): +async def test_search_change_history_events_async_pages(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials, ) - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_measurement_protocol_secret( - analytics_admin.DeleteMeasurementProtocolSecretRequest(), - name="name_value", + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.search_change_history_events), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + ], + next_page_token="abc", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[], + next_page_token="def", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + ], + next_page_token="ghi", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + ], + ), + RuntimeError, ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.search_change_history_events(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateMeasurementProtocolSecretRequest, + analytics_admin.GetGoogleSignalsSettingsRequest, dict, ], ) -def test_update_measurement_protocol_secret(request_type, transport: str = "grpc"): +def test_get_google_signals_settings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -9629,29 +9619,32 @@ def test_update_measurement_protocol_secret(request_type, transport: str = "grpc # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_measurement_protocol_secret), "__call__" + type(client.transport.get_google_signals_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.MeasurementProtocolSecret( + call.return_value = resources.GoogleSignalsSettings( name="name_value", - display_name="display_name_value", - secret_value="secret_value_value", + state=resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED, + consent=resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED, ) - response = client.update_measurement_protocol_secret(request) + response = client.get_google_signals_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateMeasurementProtocolSecretRequest() + assert args[0] == analytics_admin.GetGoogleSignalsSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.MeasurementProtocolSecret) + assert isinstance(response, resources.GoogleSignalsSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.secret_value == "secret_value_value" + assert response.state == resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED + assert ( + response.consent + == resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED + ) -def test_update_measurement_protocol_secret_empty_call(): +def test_get_google_signals_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -9661,18 +9654,18 @@ def test_update_measurement_protocol_secret_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_measurement_protocol_secret), "__call__" + type(client.transport.get_google_signals_settings), "__call__" ) as call: - client.update_measurement_protocol_secret() + client.get_google_signals_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateMeasurementProtocolSecretRequest() + assert args[0] == analytics_admin.GetGoogleSignalsSettingsRequest() @pytest.mark.asyncio -async def test_update_measurement_protocol_secret_async( +async def test_get_google_signals_settings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateMeasurementProtocolSecretRequest, + request_type=analytics_admin.GetGoogleSignalsSettingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9685,52 +9678,55 @@ async def test_update_measurement_protocol_secret_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_measurement_protocol_secret), "__call__" + type(client.transport.get_google_signals_settings), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.MeasurementProtocolSecret( + resources.GoogleSignalsSettings( name="name_value", - display_name="display_name_value", - secret_value="secret_value_value", + state=resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED, + consent=resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED, ) ) - response = await client.update_measurement_protocol_secret(request) + response = await client.get_google_signals_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateMeasurementProtocolSecretRequest() + assert args[0] == analytics_admin.GetGoogleSignalsSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.MeasurementProtocolSecret) + assert isinstance(response, resources.GoogleSignalsSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.secret_value == "secret_value_value" + assert response.state == resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED + assert ( + response.consent + == resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED + ) @pytest.mark.asyncio -async def test_update_measurement_protocol_secret_async_from_dict(): - await test_update_measurement_protocol_secret_async(request_type=dict) +async def test_get_google_signals_settings_async_from_dict(): + await test_get_google_signals_settings_async(request_type=dict) -def test_update_measurement_protocol_secret_field_headers(): +def test_get_google_signals_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateMeasurementProtocolSecretRequest() + request = analytics_admin.GetGoogleSignalsSettingsRequest() - request.measurement_protocol_secret.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_measurement_protocol_secret), "__call__" + type(client.transport.get_google_signals_settings), "__call__" ) as call: - call.return_value = resources.MeasurementProtocolSecret() - client.update_measurement_protocol_secret(request) + call.return_value = resources.GoogleSignalsSettings() + client.get_google_signals_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -9741,30 +9737,30 @@ def test_update_measurement_protocol_secret_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "measurement_protocol_secret.name=name_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_measurement_protocol_secret_field_headers_async(): +async def test_get_google_signals_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateMeasurementProtocolSecretRequest() + request = analytics_admin.GetGoogleSignalsSettingsRequest() - request.measurement_protocol_secret.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_measurement_protocol_secret), "__call__" + type(client.transport.get_google_signals_settings), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.MeasurementProtocolSecret() + resources.GoogleSignalsSettings() ) - await client.update_measurement_protocol_secret(request) + await client.get_google_signals_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -9775,43 +9771,37 @@ async def test_update_measurement_protocol_secret_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "measurement_protocol_secret.name=name_value", + "name=name_value", ) in kw["metadata"] -def test_update_measurement_protocol_secret_flattened(): +def test_get_google_signals_settings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_measurement_protocol_secret), "__call__" + type(client.transport.get_google_signals_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.MeasurementProtocolSecret() + call.return_value = resources.GoogleSignalsSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_measurement_protocol_secret( - measurement_protocol_secret=resources.MeasurementProtocolSecret( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.get_google_signals_settings( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].measurement_protocol_secret - mock_val = resources.MeasurementProtocolSecret(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_update_measurement_protocol_secret_flattened_error(): +def test_get_google_signals_settings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -9819,54 +9809,45 @@ def test_update_measurement_protocol_secret_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_measurement_protocol_secret( - analytics_admin.UpdateMeasurementProtocolSecretRequest(), - measurement_protocol_secret=resources.MeasurementProtocolSecret( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.get_google_signals_settings( + analytics_admin.GetGoogleSignalsSettingsRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_update_measurement_protocol_secret_flattened_async(): +async def test_get_google_signals_settings_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_measurement_protocol_secret), "__call__" + type(client.transport.get_google_signals_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.MeasurementProtocolSecret() + call.return_value = resources.GoogleSignalsSettings() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.MeasurementProtocolSecret() + resources.GoogleSignalsSettings() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_measurement_protocol_secret( - measurement_protocol_secret=resources.MeasurementProtocolSecret( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + response = await client.get_google_signals_settings( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].measurement_protocol_secret - mock_val = resources.MeasurementProtocolSecret(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_update_measurement_protocol_secret_flattened_error_async(): +async def test_get_google_signals_settings_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -9874,23 +9855,20 @@ async def test_update_measurement_protocol_secret_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_measurement_protocol_secret( - analytics_admin.UpdateMeasurementProtocolSecretRequest(), - measurement_protocol_secret=resources.MeasurementProtocolSecret( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + await client.get_google_signals_settings( + analytics_admin.GetGoogleSignalsSettingsRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.AcknowledgeUserDataCollectionRequest, + analytics_admin.UpdateGoogleSignalsSettingsRequest, dict, ], ) -def test_acknowledge_user_data_collection(request_type, transport: str = "grpc"): +def test_update_google_signals_settings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -9902,22 +9880,32 @@ def test_acknowledge_user_data_collection(request_type, transport: str = "grpc") # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.acknowledge_user_data_collection), "__call__" + type(client.transport.update_google_signals_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.AcknowledgeUserDataCollectionResponse() - response = client.acknowledge_user_data_collection(request) + call.return_value = resources.GoogleSignalsSettings( + name="name_value", + state=resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED, + consent=resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED, + ) + response = client.update_google_signals_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.AcknowledgeUserDataCollectionRequest() + assert args[0] == analytics_admin.UpdateGoogleSignalsSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.AcknowledgeUserDataCollectionResponse) + assert isinstance(response, resources.GoogleSignalsSettings) + assert response.name == "name_value" + assert response.state == resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED + assert ( + response.consent + == resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED + ) -def test_acknowledge_user_data_collection_empty_call(): +def test_update_google_signals_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -9927,18 +9915,18 @@ def test_acknowledge_user_data_collection_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.acknowledge_user_data_collection), "__call__" + type(client.transport.update_google_signals_settings), "__call__" ) as call: - client.acknowledge_user_data_collection() + client.update_google_signals_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.AcknowledgeUserDataCollectionRequest() + assert args[0] == analytics_admin.UpdateGoogleSignalsSettingsRequest() @pytest.mark.asyncio -async def test_acknowledge_user_data_collection_async( +async def test_update_google_signals_settings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.AcknowledgeUserDataCollectionRequest, + request_type=analytics_admin.UpdateGoogleSignalsSettingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -9951,45 +9939,55 @@ async def test_acknowledge_user_data_collection_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.acknowledge_user_data_collection), "__call__" + type(client.transport.update_google_signals_settings), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.AcknowledgeUserDataCollectionResponse() + resources.GoogleSignalsSettings( + name="name_value", + state=resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED, + consent=resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED, + ) ) - response = await client.acknowledge_user_data_collection(request) + response = await client.update_google_signals_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.AcknowledgeUserDataCollectionRequest() + assert args[0] == analytics_admin.UpdateGoogleSignalsSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.AcknowledgeUserDataCollectionResponse) + assert isinstance(response, resources.GoogleSignalsSettings) + assert response.name == "name_value" + assert response.state == resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED + assert ( + response.consent + == resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED + ) @pytest.mark.asyncio -async def test_acknowledge_user_data_collection_async_from_dict(): - await test_acknowledge_user_data_collection_async(request_type=dict) +async def test_update_google_signals_settings_async_from_dict(): + await test_update_google_signals_settings_async(request_type=dict) -def test_acknowledge_user_data_collection_field_headers(): +def test_update_google_signals_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.AcknowledgeUserDataCollectionRequest() + request = analytics_admin.UpdateGoogleSignalsSettingsRequest() - request.property = "property_value" + request.google_signals_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.acknowledge_user_data_collection), "__call__" + type(client.transport.update_google_signals_settings), "__call__" ) as call: - call.return_value = analytics_admin.AcknowledgeUserDataCollectionResponse() - client.acknowledge_user_data_collection(request) + call.return_value = resources.GoogleSignalsSettings() + client.update_google_signals_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -10000,30 +9998,30 @@ def test_acknowledge_user_data_collection_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "property=property_value", + "google_signals_settings.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_acknowledge_user_data_collection_field_headers_async(): +async def test_update_google_signals_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.AcknowledgeUserDataCollectionRequest() + request = analytics_admin.UpdateGoogleSignalsSettingsRequest() - request.property = "property_value" + request.google_signals_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.acknowledge_user_data_collection), "__call__" + type(client.transport.update_google_signals_settings), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.AcknowledgeUserDataCollectionResponse() + resources.GoogleSignalsSettings() ) - await client.acknowledge_user_data_collection(request) + await client.update_google_signals_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -10034,73 +10032,176 @@ async def test_acknowledge_user_data_collection_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "property=property_value", + "google_signals_settings.name=name_value", ) in kw["metadata"] -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, - dict, - ], -) -def test_get_sk_ad_network_conversion_value_schema( - request_type, transport: str = "grpc" -): +def test_update_google_signals_settings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.update_google_signals_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SKAdNetworkConversionValueSchema( - name="name_value", - apply_conversion_values=True, + call.return_value = resources.GoogleSignalsSettings() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_google_signals_settings( + google_signals_settings=resources.GoogleSignalsSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) - response = client.get_sk_ad_network_conversion_value_schema(request) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying call was made with the expected + # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, resources.SKAdNetworkConversionValueSchema) - assert response.name == "name_value" - assert response.apply_conversion_values is True + arg = args[0].google_signals_settings + mock_val = resources.GoogleSignalsSettings(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val -def test_get_sk_ad_network_conversion_value_schema_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. +def test_update_google_signals_settings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" - ) as call: - client.get_sk_ad_network_conversion_value_schema() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_google_signals_settings( + analytics_admin.UpdateGoogleSignalsSettingsRequest(), + google_signals_settings=resources.GoogleSignalsSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) @pytest.mark.asyncio -async def test_get_sk_ad_network_conversion_value_schema_async( +async def test_update_google_signals_settings_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_google_signals_settings), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.GoogleSignalsSettings() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.GoogleSignalsSettings() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_google_signals_settings( + google_signals_settings=resources.GoogleSignalsSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].google_signals_settings + mock_val = resources.GoogleSignalsSettings(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_update_google_signals_settings_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_google_signals_settings( + analytics_admin.UpdateGoogleSignalsSettingsRequest(), + google_signals_settings=resources.GoogleSignalsSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateConversionEventRequest, + dict, + ], +) +def test_create_conversion_event(request_type, transport: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_conversion_event), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.ConversionEvent( + name="name_value", + event_name="event_name_value", + deletable=True, + custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + ) + response = client.create_conversion_event(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateConversionEventRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.ConversionEvent) + assert response.name == "name_value" + assert response.event_name == "event_name_value" + assert response.deletable is True + assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) + + +def test_create_conversion_event_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_conversion_event), "__call__" + ) as call: + client.create_conversion_event() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateConversionEventRequest() + + +@pytest.mark.asyncio +async def test_create_conversion_event_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, + request_type=analytics_admin.CreateConversionEventRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10113,50 +10214,59 @@ async def test_get_sk_ad_network_conversion_value_schema_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.create_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SKAdNetworkConversionValueSchema( + resources.ConversionEvent( name="name_value", - apply_conversion_values=True, + event_name="event_name_value", + deletable=True, + custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, ) ) - response = await client.get_sk_ad_network_conversion_value_schema(request) + response = await client.create_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() + assert args[0] == analytics_admin.CreateConversionEventRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.SKAdNetworkConversionValueSchema) + assert isinstance(response, resources.ConversionEvent) assert response.name == "name_value" - assert response.apply_conversion_values is True + assert response.event_name == "event_name_value" + assert response.deletable is True + assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) @pytest.mark.asyncio -async def test_get_sk_ad_network_conversion_value_schema_async_from_dict(): - await test_get_sk_ad_network_conversion_value_schema_async(request_type=dict) +async def test_create_conversion_event_async_from_dict(): + await test_create_conversion_event_async(request_type=dict) -def test_get_sk_ad_network_conversion_value_schema_field_headers(): +def test_create_conversion_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() + request = analytics_admin.CreateConversionEventRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.create_conversion_event), "__call__" ) as call: - call.return_value = resources.SKAdNetworkConversionValueSchema() - client.get_sk_ad_network_conversion_value_schema(request) + call.return_value = resources.ConversionEvent() + client.create_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -10167,30 +10277,30 @@ def test_get_sk_ad_network_conversion_value_schema_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_sk_ad_network_conversion_value_schema_field_headers_async(): +async def test_create_conversion_event_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() + request = analytics_admin.CreateConversionEventRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.create_conversion_event), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SKAdNetworkConversionValueSchema() + resources.ConversionEvent() ) - await client.get_sk_ad_network_conversion_value_schema(request) + await client.create_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -10201,37 +10311,41 @@ async def test_get_sk_ad_network_conversion_value_schema_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_sk_ad_network_conversion_value_schema_flattened(): +def test_create_conversion_event_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.create_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SKAdNetworkConversionValueSchema() + call.return_value = resources.ConversionEvent() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_sk_ad_network_conversion_value_schema( - name="name_value", + client.create_conversion_event( + parent="parent_value", + conversion_event=resources.ConversionEvent(name="name_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].conversion_event + mock_val = resources.ConversionEvent(name="name_value") assert arg == mock_val -def test_get_sk_ad_network_conversion_value_schema_flattened_error(): +def test_create_conversion_event_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -10239,45 +10353,50 @@ def test_get_sk_ad_network_conversion_value_schema_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_sk_ad_network_conversion_value_schema( - analytics_admin.GetSKAdNetworkConversionValueSchemaRequest(), - name="name_value", + client.create_conversion_event( + analytics_admin.CreateConversionEventRequest(), + parent="parent_value", + conversion_event=resources.ConversionEvent(name="name_value"), ) @pytest.mark.asyncio -async def test_get_sk_ad_network_conversion_value_schema_flattened_async(): +async def test_create_conversion_event_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.create_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SKAdNetworkConversionValueSchema() + call.return_value = resources.ConversionEvent() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SKAdNetworkConversionValueSchema() + resources.ConversionEvent() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_sk_ad_network_conversion_value_schema( - name="name_value", + response = await client.create_conversion_event( + parent="parent_value", + conversion_event=resources.ConversionEvent(name="name_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].conversion_event + mock_val = resources.ConversionEvent(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_get_sk_ad_network_conversion_value_schema_flattened_error_async(): +async def test_create_conversion_event_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -10285,22 +10404,21 @@ async def test_get_sk_ad_network_conversion_value_schema_flattened_error_async() # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_sk_ad_network_conversion_value_schema( - analytics_admin.GetSKAdNetworkConversionValueSchemaRequest(), - name="name_value", + await client.create_conversion_event( + analytics_admin.CreateConversionEventRequest(), + parent="parent_value", + conversion_event=resources.ConversionEvent(name="name_value"), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, + analytics_admin.UpdateConversionEventRequest, dict, ], ) -def test_create_sk_ad_network_conversion_value_schema( - request_type, transport: str = "grpc" -): +def test_update_conversion_event(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -10312,29 +10430,36 @@ def test_create_sk_ad_network_conversion_value_schema( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.update_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SKAdNetworkConversionValueSchema( + call.return_value = resources.ConversionEvent( name="name_value", - apply_conversion_values=True, + event_name="event_name_value", + deletable=True, + custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, ) - response = client.create_sk_ad_network_conversion_value_schema(request) + response = client.update_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() - ) + assert args[0] == analytics_admin.UpdateConversionEventRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.SKAdNetworkConversionValueSchema) + assert isinstance(response, resources.ConversionEvent) assert response.name == "name_value" - assert response.apply_conversion_values is True + assert response.event_name == "event_name_value" + assert response.deletable is True + assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) -def test_create_sk_ad_network_conversion_value_schema_empty_call(): +def test_update_conversion_event_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -10344,20 +10469,18 @@ def test_create_sk_ad_network_conversion_value_schema_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.update_conversion_event), "__call__" ) as call: - client.create_sk_ad_network_conversion_value_schema() + client.update_conversion_event() call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() - ) + assert args[0] == analytics_admin.UpdateConversionEventRequest() @pytest.mark.asyncio -async def test_create_sk_ad_network_conversion_value_schema_async( +async def test_update_conversion_event_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, + request_type=analytics_admin.UpdateConversionEventRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10370,52 +10493,59 @@ async def test_create_sk_ad_network_conversion_value_schema_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.update_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SKAdNetworkConversionValueSchema( + resources.ConversionEvent( name="name_value", - apply_conversion_values=True, + event_name="event_name_value", + deletable=True, + custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, ) ) - response = await client.create_sk_ad_network_conversion_value_schema(request) + response = await client.update_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() - ) + assert args[0] == analytics_admin.UpdateConversionEventRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.SKAdNetworkConversionValueSchema) + assert isinstance(response, resources.ConversionEvent) assert response.name == "name_value" - assert response.apply_conversion_values is True + assert response.event_name == "event_name_value" + assert response.deletable is True + assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) @pytest.mark.asyncio -async def test_create_sk_ad_network_conversion_value_schema_async_from_dict(): - await test_create_sk_ad_network_conversion_value_schema_async(request_type=dict) +async def test_update_conversion_event_async_from_dict(): + await test_update_conversion_event_async(request_type=dict) -def test_create_sk_ad_network_conversion_value_schema_field_headers(): +def test_update_conversion_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() + request = analytics_admin.UpdateConversionEventRequest() - request.parent = "parent_value" + request.conversion_event.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.update_conversion_event), "__call__" ) as call: - call.return_value = resources.SKAdNetworkConversionValueSchema() - client.create_sk_ad_network_conversion_value_schema(request) + call.return_value = resources.ConversionEvent() + client.update_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -10426,30 +10556,30 @@ def test_create_sk_ad_network_conversion_value_schema_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "conversion_event.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_create_sk_ad_network_conversion_value_schema_field_headers_async(): +async def test_update_conversion_event_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() + request = analytics_admin.UpdateConversionEventRequest() - request.parent = "parent_value" + request.conversion_event.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.update_conversion_event), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SKAdNetworkConversionValueSchema() + resources.ConversionEvent() ) - await client.create_sk_ad_network_conversion_value_schema(request) + await client.update_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -10460,43 +10590,41 @@ async def test_create_sk_ad_network_conversion_value_schema_field_headers_async( _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "conversion_event.name=name_value", ) in kw["metadata"] -def test_create_sk_ad_network_conversion_value_schema_flattened(): +def test_update_conversion_event_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.update_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SKAdNetworkConversionValueSchema() + call.return_value = resources.ConversionEvent() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_sk_ad_network_conversion_value_schema( - parent="parent_value", - skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( - name="name_value" - ), + client.update_conversion_event( + conversion_event=resources.ConversionEvent(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].conversion_event + mock_val = resources.ConversionEvent(name="name_value") assert arg == mock_val - arg = args[0].skadnetwork_conversion_value_schema - mock_val = resources.SKAdNetworkConversionValueSchema(name="name_value") + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_create_sk_ad_network_conversion_value_schema_flattened_error(): +def test_update_conversion_event_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -10504,54 +10632,50 @@ def test_create_sk_ad_network_conversion_value_schema_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_sk_ad_network_conversion_value_schema( - analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest(), - parent="parent_value", - skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( - name="name_value" - ), + client.update_conversion_event( + analytics_admin.UpdateConversionEventRequest(), + conversion_event=resources.ConversionEvent(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_create_sk_ad_network_conversion_value_schema_flattened_async(): +async def test_update_conversion_event_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.update_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SKAdNetworkConversionValueSchema() + call.return_value = resources.ConversionEvent() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SKAdNetworkConversionValueSchema() + resources.ConversionEvent() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_sk_ad_network_conversion_value_schema( - parent="parent_value", - skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( - name="name_value" - ), + response = await client.update_conversion_event( + conversion_event=resources.ConversionEvent(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].conversion_event + mock_val = resources.ConversionEvent(name="name_value") assert arg == mock_val - arg = args[0].skadnetwork_conversion_value_schema - mock_val = resources.SKAdNetworkConversionValueSchema(name="name_value") + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val @pytest.mark.asyncio -async def test_create_sk_ad_network_conversion_value_schema_flattened_error_async(): +async def test_update_conversion_event_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -10559,25 +10683,21 @@ async def test_create_sk_ad_network_conversion_value_schema_flattened_error_asyn # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_sk_ad_network_conversion_value_schema( - analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest(), - parent="parent_value", - skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( - name="name_value" - ), + await client.update_conversion_event( + analytics_admin.UpdateConversionEventRequest(), + conversion_event=resources.ConversionEvent(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, + analytics_admin.GetConversionEventRequest, dict, ], ) -def test_delete_sk_ad_network_conversion_value_schema( - request_type, transport: str = "grpc" -): +def test_get_conversion_event(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -10589,24 +10709,36 @@ def test_delete_sk_ad_network_conversion_value_schema( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.get_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_sk_ad_network_conversion_value_schema(request) + call.return_value = resources.ConversionEvent( + name="name_value", + event_name="event_name_value", + deletable=True, + custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + ) + response = client.get_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() - ) + assert args[0] == analytics_admin.GetConversionEventRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.ConversionEvent) + assert response.name == "name_value" + assert response.event_name == "event_name_value" + assert response.deletable is True + assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) -def test_delete_sk_ad_network_conversion_value_schema_empty_call(): +def test_get_conversion_event_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -10616,20 +10748,18 @@ def test_delete_sk_ad_network_conversion_value_schema_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.get_conversion_event), "__call__" ) as call: - client.delete_sk_ad_network_conversion_value_schema() + client.get_conversion_event() call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() - ) + assert args[0] == analytics_admin.GetConversionEventRequest() @pytest.mark.asyncio -async def test_delete_sk_ad_network_conversion_value_schema_async( +async def test_get_conversion_event_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, + request_type=analytics_admin.GetConversionEventRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10642,45 +10772,59 @@ async def test_delete_sk_ad_network_conversion_value_schema_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.get_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_sk_ad_network_conversion_value_schema(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.ConversionEvent( + name="name_value", + event_name="event_name_value", + deletable=True, + custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + ) + ) + response = await client.get_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() - ) + assert args[0] == analytics_admin.GetConversionEventRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.ConversionEvent) + assert response.name == "name_value" + assert response.event_name == "event_name_value" + assert response.deletable is True + assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) @pytest.mark.asyncio -async def test_delete_sk_ad_network_conversion_value_schema_async_from_dict(): - await test_delete_sk_ad_network_conversion_value_schema_async(request_type=dict) +async def test_get_conversion_event_async_from_dict(): + await test_get_conversion_event_async(request_type=dict) -def test_delete_sk_ad_network_conversion_value_schema_field_headers(): +def test_get_conversion_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() + request = analytics_admin.GetConversionEventRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.get_conversion_event), "__call__" ) as call: - call.return_value = None - client.delete_sk_ad_network_conversion_value_schema(request) + call.return_value = resources.ConversionEvent() + client.get_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -10696,23 +10840,25 @@ def test_delete_sk_ad_network_conversion_value_schema_field_headers(): @pytest.mark.asyncio -async def test_delete_sk_ad_network_conversion_value_schema_field_headers_async(): +async def test_get_conversion_event_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() + request = analytics_admin.GetConversionEventRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.get_conversion_event), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_sk_ad_network_conversion_value_schema(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.ConversionEvent() + ) + await client.get_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -10727,20 +10873,20 @@ async def test_delete_sk_ad_network_conversion_value_schema_field_headers_async( ) in kw["metadata"] -def test_delete_sk_ad_network_conversion_value_schema_flattened(): +def test_get_conversion_event_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.get_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.ConversionEvent() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_sk_ad_network_conversion_value_schema( + client.get_conversion_event( name="name_value", ) @@ -10753,7 +10899,7 @@ def test_delete_sk_ad_network_conversion_value_schema_flattened(): assert arg == mock_val -def test_delete_sk_ad_network_conversion_value_schema_flattened_error(): +def test_get_conversion_event_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -10761,29 +10907,31 @@ def test_delete_sk_ad_network_conversion_value_schema_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_sk_ad_network_conversion_value_schema( - analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest(), + client.get_conversion_event( + analytics_admin.GetConversionEventRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_delete_sk_ad_network_conversion_value_schema_flattened_async(): +async def test_get_conversion_event_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.get_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.ConversionEvent() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.ConversionEvent() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_sk_ad_network_conversion_value_schema( + response = await client.get_conversion_event( name="name_value", ) @@ -10797,7 +10945,7 @@ async def test_delete_sk_ad_network_conversion_value_schema_flattened_async(): @pytest.mark.asyncio -async def test_delete_sk_ad_network_conversion_value_schema_flattened_error_async(): +async def test_get_conversion_event_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -10805,8 +10953,8 @@ async def test_delete_sk_ad_network_conversion_value_schema_flattened_error_asyn # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.delete_sk_ad_network_conversion_value_schema( - analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest(), + await client.get_conversion_event( + analytics_admin.GetConversionEventRequest(), name="name_value", ) @@ -10814,13 +10962,11 @@ async def test_delete_sk_ad_network_conversion_value_schema_flattened_error_asyn @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, + analytics_admin.DeleteConversionEventRequest, dict, ], ) -def test_update_sk_ad_network_conversion_value_schema( - request_type, transport: str = "grpc" -): +def test_delete_conversion_event(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -10832,29 +10978,22 @@ def test_update_sk_ad_network_conversion_value_schema( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.delete_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SKAdNetworkConversionValueSchema( - name="name_value", - apply_conversion_values=True, - ) - response = client.update_sk_ad_network_conversion_value_schema(request) + call.return_value = None + response = client.delete_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() - ) + assert args[0] == analytics_admin.DeleteConversionEventRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.SKAdNetworkConversionValueSchema) - assert response.name == "name_value" - assert response.apply_conversion_values is True + assert response is None -def test_update_sk_ad_network_conversion_value_schema_empty_call(): +def test_delete_conversion_event_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -10864,20 +11003,18 @@ def test_update_sk_ad_network_conversion_value_schema_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.delete_conversion_event), "__call__" ) as call: - client.update_sk_ad_network_conversion_value_schema() + client.delete_conversion_event() call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() - ) + assert args[0] == analytics_admin.DeleteConversionEventRequest() @pytest.mark.asyncio -async def test_update_sk_ad_network_conversion_value_schema_async( +async def test_delete_conversion_event_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, + request_type=analytics_admin.DeleteConversionEventRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -10890,52 +11027,43 @@ async def test_update_sk_ad_network_conversion_value_schema_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.delete_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SKAdNetworkConversionValueSchema( - name="name_value", - apply_conversion_values=True, - ) - ) - response = await client.update_sk_ad_network_conversion_value_schema(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() - ) + assert args[0] == analytics_admin.DeleteConversionEventRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.SKAdNetworkConversionValueSchema) - assert response.name == "name_value" - assert response.apply_conversion_values is True + assert response is None @pytest.mark.asyncio -async def test_update_sk_ad_network_conversion_value_schema_async_from_dict(): - await test_update_sk_ad_network_conversion_value_schema_async(request_type=dict) +async def test_delete_conversion_event_async_from_dict(): + await test_delete_conversion_event_async(request_type=dict) -def test_update_sk_ad_network_conversion_value_schema_field_headers(): +def test_delete_conversion_event_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() + request = analytics_admin.DeleteConversionEventRequest() - request.skadnetwork_conversion_value_schema.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.delete_conversion_event), "__call__" ) as call: - call.return_value = resources.SKAdNetworkConversionValueSchema() - client.update_sk_ad_network_conversion_value_schema(request) + call.return_value = None + client.delete_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -10946,30 +11074,28 @@ def test_update_sk_ad_network_conversion_value_schema_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "skadnetwork_conversion_value_schema.name=name_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_sk_ad_network_conversion_value_schema_field_headers_async(): +async def test_delete_conversion_event_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() + request = analytics_admin.DeleteConversionEventRequest() - request.skadnetwork_conversion_value_schema.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.delete_conversion_event), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SKAdNetworkConversionValueSchema() - ) - await client.update_sk_ad_network_conversion_value_schema(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_conversion_event(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -10980,43 +11106,37 @@ async def test_update_sk_ad_network_conversion_value_schema_field_headers_async( _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "skadnetwork_conversion_value_schema.name=name_value", + "name=name_value", ) in kw["metadata"] -def test_update_sk_ad_network_conversion_value_schema_flattened(): +def test_delete_conversion_event_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.delete_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SKAdNetworkConversionValueSchema() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_sk_ad_network_conversion_value_schema( - skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.delete_conversion_event( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].skadnetwork_conversion_value_schema - mock_val = resources.SKAdNetworkConversionValueSchema(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_update_sk_ad_network_conversion_value_schema_flattened_error(): +def test_delete_conversion_event_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -11024,54 +11144,43 @@ def test_update_sk_ad_network_conversion_value_schema_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_sk_ad_network_conversion_value_schema( - analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest(), - skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.delete_conversion_event( + analytics_admin.DeleteConversionEventRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_update_sk_ad_network_conversion_value_schema_flattened_async(): +async def test_delete_conversion_event_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_sk_ad_network_conversion_value_schema), "__call__" + type(client.transport.delete_conversion_event), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SKAdNetworkConversionValueSchema() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SKAdNetworkConversionValueSchema() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_sk_ad_network_conversion_value_schema( - skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + response = await client.delete_conversion_event( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].skadnetwork_conversion_value_schema - mock_val = resources.SKAdNetworkConversionValueSchema(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_update_sk_ad_network_conversion_value_schema_flattened_error_async(): +async def test_delete_conversion_event_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -11079,25 +11188,20 @@ async def test_update_sk_ad_network_conversion_value_schema_flattened_error_asyn # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_sk_ad_network_conversion_value_schema( - analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest(), - skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + await client.delete_conversion_event( + analytics_admin.DeleteConversionEventRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, + analytics_admin.ListConversionEventsRequest, dict, ], ) -def test_list_sk_ad_network_conversion_value_schemas( - request_type, transport: str = "grpc" -): +def test_list_conversion_events(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -11109,27 +11213,25 @@ def test_list_sk_ad_network_conversion_value_schemas( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" + type(client.transport.list_conversion_events), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - next_page_token="next_page_token_value", - ) + call.return_value = analytics_admin.ListConversionEventsResponse( + next_page_token="next_page_token_value", ) - response = client.list_sk_ad_network_conversion_value_schemas(request) + response = client.list_conversion_events(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() + assert args[0] == analytics_admin.ListConversionEventsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListSKAdNetworkConversionValueSchemasPager) + assert isinstance(response, pagers.ListConversionEventsPager) assert response.next_page_token == "next_page_token_value" -def test_list_sk_ad_network_conversion_value_schemas_empty_call(): +def test_list_conversion_events_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -11139,18 +11241,18 @@ def test_list_sk_ad_network_conversion_value_schemas_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" + type(client.transport.list_conversion_events), "__call__" ) as call: - client.list_sk_ad_network_conversion_value_schemas() + client.list_conversion_events() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() + assert args[0] == analytics_admin.ListConversionEventsRequest() @pytest.mark.asyncio -async def test_list_sk_ad_network_conversion_value_schemas_async( +async def test_list_conversion_events_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, + request_type=analytics_admin.ListConversionEventsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11163,50 +11265,48 @@ async def test_list_sk_ad_network_conversion_value_schemas_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" + type(client.transport.list_conversion_events), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + analytics_admin.ListConversionEventsResponse( next_page_token="next_page_token_value", ) ) - response = await client.list_sk_ad_network_conversion_value_schemas(request) + response = await client.list_conversion_events(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() + assert args[0] == analytics_admin.ListConversionEventsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListSKAdNetworkConversionValueSchemasAsyncPager) + assert isinstance(response, pagers.ListConversionEventsAsyncPager) assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_list_sk_ad_network_conversion_value_schemas_async_from_dict(): - await test_list_sk_ad_network_conversion_value_schemas_async(request_type=dict) +async def test_list_conversion_events_async_from_dict(): + await test_list_conversion_events_async(request_type=dict) -def test_list_sk_ad_network_conversion_value_schemas_field_headers(): +def test_list_conversion_events_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() + request = analytics_admin.ListConversionEventsRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" + type(client.transport.list_conversion_events), "__call__" ) as call: - call.return_value = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() - ) - client.list_sk_ad_network_conversion_value_schemas(request) + call.return_value = analytics_admin.ListConversionEventsResponse() + client.list_conversion_events(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -11222,25 +11322,25 @@ def test_list_sk_ad_network_conversion_value_schemas_field_headers(): @pytest.mark.asyncio -async def test_list_sk_ad_network_conversion_value_schemas_field_headers_async(): +async def test_list_conversion_events_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() + request = analytics_admin.ListConversionEventsRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" + type(client.transport.list_conversion_events), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() + analytics_admin.ListConversionEventsResponse() ) - await client.list_sk_ad_network_conversion_value_schemas(request) + await client.list_conversion_events(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -11255,22 +11355,20 @@ async def test_list_sk_ad_network_conversion_value_schemas_field_headers_async() ) in kw["metadata"] -def test_list_sk_ad_network_conversion_value_schemas_flattened(): +def test_list_conversion_events_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" + type(client.transport.list_conversion_events), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() - ) + call.return_value = analytics_admin.ListConversionEventsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_sk_ad_network_conversion_value_schemas( + client.list_conversion_events( parent="parent_value", ) @@ -11283,7 +11381,7 @@ def test_list_sk_ad_network_conversion_value_schemas_flattened(): assert arg == mock_val -def test_list_sk_ad_network_conversion_value_schemas_flattened_error(): +def test_list_conversion_events_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -11291,33 +11389,31 @@ def test_list_sk_ad_network_conversion_value_schemas_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_sk_ad_network_conversion_value_schemas( - analytics_admin.ListSKAdNetworkConversionValueSchemasRequest(), + client.list_conversion_events( + analytics_admin.ListConversionEventsRequest(), parent="parent_value", ) @pytest.mark.asyncio -async def test_list_sk_ad_network_conversion_value_schemas_flattened_async(): +async def test_list_conversion_events_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" + type(client.transport.list_conversion_events), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() - ) + call.return_value = analytics_admin.ListConversionEventsResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() + analytics_admin.ListConversionEventsResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_sk_ad_network_conversion_value_schemas( + response = await client.list_conversion_events( parent="parent_value", ) @@ -11331,7 +11427,7 @@ async def test_list_sk_ad_network_conversion_value_schemas_flattened_async(): @pytest.mark.asyncio -async def test_list_sk_ad_network_conversion_value_schemas_flattened_error_async(): +async def test_list_conversion_events_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -11339,15 +11435,13 @@ async def test_list_sk_ad_network_conversion_value_schemas_flattened_error_async # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_sk_ad_network_conversion_value_schemas( - analytics_admin.ListSKAdNetworkConversionValueSchemasRequest(), + await client.list_conversion_events( + analytics_admin.ListConversionEventsRequest(), parent="parent_value", ) -def test_list_sk_ad_network_conversion_value_schemas_pager( - transport_name: str = "grpc", -): +def test_list_conversion_events_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials, transport=transport_name, @@ -11355,32 +11449,32 @@ def test_list_sk_ad_network_conversion_value_schemas_pager( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" + type(client.transport.list_conversion_events), "__call__" ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), + resources.ConversionEvent(), + resources.ConversionEvent(), ], next_page_token="abc", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[], + analytics_admin.ListConversionEventsResponse( + conversion_events=[], next_page_token="def", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), ], next_page_token="ghi", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), + resources.ConversionEvent(), ], ), RuntimeError, @@ -11390,20 +11484,16 @@ def test_list_sk_ad_network_conversion_value_schemas_pager( metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), ) - pager = client.list_sk_ad_network_conversion_value_schemas(request={}) + pager = client.list_conversion_events(request={}) assert pager._metadata == metadata results = list(pager) assert len(results) == 6 - assert all( - isinstance(i, resources.SKAdNetworkConversionValueSchema) for i in results - ) + assert all(isinstance(i, resources.ConversionEvent) for i in results) -def test_list_sk_ad_network_conversion_value_schemas_pages( - transport_name: str = "grpc", -): +def test_list_conversion_events_pages(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials, transport=transport_name, @@ -11411,84 +11501,82 @@ def test_list_sk_ad_network_conversion_value_schemas_pages( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_sk_ad_network_conversion_value_schemas), "__call__" + type(client.transport.list_conversion_events), "__call__" ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), + resources.ConversionEvent(), + resources.ConversionEvent(), ], next_page_token="abc", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[], + analytics_admin.ListConversionEventsResponse( + conversion_events=[], next_page_token="def", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), ], next_page_token="ghi", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), + resources.ConversionEvent(), ], ), RuntimeError, ) - pages = list( - client.list_sk_ad_network_conversion_value_schemas(request={}).pages - ) + pages = list(client.list_conversion_events(request={}).pages) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_list_sk_ad_network_conversion_value_schemas_async_pager(): +async def test_list_conversion_events_async_pager(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_sk_ad_network_conversion_value_schemas), + type(client.transport.list_conversion_events), "__call__", new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), + resources.ConversionEvent(), + resources.ConversionEvent(), ], next_page_token="abc", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[], + analytics_admin.ListConversionEventsResponse( + conversion_events=[], next_page_token="def", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), ], next_page_token="ghi", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), + resources.ConversionEvent(), ], ), RuntimeError, ) - async_pager = await client.list_sk_ad_network_conversion_value_schemas( + async_pager = await client.list_conversion_events( request={}, ) assert async_pager.next_page_token == "abc" @@ -11497,47 +11585,45 @@ async def test_list_sk_ad_network_conversion_value_schemas_async_pager(): responses.append(response) assert len(responses) == 6 - assert all( - isinstance(i, resources.SKAdNetworkConversionValueSchema) for i in responses - ) + assert all(isinstance(i, resources.ConversionEvent) for i in responses) @pytest.mark.asyncio -async def test_list_sk_ad_network_conversion_value_schemas_async_pages(): +async def test_list_conversion_events_async_pages(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_sk_ad_network_conversion_value_schemas), + type(client.transport.list_conversion_events), "__call__", new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), + resources.ConversionEvent(), + resources.ConversionEvent(), ], next_page_token="abc", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[], + analytics_admin.ListConversionEventsResponse( + conversion_events=[], next_page_token="def", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), ], next_page_token="ghi", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), + resources.ConversionEvent(), ], ), RuntimeError, @@ -11546,7 +11632,7 @@ async def test_list_sk_ad_network_conversion_value_schemas_async_pages(): # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 async for page_ in ( # pragma: no branch - await client.list_sk_ad_network_conversion_value_schemas(request={}) + await client.list_conversion_events(request={}) ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): @@ -11556,11 +11642,11 @@ async def test_list_sk_ad_network_conversion_value_schemas_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.SearchChangeHistoryEventsRequest, + analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, dict, ], ) -def test_search_change_history_events(request_type, transport: str = "grpc"): +def test_get_display_video360_advertiser_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -11572,25 +11658,29 @@ def test_search_change_history_events(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.search_change_history_events), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.SearchChangeHistoryEventsResponse( - next_page_token="next_page_token_value", + call.return_value = resources.DisplayVideo360AdvertiserLink( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) - response = client.search_change_history_events(request) + response = client.get_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.SearchChangeHistoryEventsRequest() + assert args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.SearchChangeHistoryEventsPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_search_change_history_events_empty_call(): +def test_get_display_video360_advertiser_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -11600,18 +11690,18 @@ def test_search_change_history_events_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.search_change_history_events), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: - client.search_change_history_events() + client.get_display_video360_advertiser_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.SearchChangeHistoryEventsRequest() + assert args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() @pytest.mark.asyncio -async def test_search_change_history_events_async( +async def test_get_display_video360_advertiser_link_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.SearchChangeHistoryEventsRequest, + request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11624,48 +11714,52 @@ async def test_search_change_history_events_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.search_change_history_events), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.SearchChangeHistoryEventsResponse( - next_page_token="next_page_token_value", + resources.DisplayVideo360AdvertiserLink( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) ) - response = await client.search_change_history_events(request) + response = await client.get_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.SearchChangeHistoryEventsRequest() + assert args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.SearchChangeHistoryEventsAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" @pytest.mark.asyncio -async def test_search_change_history_events_async_from_dict(): - await test_search_change_history_events_async(request_type=dict) +async def test_get_display_video360_advertiser_link_async_from_dict(): + await test_get_display_video360_advertiser_link_async(request_type=dict) -def test_search_change_history_events_field_headers(): +def test_get_display_video360_advertiser_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.SearchChangeHistoryEventsRequest() + request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() - request.account = "account_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.search_change_history_events), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: - call.return_value = analytics_admin.SearchChangeHistoryEventsResponse() - client.search_change_history_events(request) + call.return_value = resources.DisplayVideo360AdvertiserLink() + client.get_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -11676,30 +11770,30 @@ def test_search_change_history_events_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "account=account_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_search_change_history_events_field_headers_async(): +async def test_get_display_video360_advertiser_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.SearchChangeHistoryEventsRequest() + request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() - request.account = "account_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.search_change_history_events), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.SearchChangeHistoryEventsResponse() + resources.DisplayVideo360AdvertiserLink() ) - await client.search_change_history_events(request) + await client.get_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -11710,216 +11804,104 @@ async def test_search_change_history_events_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "account=account_value", + "name=name_value", ) in kw["metadata"] -def test_search_change_history_events_pager(transport_name: str = "grpc"): +def test_get_display_video360_advertiser_link_flattened(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.search_change_history_events), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - ], - next_page_token="abc", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[], - next_page_token="def", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - ], - next_page_token="ghi", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("account", ""),)), + # Designate an appropriate return value for the call. + call.return_value = resources.DisplayVideo360AdvertiserLink() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_display_video360_advertiser_link( + name="name_value", ) - pager = client.search_change_history_events(request={}) - - assert pager._metadata == metadata - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.ChangeHistoryEvent) for i in results) + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val -def test_search_change_history_events_pages(transport_name: str = "grpc"): +def test_get_display_video360_advertiser_link_flattened_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.search_change_history_events), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - ], - next_page_token="abc", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[], - next_page_token="def", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - ], - next_page_token="ghi", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - ], - ), - RuntimeError, + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_display_video360_advertiser_link( + analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(), + name="name_value", ) - pages = list(client.search_change_history_events(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_search_change_history_events_async_pager(): +async def test_get_display_video360_advertiser_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.search_change_history_events), - "__call__", - new_callable=mock.AsyncMock, + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - ], - next_page_token="abc", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[], - next_page_token="def", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - ], - next_page_token="ghi", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - ], - ), - RuntimeError, + # Designate an appropriate return value for the call. + call.return_value = resources.DisplayVideo360AdvertiserLink() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DisplayVideo360AdvertiserLink() ) - async_pager = await client.search_change_history_events( - request={}, + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_display_video360_advertiser_link( + name="name_value", ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - assert len(responses) == 6 - assert all(isinstance(i, resources.ChangeHistoryEvent) for i in responses) + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio -async def test_search_change_history_events_async_pages(): +async def test_get_display_video360_advertiser_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.search_change_history_events), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - ], - next_page_token="abc", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[], - next_page_token="def", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - ], - next_page_token="ghi", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - ], - ), - RuntimeError, + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_display_video360_advertiser_link( + analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(), + name="name_value", ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.search_change_history_events(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetGoogleSignalsSettingsRequest, + analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, dict, ], ) -def test_get_google_signals_settings(request_type, transport: str = "grpc"): +def test_list_display_video360_advertiser_links(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -11931,32 +11913,25 @@ def test_get_google_signals_settings(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_google_signals_settings), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.GoogleSignalsSettings( - name="name_value", - state=resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED, - consent=resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED, + call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + next_page_token="next_page_token_value", ) - response = client.get_google_signals_settings(request) + response = client.list_display_video360_advertiser_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetGoogleSignalsSettingsRequest() + assert args[0] == analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.GoogleSignalsSettings) - assert response.name == "name_value" - assert response.state == resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED - assert ( - response.consent - == resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED - ) + assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinksPager) + assert response.next_page_token == "next_page_token_value" -def test_get_google_signals_settings_empty_call(): +def test_list_display_video360_advertiser_links_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -11966,18 +11941,18 @@ def test_get_google_signals_settings_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_google_signals_settings), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: - client.get_google_signals_settings() + client.list_display_video360_advertiser_links() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetGoogleSignalsSettingsRequest() + assert args[0] == analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() @pytest.mark.asyncio -async def test_get_google_signals_settings_async( +async def test_list_display_video360_advertiser_links_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetGoogleSignalsSettingsRequest, + request_type=analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -11990,55 +11965,48 @@ async def test_get_google_signals_settings_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_google_signals_settings), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GoogleSignalsSettings( - name="name_value", - state=resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED, - consent=resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED, + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + next_page_token="next_page_token_value", ) ) - response = await client.get_google_signals_settings(request) + response = await client.list_display_video360_advertiser_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetGoogleSignalsSettingsRequest() + assert args[0] == analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.GoogleSignalsSettings) - assert response.name == "name_value" - assert response.state == resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED - assert ( - response.consent - == resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED - ) + assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinksAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_get_google_signals_settings_async_from_dict(): - await test_get_google_signals_settings_async(request_type=dict) +async def test_list_display_video360_advertiser_links_async_from_dict(): + await test_list_display_video360_advertiser_links_async(request_type=dict) -def test_get_google_signals_settings_field_headers(): +def test_list_display_video360_advertiser_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetGoogleSignalsSettingsRequest() + request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_google_signals_settings), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: - call.return_value = resources.GoogleSignalsSettings() - client.get_google_signals_settings(request) + call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() + client.list_display_video360_advertiser_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -12049,30 +12017,30 @@ def test_get_google_signals_settings_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_google_signals_settings_field_headers_async(): +async def test_list_display_video360_advertiser_links_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetGoogleSignalsSettingsRequest() + request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_google_signals_settings), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GoogleSignalsSettings() + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() ) - await client.get_google_signals_settings(request) + await client.list_display_video360_advertiser_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -12083,37 +12051,37 @@ async def test_get_google_signals_settings_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_google_signals_settings_flattened(): +def test_list_display_video360_advertiser_links_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_google_signals_settings), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.GoogleSignalsSettings() + call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_google_signals_settings( - name="name_value", + client.list_display_video360_advertiser_links( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val -def test_get_google_signals_settings_flattened_error(): +def test_list_display_video360_advertiser_links_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -12121,45 +12089,45 @@ def test_get_google_signals_settings_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_google_signals_settings( - analytics_admin.GetGoogleSignalsSettingsRequest(), - name="name_value", + client.list_display_video360_advertiser_links( + analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(), + parent="parent_value", ) @pytest.mark.asyncio -async def test_get_google_signals_settings_flattened_async(): +async def test_list_display_video360_advertiser_links_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_google_signals_settings), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.GoogleSignalsSettings() + call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GoogleSignalsSettings() + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_google_signals_settings( - name="name_value", + response = await client.list_display_video360_advertiser_links( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val @pytest.mark.asyncio -async def test_get_google_signals_settings_flattened_error_async(): +async def test_list_display_video360_advertiser_links_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -12167,291 +12135,222 @@ async def test_get_google_signals_settings_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_google_signals_settings( - analytics_admin.GetGoogleSignalsSettingsRequest(), - name="name_value", + await client.list_display_video360_advertiser_links( + analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(), + parent="parent_value", ) -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.UpdateGoogleSignalsSettingsRequest, - dict, - ], -) -def test_update_google_signals_settings(request_type, transport: str = "grpc"): +def test_list_display_video360_advertiser_links_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_google_signals_settings), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.GoogleSignalsSettings( - name="name_value", - state=resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED, - consent=resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED, + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[], + next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + ), + RuntimeError, ) - response = client.update_google_signals_settings(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateGoogleSignalsSettingsRequest() + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_display_video360_advertiser_links(request={}) - # Establish that the response is the type that we expect. - assert isinstance(response, resources.GoogleSignalsSettings) - assert response.name == "name_value" - assert response.state == resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED - assert ( - response.consent - == resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED - ) + assert pager._metadata == metadata + results = list(pager) + assert len(results) == 6 + assert all( + isinstance(i, resources.DisplayVideo360AdvertiserLink) for i in results + ) -def test_update_google_signals_settings_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. + +def test_list_display_video360_advertiser_links_pages(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_google_signals_settings), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: - client.update_google_signals_settings() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateGoogleSignalsSettingsRequest() + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[], + next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + ), + RuntimeError, + ) + pages = list(client.list_display_video360_advertiser_links(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_update_google_signals_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateGoogleSignalsSettingsRequest, -): +async def test_list_display_video360_advertiser_links_async_pager(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_google_signals_settings), "__call__" + type(client.transport.list_display_video360_advertiser_links), + "__call__", + new_callable=mock.AsyncMock, ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GoogleSignalsSettings( - name="name_value", - state=resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED, - consent=resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED, - ) - ) - response = await client.update_google_signals_settings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateGoogleSignalsSettingsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, resources.GoogleSignalsSettings) - assert response.name == "name_value" - assert response.state == resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED - assert ( - response.consent - == resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED - ) - - -@pytest.mark.asyncio -async def test_update_google_signals_settings_async_from_dict(): - await test_update_google_signals_settings_async(request_type=dict) - - -def test_update_google_signals_settings_field_headers(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateGoogleSignalsSettingsRequest() - - request.google_signals_settings.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_google_signals_settings), "__call__" - ) as call: - call.return_value = resources.GoogleSignalsSettings() - client.update_google_signals_settings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "google_signals_settings.name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_update_google_signals_settings_field_headers_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateGoogleSignalsSettingsRequest() - - request.google_signals_settings.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_google_signals_settings), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GoogleSignalsSettings() + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[], + next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + ), + RuntimeError, ) - await client.update_google_signals_settings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "google_signals_settings.name=name_value", - ) in kw["metadata"] - - -def test_update_google_signals_settings_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_google_signals_settings), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.GoogleSignalsSettings() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_google_signals_settings( - google_signals_settings=resources.GoogleSignalsSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + async_pager = await client.list_display_video360_advertiser_links( + request={}, ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].google_signals_settings - mock_val = resources.GoogleSignalsSettings(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) - assert arg == mock_val - - -def test_update_google_signals_settings_flattened_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_google_signals_settings( - analytics_admin.UpdateGoogleSignalsSettingsRequest(), - google_signals_settings=resources.GoogleSignalsSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + assert len(responses) == 6 + assert all( + isinstance(i, resources.DisplayVideo360AdvertiserLink) for i in responses ) @pytest.mark.asyncio -async def test_update_google_signals_settings_flattened_async(): +async def test_list_display_video360_advertiser_links_async_pages(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_google_signals_settings), "__call__" + type(client.transport.list_display_video360_advertiser_links), + "__call__", + new_callable=mock.AsyncMock, ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.GoogleSignalsSettings() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.GoogleSignalsSettings() - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_google_signals_settings( - google_signals_settings=resources.GoogleSignalsSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].google_signals_settings - mock_val = resources.GoogleSignalsSettings(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) - assert arg == mock_val - - -@pytest.mark.asyncio -async def test_update_google_signals_settings_flattened_error_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_google_signals_settings( - analytics_admin.UpdateGoogleSignalsSettingsRequest(), - google_signals_settings=resources.GoogleSignalsSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[], + next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + ), + RuntimeError, ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_display_video360_advertiser_links(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateConversionEventRequest, + analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, dict, ], ) -def test_create_conversion_event(request_type, transport: str = "grpc"): +def test_create_display_video360_advertiser_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -12463,36 +12362,29 @@ def test_create_conversion_event(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_conversion_event), "__call__" + type(client.transport.create_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.ConversionEvent( + call.return_value = resources.DisplayVideo360AdvertiserLink( name="name_value", - event_name="event_name_value", - deletable=True, - custom=True, - counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) - response = client.create_conversion_event(request) + response = client.create_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateConversionEventRequest() + assert args[0] == analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.ConversionEvent) + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) assert response.name == "name_value" - assert response.event_name == "event_name_value" - assert response.deletable is True - assert response.custom is True - assert ( - response.counting_method - == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT - ) + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_create_conversion_event_empty_call(): +def test_create_display_video360_advertiser_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -12502,18 +12394,18 @@ def test_create_conversion_event_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_conversion_event), "__call__" + type(client.transport.create_display_video360_advertiser_link), "__call__" ) as call: - client.create_conversion_event() + client.create_display_video360_advertiser_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateConversionEventRequest() + assert args[0] == analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() @pytest.mark.asyncio -async def test_create_conversion_event_async( +async def test_create_display_video360_advertiser_link_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateConversionEventRequest, + request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12526,59 +12418,52 @@ async def test_create_conversion_event_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_conversion_event), "__call__" + type(client.transport.create_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.ConversionEvent( + resources.DisplayVideo360AdvertiserLink( name="name_value", - event_name="event_name_value", - deletable=True, - custom=True, - counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) ) - response = await client.create_conversion_event(request) + response = await client.create_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateConversionEventRequest() + assert args[0] == analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.ConversionEvent) + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) assert response.name == "name_value" - assert response.event_name == "event_name_value" - assert response.deletable is True - assert response.custom is True - assert ( - response.counting_method - == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT - ) + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" @pytest.mark.asyncio -async def test_create_conversion_event_async_from_dict(): - await test_create_conversion_event_async(request_type=dict) +async def test_create_display_video360_advertiser_link_async_from_dict(): + await test_create_display_video360_advertiser_link_async(request_type=dict) -def test_create_conversion_event_field_headers(): +def test_create_display_video360_advertiser_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateConversionEventRequest() + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_conversion_event), "__call__" + type(client.transport.create_display_video360_advertiser_link), "__call__" ) as call: - call.return_value = resources.ConversionEvent() - client.create_conversion_event(request) + call.return_value = resources.DisplayVideo360AdvertiserLink() + client.create_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -12594,25 +12479,25 @@ def test_create_conversion_event_field_headers(): @pytest.mark.asyncio -async def test_create_conversion_event_field_headers_async(): +async def test_create_display_video360_advertiser_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateConversionEventRequest() + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_conversion_event), "__call__" + type(client.transport.create_display_video360_advertiser_link), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.ConversionEvent() + resources.DisplayVideo360AdvertiserLink() ) - await client.create_conversion_event(request) + await client.create_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -12627,22 +12512,24 @@ async def test_create_conversion_event_field_headers_async(): ) in kw["metadata"] -def test_create_conversion_event_flattened(): +def test_create_display_video360_advertiser_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_conversion_event), "__call__" + type(client.transport.create_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.ConversionEvent() + call.return_value = resources.DisplayVideo360AdvertiserLink() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_conversion_event( + client.create_display_video360_advertiser_link( parent="parent_value", - conversion_event=resources.ConversionEvent(name="name_value"), + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), ) # Establish that the underlying call was made with the expected @@ -12652,12 +12539,12 @@ def test_create_conversion_event_flattened(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].conversion_event - mock_val = resources.ConversionEvent(name="name_value") + arg = args[0].display_video_360_advertiser_link + mock_val = resources.DisplayVideo360AdvertiserLink(name="name_value") assert arg == mock_val -def test_create_conversion_event_flattened_error(): +def test_create_display_video360_advertiser_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -12665,34 +12552,38 @@ def test_create_conversion_event_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_conversion_event( - analytics_admin.CreateConversionEventRequest(), + client.create_display_video360_advertiser_link( + analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(), parent="parent_value", - conversion_event=resources.ConversionEvent(name="name_value"), + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), ) @pytest.mark.asyncio -async def test_create_conversion_event_flattened_async(): +async def test_create_display_video360_advertiser_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_conversion_event), "__call__" + type(client.transport.create_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.ConversionEvent() + call.return_value = resources.DisplayVideo360AdvertiserLink() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.ConversionEvent() + resources.DisplayVideo360AdvertiserLink() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_conversion_event( + response = await client.create_display_video360_advertiser_link( parent="parent_value", - conversion_event=resources.ConversionEvent(name="name_value"), + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), ) # Establish that the underlying call was made with the expected @@ -12702,13 +12593,13 @@ async def test_create_conversion_event_flattened_async(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].conversion_event - mock_val = resources.ConversionEvent(name="name_value") + arg = args[0].display_video_360_advertiser_link + mock_val = resources.DisplayVideo360AdvertiserLink(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_create_conversion_event_flattened_error_async(): +async def test_create_display_video360_advertiser_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -12716,21 +12607,23 @@ async def test_create_conversion_event_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_conversion_event( - analytics_admin.CreateConversionEventRequest(), + await client.create_display_video360_advertiser_link( + analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(), parent="parent_value", - conversion_event=resources.ConversionEvent(name="name_value"), + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateConversionEventRequest, + analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, dict, ], ) -def test_update_conversion_event(request_type, transport: str = "grpc"): +def test_delete_display_video360_advertiser_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -12742,36 +12635,22 @@ def test_update_conversion_event(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_conversion_event), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.ConversionEvent( - name="name_value", - event_name="event_name_value", - deletable=True, - custom=True, - counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, - ) - response = client.update_conversion_event(request) + call.return_value = None + response = client.delete_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateConversionEventRequest() + assert args[0] == analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.ConversionEvent) - assert response.name == "name_value" - assert response.event_name == "event_name_value" - assert response.deletable is True - assert response.custom is True - assert ( - response.counting_method - == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT - ) + assert response is None -def test_update_conversion_event_empty_call(): +def test_delete_display_video360_advertiser_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -12781,18 +12660,18 @@ def test_update_conversion_event_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_conversion_event), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: - client.update_conversion_event() + client.delete_display_video360_advertiser_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateConversionEventRequest() + assert args[0] == analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() @pytest.mark.asyncio -async def test_update_conversion_event_async( +async def test_delete_display_video360_advertiser_link_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateConversionEventRequest, + request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -12805,59 +12684,43 @@ async def test_update_conversion_event_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_conversion_event), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.ConversionEvent( - name="name_value", - event_name="event_name_value", - deletable=True, - custom=True, - counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, - ) - ) - response = await client.update_conversion_event(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateConversionEventRequest() + assert args[0] == analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.ConversionEvent) - assert response.name == "name_value" - assert response.event_name == "event_name_value" - assert response.deletable is True - assert response.custom is True - assert ( - response.counting_method - == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT - ) + assert response is None @pytest.mark.asyncio -async def test_update_conversion_event_async_from_dict(): - await test_update_conversion_event_async(request_type=dict) +async def test_delete_display_video360_advertiser_link_async_from_dict(): + await test_delete_display_video360_advertiser_link_async(request_type=dict) -def test_update_conversion_event_field_headers(): +def test_delete_display_video360_advertiser_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateConversionEventRequest() + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() - request.conversion_event.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_conversion_event), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: - call.return_value = resources.ConversionEvent() - client.update_conversion_event(request) + call.return_value = None + client.delete_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -12868,30 +12731,28 @@ def test_update_conversion_event_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "conversion_event.name=name_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_conversion_event_field_headers_async(): +async def test_delete_display_video360_advertiser_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateConversionEventRequest() + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() - request.conversion_event.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_conversion_event), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.ConversionEvent() - ) - await client.update_conversion_event(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -12902,41 +12763,37 @@ async def test_update_conversion_event_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "conversion_event.name=name_value", + "name=name_value", ) in kw["metadata"] -def test_update_conversion_event_flattened(): +def test_delete_display_video360_advertiser_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_conversion_event), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.ConversionEvent() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_conversion_event( - conversion_event=resources.ConversionEvent(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.delete_display_video360_advertiser_link( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].conversion_event - mock_val = resources.ConversionEvent(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_update_conversion_event_flattened_error(): +def test_delete_display_video360_advertiser_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -12944,50 +12801,43 @@ def test_update_conversion_event_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_conversion_event( - analytics_admin.UpdateConversionEventRequest(), - conversion_event=resources.ConversionEvent(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.delete_display_video360_advertiser_link( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_update_conversion_event_flattened_async(): +async def test_delete_display_video360_advertiser_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_conversion_event), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.ConversionEvent() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.ConversionEvent() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_conversion_event( - conversion_event=resources.ConversionEvent(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + response = await client.delete_display_video360_advertiser_link( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].conversion_event - mock_val = resources.ConversionEvent(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_update_conversion_event_flattened_error_async(): +async def test_delete_display_video360_advertiser_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -12995,21 +12845,20 @@ async def test_update_conversion_event_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_conversion_event( - analytics_admin.UpdateConversionEventRequest(), - conversion_event=resources.ConversionEvent(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + await client.delete_display_video360_advertiser_link( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetConversionEventRequest, + analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, dict, ], ) -def test_get_conversion_event(request_type, transport: str = "grpc"): +def test_update_display_video360_advertiser_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -13021,36 +12870,29 @@ def test_get_conversion_event(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_conversion_event), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.ConversionEvent( + call.return_value = resources.DisplayVideo360AdvertiserLink( name="name_value", - event_name="event_name_value", - deletable=True, - custom=True, - counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) - response = client.get_conversion_event(request) + response = client.update_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetConversionEventRequest() + assert args[0] == analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.ConversionEvent) + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) assert response.name == "name_value" - assert response.event_name == "event_name_value" - assert response.deletable is True - assert response.custom is True - assert ( - response.counting_method - == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT - ) + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_get_conversion_event_empty_call(): +def test_update_display_video360_advertiser_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -13060,18 +12902,18 @@ def test_get_conversion_event_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_conversion_event), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: - client.get_conversion_event() + client.update_display_video360_advertiser_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetConversionEventRequest() + assert args[0] == analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() @pytest.mark.asyncio -async def test_get_conversion_event_async( +async def test_update_display_video360_advertiser_link_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetConversionEventRequest, + request_type=analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13084,59 +12926,52 @@ async def test_get_conversion_event_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_conversion_event), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.ConversionEvent( + resources.DisplayVideo360AdvertiserLink( name="name_value", - event_name="event_name_value", - deletable=True, - custom=True, - counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) ) - response = await client.get_conversion_event(request) + response = await client.update_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetConversionEventRequest() + assert args[0] == analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.ConversionEvent) + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) assert response.name == "name_value" - assert response.event_name == "event_name_value" - assert response.deletable is True - assert response.custom is True - assert ( - response.counting_method - == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT - ) + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" @pytest.mark.asyncio -async def test_get_conversion_event_async_from_dict(): - await test_get_conversion_event_async(request_type=dict) +async def test_update_display_video360_advertiser_link_async_from_dict(): + await test_update_display_video360_advertiser_link_async(request_type=dict) -def test_get_conversion_event_field_headers(): +def test_update_display_video360_advertiser_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetConversionEventRequest() + request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() - request.name = "name_value" + request.display_video_360_advertiser_link.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_conversion_event), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: - call.return_value = resources.ConversionEvent() - client.get_conversion_event(request) + call.return_value = resources.DisplayVideo360AdvertiserLink() + client.update_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -13147,30 +12982,30 @@ def test_get_conversion_event_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "display_video_360_advertiser_link.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_conversion_event_field_headers_async(): +async def test_update_display_video360_advertiser_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetConversionEventRequest() + request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() - request.name = "name_value" + request.display_video_360_advertiser_link.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_conversion_event), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.ConversionEvent() + resources.DisplayVideo360AdvertiserLink() ) - await client.get_conversion_event(request) + await client.update_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -13181,37 +13016,43 @@ async def test_get_conversion_event_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "display_video_360_advertiser_link.name=name_value", ) in kw["metadata"] -def test_get_conversion_event_flattened(): +def test_update_display_video360_advertiser_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_conversion_event), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.ConversionEvent() + call.return_value = resources.DisplayVideo360AdvertiserLink() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_conversion_event( - name="name_value", + client.update_display_video360_advertiser_link( + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].display_video_360_advertiser_link + mock_val = resources.DisplayVideo360AdvertiserLink(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_get_conversion_event_flattened_error(): +def test_update_display_video360_advertiser_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -13219,45 +13060,54 @@ def test_get_conversion_event_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_conversion_event( - analytics_admin.GetConversionEventRequest(), - name="name_value", + client.update_display_video360_advertiser_link( + analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(), + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_get_conversion_event_flattened_async(): +async def test_update_display_video360_advertiser_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_conversion_event), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.ConversionEvent() + call.return_value = resources.DisplayVideo360AdvertiserLink() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.ConversionEvent() + resources.DisplayVideo360AdvertiserLink() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_conversion_event( - name="name_value", + response = await client.update_display_video360_advertiser_link( + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].display_video_360_advertiser_link + mock_val = resources.DisplayVideo360AdvertiserLink(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val @pytest.mark.asyncio -async def test_get_conversion_event_flattened_error_async(): +async def test_update_display_video360_advertiser_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -13265,20 +13115,25 @@ async def test_get_conversion_event_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_conversion_event( - analytics_admin.GetConversionEventRequest(), - name="name_value", + await client.update_display_video360_advertiser_link( + analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(), + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteConversionEventRequest, + analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, dict, ], ) -def test_delete_conversion_event(request_type, transport: str = "grpc"): +def test_get_display_video360_advertiser_link_proposal( + request_type, transport: str = "grpc" +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -13290,22 +13145,33 @@ def test_delete_conversion_event(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_conversion_event), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_conversion_event(request) + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", + ) + response = client.get_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteConversionEventRequest() + assert ( + args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() + ) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" -def test_delete_conversion_event_empty_call(): +def test_get_display_video360_advertiser_link_proposal_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -13315,18 +13181,20 @@ def test_delete_conversion_event_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_conversion_event), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: - client.delete_conversion_event() + client.get_display_video360_advertiser_link_proposal() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteConversionEventRequest() + assert ( + args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() + ) @pytest.mark.asyncio -async def test_delete_conversion_event_async( +async def test_get_display_video360_advertiser_link_proposal_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteConversionEventRequest, + request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13339,43 +13207,56 @@ async def test_delete_conversion_event_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_conversion_event), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_conversion_event(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", + ) + ) + response = await client.get_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteConversionEventRequest() + assert ( + args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() + ) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" @pytest.mark.asyncio -async def test_delete_conversion_event_async_from_dict(): - await test_delete_conversion_event_async(request_type=dict) +async def test_get_display_video360_advertiser_link_proposal_async_from_dict(): + await test_get_display_video360_advertiser_link_proposal_async(request_type=dict) -def test_delete_conversion_event_field_headers(): +def test_get_display_video360_advertiser_link_proposal_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteConversionEventRequest() + request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_conversion_event), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: - call.return_value = None - client.delete_conversion_event(request) + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + client.get_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -13391,23 +13272,25 @@ def test_delete_conversion_event_field_headers(): @pytest.mark.asyncio -async def test_delete_conversion_event_field_headers_async(): +async def test_get_display_video360_advertiser_link_proposal_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteConversionEventRequest() + request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_conversion_event), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_conversion_event(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DisplayVideo360AdvertiserLinkProposal() + ) + await client.get_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -13422,20 +13305,20 @@ async def test_delete_conversion_event_field_headers_async(): ) in kw["metadata"] -def test_delete_conversion_event_flattened(): +def test_get_display_video360_advertiser_link_proposal_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_conversion_event), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_conversion_event( + client.get_display_video360_advertiser_link_proposal( name="name_value", ) @@ -13448,7 +13331,7 @@ def test_delete_conversion_event_flattened(): assert arg == mock_val -def test_delete_conversion_event_flattened_error(): +def test_get_display_video360_advertiser_link_proposal_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -13456,29 +13339,31 @@ def test_delete_conversion_event_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_conversion_event( - analytics_admin.DeleteConversionEventRequest(), + client.get_display_video360_advertiser_link_proposal( + analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_delete_conversion_event_flattened_async(): +async def test_get_display_video360_advertiser_link_proposal_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_conversion_event), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DisplayVideo360AdvertiserLinkProposal() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_conversion_event( + response = await client.get_display_video360_advertiser_link_proposal( name="name_value", ) @@ -13492,7 +13377,7 @@ async def test_delete_conversion_event_flattened_async(): @pytest.mark.asyncio -async def test_delete_conversion_event_flattened_error_async(): +async def test_get_display_video360_advertiser_link_proposal_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -13500,8 +13385,8 @@ async def test_delete_conversion_event_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.delete_conversion_event( - analytics_admin.DeleteConversionEventRequest(), + await client.get_display_video360_advertiser_link_proposal( + analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest(), name="name_value", ) @@ -13509,11 +13394,13 @@ async def test_delete_conversion_event_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListConversionEventsRequest, + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, dict, ], ) -def test_list_conversion_events(request_type, transport: str = "grpc"): +def test_list_display_video360_advertiser_link_proposals( + request_type, transport: str = "grpc" +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -13525,25 +13412,31 @@ def test_list_conversion_events(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_conversion_events), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListConversionEventsResponse( - next_page_token="next_page_token_value", + call.return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + next_page_token="next_page_token_value", + ) ) - response = client.list_conversion_events(request) + response = client.list_display_video360_advertiser_link_proposals(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListConversionEventsRequest() + assert ( + args[0] + == analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListConversionEventsPager) + assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinkProposalsPager) assert response.next_page_token == "next_page_token_value" -def test_list_conversion_events_empty_call(): +def test_list_display_video360_advertiser_link_proposals_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -13553,18 +13446,22 @@ def test_list_conversion_events_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_conversion_events), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: - client.list_conversion_events() + client.list_display_video360_advertiser_link_proposals() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListConversionEventsRequest() + assert ( + args[0] + == analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() + ) @pytest.mark.asyncio -async def test_list_conversion_events_async( +async def test_list_display_video360_advertiser_link_proposals_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListConversionEventsRequest, + request_type=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -13577,48 +13474,57 @@ async def test_list_conversion_events_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_conversion_events), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListConversionEventsResponse( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( next_page_token="next_page_token_value", ) ) - response = await client.list_conversion_events(request) + response = await client.list_display_video360_advertiser_link_proposals(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListConversionEventsRequest() + assert ( + args[0] + == analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListConversionEventsAsyncPager) + assert isinstance( + response, pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager + ) assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_list_conversion_events_async_from_dict(): - await test_list_conversion_events_async(request_type=dict) +async def test_list_display_video360_advertiser_link_proposals_async_from_dict(): + await test_list_display_video360_advertiser_link_proposals_async(request_type=dict) -def test_list_conversion_events_field_headers(): +def test_list_display_video360_advertiser_link_proposals_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListConversionEventsRequest() + request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_conversion_events), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: - call.return_value = analytics_admin.ListConversionEventsResponse() - client.list_conversion_events(request) + call.return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() + ) + client.list_display_video360_advertiser_link_proposals(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -13634,25 +13540,26 @@ def test_list_conversion_events_field_headers(): @pytest.mark.asyncio -async def test_list_conversion_events_field_headers_async(): +async def test_list_display_video360_advertiser_link_proposals_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListConversionEventsRequest() + request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_conversion_events), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListConversionEventsResponse() + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() ) - await client.list_conversion_events(request) + await client.list_display_video360_advertiser_link_proposals(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -13667,20 +13574,23 @@ async def test_list_conversion_events_field_headers_async(): ) in kw["metadata"] -def test_list_conversion_events_flattened(): +def test_list_display_video360_advertiser_link_proposals_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_conversion_events), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListConversionEventsResponse() + call.return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_conversion_events( + client.list_display_video360_advertiser_link_proposals( parent="parent_value", ) @@ -13693,7 +13603,7 @@ def test_list_conversion_events_flattened(): assert arg == mock_val -def test_list_conversion_events_flattened_error(): +def test_list_display_video360_advertiser_link_proposals_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -13701,31 +13611,34 @@ def test_list_conversion_events_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_conversion_events( - analytics_admin.ListConversionEventsRequest(), + client.list_display_video360_advertiser_link_proposals( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest(), parent="parent_value", ) @pytest.mark.asyncio -async def test_list_conversion_events_flattened_async(): +async def test_list_display_video360_advertiser_link_proposals_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_conversion_events), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListConversionEventsResponse() + call.return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() + ) call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListConversionEventsResponse() + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_conversion_events( + response = await client.list_display_video360_advertiser_link_proposals( parent="parent_value", ) @@ -13739,7 +13652,7 @@ async def test_list_conversion_events_flattened_async(): @pytest.mark.asyncio -async def test_list_conversion_events_flattened_error_async(): +async def test_list_display_video360_advertiser_link_proposals_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -13747,13 +13660,15 @@ async def test_list_conversion_events_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_conversion_events( - analytics_admin.ListConversionEventsRequest(), + await client.list_display_video360_advertiser_link_proposals( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest(), parent="parent_value", ) -def test_list_conversion_events_pager(transport_name: str = "grpc"): +def test_list_display_video360_advertiser_link_proposals_pager( + transport_name: str = "grpc", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials, transport=transport_name, @@ -13761,32 +13676,33 @@ def test_list_conversion_events_pager(transport_name: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_conversion_events), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), - resources.ConversionEvent(), - resources.ConversionEvent(), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), ], next_page_token="abc", ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[], + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[], next_page_token="def", ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), ], next_page_token="ghi", ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), - resources.ConversionEvent(), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), ], ), RuntimeError, @@ -13796,16 +13712,21 @@ def test_list_conversion_events_pager(transport_name: str = "grpc"): metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), ) - pager = client.list_conversion_events(request={}) + pager = client.list_display_video360_advertiser_link_proposals(request={}) assert pager._metadata == metadata results = list(pager) assert len(results) == 6 - assert all(isinstance(i, resources.ConversionEvent) for i in results) + assert all( + isinstance(i, resources.DisplayVideo360AdvertiserLinkProposal) + for i in results + ) -def test_list_conversion_events_pages(transport_name: str = "grpc"): +def test_list_display_video360_advertiser_link_proposals_pages( + transport_name: str = "grpc", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials, transport=transport_name, @@ -13813,82 +13734,85 @@ def test_list_conversion_events_pages(transport_name: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_conversion_events), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), - resources.ConversionEvent(), - resources.ConversionEvent(), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), ], next_page_token="abc", ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[], + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[], next_page_token="def", ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), ], next_page_token="ghi", ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), - resources.ConversionEvent(), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), ], ), RuntimeError, ) - pages = list(client.list_conversion_events(request={}).pages) + pages = list( + client.list_display_video360_advertiser_link_proposals(request={}).pages + ) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_list_conversion_events_async_pager(): +async def test_list_display_video360_advertiser_link_proposals_async_pager(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_conversion_events), + type(client.transport.list_display_video360_advertiser_link_proposals), "__call__", new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), - resources.ConversionEvent(), - resources.ConversionEvent(), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), ], next_page_token="abc", ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[], + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[], next_page_token="def", ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), ], next_page_token="ghi", ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), - resources.ConversionEvent(), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), ], ), RuntimeError, ) - async_pager = await client.list_conversion_events( + async_pager = await client.list_display_video360_advertiser_link_proposals( request={}, ) assert async_pager.next_page_token == "abc" @@ -13897,45 +13821,48 @@ async def test_list_conversion_events_async_pager(): responses.append(response) assert len(responses) == 6 - assert all(isinstance(i, resources.ConversionEvent) for i in responses) + assert all( + isinstance(i, resources.DisplayVideo360AdvertiserLinkProposal) + for i in responses + ) @pytest.mark.asyncio -async def test_list_conversion_events_async_pages(): +async def test_list_display_video360_advertiser_link_proposals_async_pages(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_conversion_events), + type(client.transport.list_display_video360_advertiser_link_proposals), "__call__", new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), - resources.ConversionEvent(), - resources.ConversionEvent(), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), ], next_page_token="abc", ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[], + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[], next_page_token="def", ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), ], next_page_token="ghi", ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), - resources.ConversionEvent(), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), ], ), RuntimeError, @@ -13944,7 +13871,7 @@ async def test_list_conversion_events_async_pages(): # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 async for page_ in ( # pragma: no branch - await client.list_conversion_events(request={}) + await client.list_display_video360_advertiser_link_proposals(request={}) ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): @@ -13954,11 +13881,13 @@ async def test_list_conversion_events_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, dict, ], ) -def test_get_display_video360_advertiser_link(request_type, transport: str = "grpc"): +def test_create_display_video360_advertiser_link_proposal( + request_type, transport: str = "grpc" +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -13970,29 +13899,35 @@ def test_get_display_video360_advertiser_link(request_type, transport: str = "gr # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLink( + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal( name="name_value", advertiser_id="advertiser_id_value", advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", ) - response = client.get_display_video360_advertiser_link(request) + response = client.create_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() + assert ( + args[0] + == analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) assert response.name == "name_value" assert response.advertiser_id == "advertiser_id_value" assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" -def test_get_display_video360_advertiser_link_empty_call(): +def test_create_display_video360_advertiser_link_proposal_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -14002,18 +13937,22 @@ def test_get_display_video360_advertiser_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: - client.get_display_video360_advertiser_link() + client.create_display_video360_advertiser_link_proposal() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() + assert ( + args[0] + == analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() + ) @pytest.mark.asyncio -async def test_get_display_video360_advertiser_link_async( +async def test_create_display_video360_advertiser_link_proposal_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, + request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14026,52 +13965,61 @@ async def test_get_display_video360_advertiser_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLink( + resources.DisplayVideo360AdvertiserLinkProposal( name="name_value", advertiser_id="advertiser_id_value", advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", ) ) - response = await client.get_display_video360_advertiser_link(request) + response = await client.create_display_video360_advertiser_link_proposal( + request + ) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() + assert ( + args[0] + == analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) assert response.name == "name_value" assert response.advertiser_id == "advertiser_id_value" assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" @pytest.mark.asyncio -async def test_get_display_video360_advertiser_link_async_from_dict(): - await test_get_display_video360_advertiser_link_async(request_type=dict) +async def test_create_display_video360_advertiser_link_proposal_async_from_dict(): + await test_create_display_video360_advertiser_link_proposal_async(request_type=dict) -def test_get_display_video360_advertiser_link_field_headers(): +def test_create_display_video360_advertiser_link_proposal_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: - call.return_value = resources.DisplayVideo360AdvertiserLink() - client.get_display_video360_advertiser_link(request) + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + client.create_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -14082,30 +14030,31 @@ def test_get_display_video360_advertiser_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_display_video360_advertiser_link_field_headers_async(): +async def test_create_display_video360_advertiser_link_proposal_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLink() + resources.DisplayVideo360AdvertiserLinkProposal() ) - await client.get_display_video360_advertiser_link(request) + await client.create_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -14116,37 +14065,44 @@ async def test_get_display_video360_advertiser_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_display_video360_advertiser_link_flattened(): +def test_create_display_video360_advertiser_link_proposal_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLink() + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_display_video360_advertiser_link( - name="name_value", + client.create_display_video360_advertiser_link_proposal( + parent="parent_value", + display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value" + ), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].display_video_360_advertiser_link_proposal + mock_val = resources.DisplayVideo360AdvertiserLinkProposal(name="name_value") assert arg == mock_val -def test_get_display_video360_advertiser_link_flattened_error(): +def test_create_display_video360_advertiser_link_proposal_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -14154,45 +14110,55 @@ def test_get_display_video360_advertiser_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_display_video360_advertiser_link( - analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(), - name="name_value", + client.create_display_video360_advertiser_link_proposal( + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest(), + parent="parent_value", + display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value" + ), ) @pytest.mark.asyncio -async def test_get_display_video360_advertiser_link_flattened_async(): +async def test_create_display_video360_advertiser_link_proposal_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLink() + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLink() + resources.DisplayVideo360AdvertiserLinkProposal() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_display_video360_advertiser_link( - name="name_value", + response = await client.create_display_video360_advertiser_link_proposal( + parent="parent_value", + display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value" + ), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].display_video_360_advertiser_link_proposal + mock_val = resources.DisplayVideo360AdvertiserLinkProposal(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_get_display_video360_advertiser_link_flattened_error_async(): +async def test_create_display_video360_advertiser_link_proposal_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -14200,20 +14166,25 @@ async def test_get_display_video360_advertiser_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_display_video360_advertiser_link( - analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(), - name="name_value", + await client.create_display_video360_advertiser_link_proposal( + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest(), + parent="parent_value", + display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value" + ), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, dict, ], ) -def test_list_display_video360_advertiser_links(request_type, transport: str = "grpc"): +def test_delete_display_video360_advertiser_link_proposal( + request_type, transport: str = "grpc" +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -14225,25 +14196,26 @@ def test_list_display_video360_advertiser_links(request_type, transport: str = " # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_links), "__call__" + type(client.transport.delete_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - next_page_token="next_page_token_value", - ) - response = client.list_display_video360_advertiser_links(request) + call.return_value = None + response = client.delete_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() + assert ( + args[0] + == analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinksPager) - assert response.next_page_token == "next_page_token_value" + assert response is None -def test_list_display_video360_advertiser_links_empty_call(): +def test_delete_display_video360_advertiser_link_proposal_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -14253,18 +14225,22 @@ def test_list_display_video360_advertiser_links_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_links), "__call__" + type(client.transport.delete_display_video360_advertiser_link_proposal), + "__call__", ) as call: - client.list_display_video360_advertiser_links() + client.delete_display_video360_advertiser_link_proposal() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() + assert ( + args[0] + == analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() + ) @pytest.mark.asyncio -async def test_list_display_video360_advertiser_links_async( +async def test_delete_display_video360_advertiser_link_proposal_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, + request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14277,48 +14253,50 @@ async def test_list_display_video360_advertiser_links_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_links), "__call__" + type(client.transport.delete_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - next_page_token="next_page_token_value", - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_display_video360_advertiser_link_proposal( + request ) - response = await client.list_display_video360_advertiser_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() + assert ( + args[0] + == analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinksAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert response is None @pytest.mark.asyncio -async def test_list_display_video360_advertiser_links_async_from_dict(): - await test_list_display_video360_advertiser_links_async(request_type=dict) +async def test_delete_display_video360_advertiser_link_proposal_async_from_dict(): + await test_delete_display_video360_advertiser_link_proposal_async(request_type=dict) -def test_list_display_video360_advertiser_links_field_headers(): +def test_delete_display_video360_advertiser_link_proposal_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_links), "__call__" + type(client.transport.delete_display_video360_advertiser_link_proposal), + "__call__", ) as call: - call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() - client.list_display_video360_advertiser_links(request) + call.return_value = None + client.delete_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -14329,30 +14307,29 @@ def test_list_display_video360_advertiser_links_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_display_video360_advertiser_links_field_headers_async(): +async def test_delete_display_video360_advertiser_link_proposal_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_links), "__call__" + type(client.transport.delete_display_video360_advertiser_link_proposal), + "__call__", ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() - ) - await client.list_display_video360_advertiser_links(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -14363,37 +14340,38 @@ async def test_list_display_video360_advertiser_links_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_list_display_video360_advertiser_links_flattened(): +def test_delete_display_video360_advertiser_link_proposal_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_links), "__call__" + type(client.transport.delete_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_display_video360_advertiser_links( - parent="parent_value", + client.delete_display_video360_advertiser_link_proposal( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_list_display_video360_advertiser_links_flattened_error(): +def test_delete_display_video360_advertiser_link_proposal_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -14401,45 +14379,44 @@ def test_list_display_video360_advertiser_links_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_display_video360_advertiser_links( - analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(), - parent="parent_value", + client.delete_display_video360_advertiser_link_proposal( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_list_display_video360_advertiser_links_flattened_async(): +async def test_delete_display_video360_advertiser_link_proposal_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_links), "__call__" + type(client.transport.delete_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_display_video360_advertiser_links( - parent="parent_value", + response = await client.delete_display_video360_advertiser_link_proposal( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_list_display_video360_advertiser_links_flattened_error_async(): +async def test_delete_display_video360_advertiser_link_proposal_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -14447,222 +14424,205 @@ async def test_list_display_video360_advertiser_links_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_display_video360_advertiser_links( - analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(), - parent="parent_value", + await client.delete_display_video360_advertiser_link_proposal( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest(), + name="name_value", ) -def test_list_display_video360_advertiser_links_pager(transport_name: str = "grpc"): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, + dict, + ], +) +def test_approve_display_video360_advertiser_link_proposal( + request_type, transport: str = "grpc" +): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_links), "__call__" + type(client.transport.approve_display_video360_advertiser_link_proposal), + "__call__", ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[], - next_page_token="def", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - ], - ), - RuntimeError, + # Designate an appropriate return value for the call. + call.return_value = ( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() ) + response = client.approve_display_video360_advertiser_link_proposal(request) - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert ( + args[0] + == analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() ) - pager = client.list_display_video360_advertiser_links(request={}) - - assert pager._metadata == metadata - results = list(pager) - assert len(results) == 6 - assert all( - isinstance(i, resources.DisplayVideo360AdvertiserLink) for i in results - ) + # Establish that the response is the type that we expect. + assert isinstance( + response, analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse + ) -def test_list_display_video360_advertiser_links_pages(transport_name: str = "grpc"): +def test_approve_display_video360_advertiser_link_proposal_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_links), "__call__" + type(client.transport.approve_display_video360_advertiser_link_proposal), + "__call__", ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[], - next_page_token="def", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - ], - ), - RuntimeError, + client.approve_display_video360_advertiser_link_proposal() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert ( + args[0] + == analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() ) - pages = list(client.list_display_video360_advertiser_links(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_list_display_video360_advertiser_links_async_pager(): +async def test_approve_display_video360_advertiser_link_proposal_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, +): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_links), + type(client.transport.approve_display_video360_advertiser_link_proposal), "__call__", - new_callable=mock.AsyncMock, ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[], - next_page_token="def", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - ], - ), - RuntimeError, + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() ) - async_pager = await client.list_display_video360_advertiser_links( - request={}, + response = await client.approve_display_video360_advertiser_link_proposal( + request ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - assert len(responses) == 6 - assert all( - isinstance(i, resources.DisplayVideo360AdvertiserLink) for i in responses + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert ( + args[0] + == analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() ) + # Establish that the response is the type that we expect. + assert isinstance( + response, analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse + ) + @pytest.mark.asyncio -async def test_list_display_video360_advertiser_links_async_pages(): +async def test_approve_display_video360_advertiser_link_proposal_async_from_dict(): + await test_approve_display_video360_advertiser_link_proposal_async( + request_type=dict + ) + + +def test_approve_display_video360_advertiser_link_proposal_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + call.return_value = ( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() + ) + client.approve_display_video360_advertiser_link_proposal(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_approve_display_video360_advertiser_link_proposal_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), ) + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() + + request.name = "name_value" + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_links), + type(client.transport.approve_display_video360_advertiser_link_proposal), "__call__", - new_callable=mock.AsyncMock, ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[], - next_page_token="def", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - ], - ), - RuntimeError, + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_display_video360_advertiser_links(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token + await client.approve_display_video360_advertiser_link_proposal(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, + analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, dict, ], ) -def test_create_display_video360_advertiser_link(request_type, transport: str = "grpc"): +def test_cancel_display_video360_advertiser_link_proposal( + request_type, transport: str = "grpc" +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -14674,29 +14634,35 @@ def test_create_display_video360_advertiser_link(request_type, transport: str = # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link), "__call__" + type(client.transport.cancel_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLink( + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal( name="name_value", advertiser_id="advertiser_id_value", advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", ) - response = client.create_display_video360_advertiser_link(request) + response = client.cancel_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() + assert ( + args[0] + == analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) assert response.name == "name_value" assert response.advertiser_id == "advertiser_id_value" assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" -def test_create_display_video360_advertiser_link_empty_call(): +def test_cancel_display_video360_advertiser_link_proposal_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -14706,18 +14672,22 @@ def test_create_display_video360_advertiser_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link), "__call__" + type(client.transport.cancel_display_video360_advertiser_link_proposal), + "__call__", ) as call: - client.create_display_video360_advertiser_link() + client.cancel_display_video360_advertiser_link_proposal() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() + assert ( + args[0] + == analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() + ) @pytest.mark.asyncio -async def test_create_display_video360_advertiser_link_async( +async def test_cancel_display_video360_advertiser_link_proposal_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, + request_type=analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14730,52 +14700,61 @@ async def test_create_display_video360_advertiser_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link), "__call__" + type(client.transport.cancel_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLink( + resources.DisplayVideo360AdvertiserLinkProposal( name="name_value", advertiser_id="advertiser_id_value", advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", ) ) - response = await client.create_display_video360_advertiser_link(request) + response = await client.cancel_display_video360_advertiser_link_proposal( + request + ) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() + assert ( + args[0] + == analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) assert response.name == "name_value" assert response.advertiser_id == "advertiser_id_value" assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" @pytest.mark.asyncio -async def test_create_display_video360_advertiser_link_async_from_dict(): - await test_create_display_video360_advertiser_link_async(request_type=dict) +async def test_cancel_display_video360_advertiser_link_proposal_async_from_dict(): + await test_cancel_display_video360_advertiser_link_proposal_async(request_type=dict) -def test_create_display_video360_advertiser_link_field_headers(): +def test_cancel_display_video360_advertiser_link_proposal_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() + request = analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link), "__call__" + type(client.transport.cancel_display_video360_advertiser_link_proposal), + "__call__", ) as call: - call.return_value = resources.DisplayVideo360AdvertiserLink() - client.create_display_video360_advertiser_link(request) + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + client.cancel_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -14786,30 +14765,31 @@ def test_create_display_video360_advertiser_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_create_display_video360_advertiser_link_field_headers_async(): +async def test_cancel_display_video360_advertiser_link_proposal_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() + request = analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link), "__call__" + type(client.transport.cancel_display_video360_advertiser_link_proposal), + "__call__", ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLink() + resources.DisplayVideo360AdvertiserLinkProposal() ) - await client.create_display_video360_advertiser_link(request) + await client.cancel_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -14820,122 +14800,18 @@ async def test_create_display_video360_advertiser_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_create_display_video360_advertiser_link_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLink() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.create_display_video360_advertiser_link( - parent="parent_value", - display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( - name="name_value" - ), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].display_video_360_advertiser_link - mock_val = resources.DisplayVideo360AdvertiserLink(name="name_value") - assert arg == mock_val - - -def test_create_display_video360_advertiser_link_flattened_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_display_video360_advertiser_link( - analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(), - parent="parent_value", - display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( - name="name_value" - ), - ) - - -@pytest.mark.asyncio -async def test_create_display_video360_advertiser_link_flattened_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLink() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLink() - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.create_display_video360_advertiser_link( - parent="parent_value", - display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( - name="name_value" - ), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].display_video_360_advertiser_link - mock_val = resources.DisplayVideo360AdvertiserLink(name="name_value") - assert arg == mock_val - - -@pytest.mark.asyncio -async def test_create_display_video360_advertiser_link_flattened_error_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.create_display_video360_advertiser_link( - analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(), - parent="parent_value", - display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( - name="name_value" - ), - ) - - @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, + analytics_admin.CreateCustomDimensionRequest, dict, ], ) -def test_delete_display_video360_advertiser_link(request_type, transport: str = "grpc"): +def test_create_custom_dimension(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -14947,22 +14823,35 @@ def test_delete_display_video360_advertiser_link(request_type, transport: str = # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link), "__call__" + type(client.transport.create_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_display_video360_advertiser_link(request) + call.return_value = resources.CustomDimension( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, + ) + response = client.create_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() + assert args[0] == analytics_admin.CreateCustomDimensionRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.CustomDimension) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True -def test_delete_display_video360_advertiser_link_empty_call(): +def test_create_custom_dimension_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -14972,18 +14861,18 @@ def test_delete_display_video360_advertiser_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link), "__call__" + type(client.transport.create_custom_dimension), "__call__" ) as call: - client.delete_display_video360_advertiser_link() + client.create_custom_dimension() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() + assert args[0] == analytics_admin.CreateCustomDimensionRequest() @pytest.mark.asyncio -async def test_delete_display_video360_advertiser_link_async( +async def test_create_custom_dimension_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, + request_type=analytics_admin.CreateCustomDimensionRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -14996,43 +14885,58 @@ async def test_delete_display_video360_advertiser_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link), "__call__" + type(client.transport.create_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_display_video360_advertiser_link(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, + ) + ) + response = await client.create_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() + assert args[0] == analytics_admin.CreateCustomDimensionRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.CustomDimension) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True @pytest.mark.asyncio -async def test_delete_display_video360_advertiser_link_async_from_dict(): - await test_delete_display_video360_advertiser_link_async(request_type=dict) +async def test_create_custom_dimension_async_from_dict(): + await test_create_custom_dimension_async(request_type=dict) -def test_delete_display_video360_advertiser_link_field_headers(): +def test_create_custom_dimension_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() + request = analytics_admin.CreateCustomDimensionRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link), "__call__" + type(client.transport.create_custom_dimension), "__call__" ) as call: - call.return_value = None - client.delete_display_video360_advertiser_link(request) + call.return_value = resources.CustomDimension() + client.create_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -15043,28 +14947,30 @@ def test_delete_display_video360_advertiser_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_delete_display_video360_advertiser_link_field_headers_async(): +async def test_create_custom_dimension_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() + request = analytics_admin.CreateCustomDimensionRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link), "__call__" + type(client.transport.create_custom_dimension), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_display_video360_advertiser_link(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension() + ) + await client.create_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -15075,37 +14981,41 @@ async def test_delete_display_video360_advertiser_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_delete_display_video360_advertiser_link_flattened(): +def test_create_custom_dimension_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link), "__call__" + type(client.transport.create_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.CustomDimension() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_display_video360_advertiser_link( - name="name_value", + client.create_custom_dimension( + parent="parent_value", + custom_dimension=resources.CustomDimension(name="name_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].custom_dimension + mock_val = resources.CustomDimension(name="name_value") assert arg == mock_val -def test_delete_display_video360_advertiser_link_flattened_error(): +def test_create_custom_dimension_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -15113,43 +15023,50 @@ def test_delete_display_video360_advertiser_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_display_video360_advertiser_link( - analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(), - name="name_value", + client.create_custom_dimension( + analytics_admin.CreateCustomDimensionRequest(), + parent="parent_value", + custom_dimension=resources.CustomDimension(name="name_value"), ) @pytest.mark.asyncio -async def test_delete_display_video360_advertiser_link_flattened_async(): +async def test_create_custom_dimension_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link), "__call__" + type(client.transport.create_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.CustomDimension() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_display_video360_advertiser_link( - name="name_value", + response = await client.create_custom_dimension( + parent="parent_value", + custom_dimension=resources.CustomDimension(name="name_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].custom_dimension + mock_val = resources.CustomDimension(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_delete_display_video360_advertiser_link_flattened_error_async(): +async def test_create_custom_dimension_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -15157,20 +15074,21 @@ async def test_delete_display_video360_advertiser_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.delete_display_video360_advertiser_link( - analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(), - name="name_value", + await client.create_custom_dimension( + analytics_admin.CreateCustomDimensionRequest(), + parent="parent_value", + custom_dimension=resources.CustomDimension(name="name_value"), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, + analytics_admin.UpdateCustomDimensionRequest, dict, ], ) -def test_update_display_video360_advertiser_link(request_type, transport: str = "grpc"): +def test_update_custom_dimension(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -15182,29 +15100,35 @@ def test_update_display_video360_advertiser_link(request_type, transport: str = # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_display_video360_advertiser_link), "__call__" + type(client.transport.update_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLink( + call.return_value = resources.CustomDimension( name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - ) - response = client.update_display_video360_advertiser_link(request) - - # Establish that the underlying gRPC stub method was called. + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, + ) + response = client.update_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() + assert args[0] == analytics_admin.UpdateCustomDimensionRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert isinstance(response, resources.CustomDimension) assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True -def test_update_display_video360_advertiser_link_empty_call(): +def test_update_custom_dimension_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -15214,18 +15138,18 @@ def test_update_display_video360_advertiser_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_display_video360_advertiser_link), "__call__" + type(client.transport.update_custom_dimension), "__call__" ) as call: - client.update_display_video360_advertiser_link() + client.update_custom_dimension() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() + assert args[0] == analytics_admin.UpdateCustomDimensionRequest() @pytest.mark.asyncio -async def test_update_display_video360_advertiser_link_async( +async def test_update_custom_dimension_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, + request_type=analytics_admin.UpdateCustomDimensionRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15238,52 +15162,58 @@ async def test_update_display_video360_advertiser_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_display_video360_advertiser_link), "__call__" + type(client.transport.update_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLink( + resources.CustomDimension( name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, ) ) - response = await client.update_display_video360_advertiser_link(request) + response = await client.update_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() + assert args[0] == analytics_admin.UpdateCustomDimensionRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert isinstance(response, resources.CustomDimension) assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True @pytest.mark.asyncio -async def test_update_display_video360_advertiser_link_async_from_dict(): - await test_update_display_video360_advertiser_link_async(request_type=dict) +async def test_update_custom_dimension_async_from_dict(): + await test_update_custom_dimension_async(request_type=dict) -def test_update_display_video360_advertiser_link_field_headers(): +def test_update_custom_dimension_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() + request = analytics_admin.UpdateCustomDimensionRequest() - request.display_video_360_advertiser_link.name = "name_value" + request.custom_dimension.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_display_video360_advertiser_link), "__call__" + type(client.transport.update_custom_dimension), "__call__" ) as call: - call.return_value = resources.DisplayVideo360AdvertiserLink() - client.update_display_video360_advertiser_link(request) + call.return_value = resources.CustomDimension() + client.update_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -15294,30 +15224,30 @@ def test_update_display_video360_advertiser_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "display_video_360_advertiser_link.name=name_value", + "custom_dimension.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_display_video360_advertiser_link_field_headers_async(): +async def test_update_custom_dimension_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() + request = analytics_admin.UpdateCustomDimensionRequest() - request.display_video_360_advertiser_link.name = "name_value" + request.custom_dimension.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_display_video360_advertiser_link), "__call__" + type(client.transport.update_custom_dimension), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLink() + resources.CustomDimension() ) - await client.update_display_video360_advertiser_link(request) + await client.update_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -15328,27 +15258,25 @@ async def test_update_display_video360_advertiser_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "display_video_360_advertiser_link.name=name_value", + "custom_dimension.name=name_value", ) in kw["metadata"] -def test_update_display_video360_advertiser_link_flattened(): +def test_update_custom_dimension_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_display_video360_advertiser_link), "__call__" + type(client.transport.update_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLink() + call.return_value = resources.CustomDimension() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_display_video360_advertiser_link( - display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( - name="name_value" - ), + client.update_custom_dimension( + custom_dimension=resources.CustomDimension(name="name_value"), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -15356,15 +15284,15 @@ def test_update_display_video360_advertiser_link_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].display_video_360_advertiser_link - mock_val = resources.DisplayVideo360AdvertiserLink(name="name_value") + arg = args[0].custom_dimension + mock_val = resources.CustomDimension(name="name_value") assert arg == mock_val arg = args[0].update_mask mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_update_display_video360_advertiser_link_flattened_error(): +def test_update_custom_dimension_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -15372,37 +15300,33 @@ def test_update_display_video360_advertiser_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_display_video360_advertiser_link( - analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(), - display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( - name="name_value" - ), + client.update_custom_dimension( + analytics_admin.UpdateCustomDimensionRequest(), + custom_dimension=resources.CustomDimension(name="name_value"), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_update_display_video360_advertiser_link_flattened_async(): +async def test_update_custom_dimension_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_display_video360_advertiser_link), "__call__" + type(client.transport.update_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLink() + call.return_value = resources.CustomDimension() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLink() + resources.CustomDimension() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_display_video360_advertiser_link( - display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( - name="name_value" - ), + response = await client.update_custom_dimension( + custom_dimension=resources.CustomDimension(name="name_value"), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -15410,8 +15334,8 @@ async def test_update_display_video360_advertiser_link_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].display_video_360_advertiser_link - mock_val = resources.DisplayVideo360AdvertiserLink(name="name_value") + arg = args[0].custom_dimension + mock_val = resources.CustomDimension(name="name_value") assert arg == mock_val arg = args[0].update_mask mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) @@ -15419,7 +15343,7 @@ async def test_update_display_video360_advertiser_link_flattened_async(): @pytest.mark.asyncio -async def test_update_display_video360_advertiser_link_flattened_error_async(): +async def test_update_custom_dimension_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -15427,11 +15351,9 @@ async def test_update_display_video360_advertiser_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_display_video360_advertiser_link( - analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(), - display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( - name="name_value" - ), + await client.update_custom_dimension( + analytics_admin.UpdateCustomDimensionRequest(), + custom_dimension=resources.CustomDimension(name="name_value"), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -15439,13 +15361,11 @@ async def test_update_display_video360_advertiser_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, + analytics_admin.ListCustomDimensionsRequest, dict, ], ) -def test_get_display_video360_advertiser_link_proposal( - request_type, transport: str = "grpc" -): +def test_list_custom_dimensions(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -15457,33 +15377,25 @@ def test_get_display_video360_advertiser_link_proposal( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" + type(client.transport.list_custom_dimensions), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLinkProposal( - name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - validation_email="validation_email_value", + call.return_value = analytics_admin.ListCustomDimensionsResponse( + next_page_token="next_page_token_value", ) - response = client.get_display_video360_advertiser_link_proposal(request) + response = client.list_custom_dimensions(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.ListCustomDimensionsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) - assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" - assert response.validation_email == "validation_email_value" + assert isinstance(response, pagers.ListCustomDimensionsPager) + assert response.next_page_token == "next_page_token_value" -def test_get_display_video360_advertiser_link_proposal_empty_call(): +def test_list_custom_dimensions_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -15493,20 +15405,18 @@ def test_get_display_video360_advertiser_link_proposal_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" + type(client.transport.list_custom_dimensions), "__call__" ) as call: - client.get_display_video360_advertiser_link_proposal() + client.list_custom_dimensions() call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.ListCustomDimensionsRequest() @pytest.mark.asyncio -async def test_get_display_video360_advertiser_link_proposal_async( +async def test_list_custom_dimensions_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, + request_type=analytics_admin.ListCustomDimensionsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -15519,56 +15429,48 @@ async def test_get_display_video360_advertiser_link_proposal_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" + type(client.transport.list_custom_dimensions), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLinkProposal( - name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - validation_email="validation_email_value", + analytics_admin.ListCustomDimensionsResponse( + next_page_token="next_page_token_value", ) ) - response = await client.get_display_video360_advertiser_link_proposal(request) + response = await client.list_custom_dimensions(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert ( - args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.ListCustomDimensionsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) - assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" - assert response.validation_email == "validation_email_value" + assert isinstance(response, pagers.ListCustomDimensionsAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_get_display_video360_advertiser_link_proposal_async_from_dict(): - await test_get_display_video360_advertiser_link_proposal_async(request_type=dict) +async def test_list_custom_dimensions_async_from_dict(): + await test_list_custom_dimensions_async(request_type=dict) -def test_get_display_video360_advertiser_link_proposal_field_headers(): +def test_list_custom_dimensions_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.ListCustomDimensionsRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" + type(client.transport.list_custom_dimensions), "__call__" ) as call: - call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() - client.get_display_video360_advertiser_link_proposal(request) + call.return_value = analytics_admin.ListCustomDimensionsResponse() + client.list_custom_dimensions(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -15579,30 +15481,30 @@ def test_get_display_video360_advertiser_link_proposal_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_display_video360_advertiser_link_proposal_field_headers_async(): +async def test_list_custom_dimensions_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.ListCustomDimensionsRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" + type(client.transport.list_custom_dimensions), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLinkProposal() + analytics_admin.ListCustomDimensionsResponse() ) - await client.get_display_video360_advertiser_link_proposal(request) + await client.list_custom_dimensions(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -15613,37 +15515,37 @@ async def test_get_display_video360_advertiser_link_proposal_field_headers_async _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_display_video360_advertiser_link_proposal_flattened(): +def test_list_custom_dimensions_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" + type(client.transport.list_custom_dimensions), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + call.return_value = analytics_admin.ListCustomDimensionsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_display_video360_advertiser_link_proposal( - name="name_value", + client.list_custom_dimensions( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val -def test_get_display_video360_advertiser_link_proposal_flattened_error(): +def test_list_custom_dimensions_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -15651,45 +15553,45 @@ def test_get_display_video360_advertiser_link_proposal_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_display_video360_advertiser_link_proposal( - analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest(), - name="name_value", + client.list_custom_dimensions( + analytics_admin.ListCustomDimensionsRequest(), + parent="parent_value", ) @pytest.mark.asyncio -async def test_get_display_video360_advertiser_link_proposal_flattened_async(): +async def test_list_custom_dimensions_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" + type(client.transport.list_custom_dimensions), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + call.return_value = analytics_admin.ListCustomDimensionsResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLinkProposal() + analytics_admin.ListCustomDimensionsResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_display_video360_advertiser_link_proposal( - name="name_value", + response = await client.list_custom_dimensions( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val @pytest.mark.asyncio -async def test_get_display_video360_advertiser_link_proposal_flattened_error_async(): +async def test_list_custom_dimensions_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -15697,484 +15599,195 @@ async def test_get_display_video360_advertiser_link_proposal_flattened_error_asy # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_display_video360_advertiser_link_proposal( - analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest(), - name="name_value", + await client.list_custom_dimensions( + analytics_admin.ListCustomDimensionsRequest(), + parent="parent_value", ) -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, - dict, - ], -) -def test_list_display_video360_advertiser_link_proposals( - request_type, transport: str = "grpc" -): +def test_list_custom_dimensions_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_link_proposals), - "__call__", + type(client.transport.list_custom_dimensions), "__call__" ) as call: - # Designate an appropriate return value for the call. - call.return_value = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - next_page_token="next_page_token_value", - ) + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + resources.CustomDimension(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[], + next_page_token="def", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + ], + next_page_token="ghi", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + ], + ), + RuntimeError, ) - response = client.list_display_video360_advertiser_link_proposals(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), ) + pager = client.list_custom_dimensions(request={}) - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinkProposalsPager) - assert response.next_page_token == "next_page_token_value" + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.CustomDimension) for i in results) -def test_list_display_video360_advertiser_link_proposals_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. +def test_list_custom_dimensions_pages(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_link_proposals), - "__call__", + type(client.transport.list_custom_dimensions), "__call__" ) as call: - client.list_display_video360_advertiser_link_proposals() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + resources.CustomDimension(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[], + next_page_token="def", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + ], + next_page_token="ghi", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + ], + ), + RuntimeError, ) + pages = list(client.list_custom_dimensions(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_list_display_video360_advertiser_link_proposals_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, -): +async def test_list_custom_dimensions_async_pager(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_link_proposals), + type(client.transport.list_custom_dimensions), "__call__", + new_callable=mock.AsyncMock, ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - next_page_token="next_page_token_value", - ) + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + resources.CustomDimension(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[], + next_page_token="def", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + ], + next_page_token="ghi", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + ], + ), + RuntimeError, ) - response = await client.list_display_video360_advertiser_link_proposals(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() + async_pager = await client.list_custom_dimensions( + request={}, ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) - # Establish that the response is the type that we expect. - assert isinstance( - response, pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager - ) - assert response.next_page_token == "next_page_token_value" + assert len(responses) == 6 + assert all(isinstance(i, resources.CustomDimension) for i in responses) @pytest.mark.asyncio -async def test_list_display_video360_advertiser_link_proposals_async_from_dict(): - await test_list_display_video360_advertiser_link_proposals_async(request_type=dict) - - -def test_list_display_video360_advertiser_link_proposals_field_headers(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), +async def test_list_custom_dimensions_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, ) - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() - - request.parent = "parent_value" - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_display_video360_advertiser_link_proposals), + type(client.transport.list_custom_dimensions), "__call__", - ) as call: - call.return_value = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() - ) - client.list_display_video360_advertiser_link_proposals(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_list_display_video360_advertiser_link_proposals_field_headers_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_display_video360_advertiser_link_proposals), - "__call__", - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() - ) - await client.list_display_video360_advertiser_link_proposals(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -def test_list_display_video360_advertiser_link_proposals_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_display_video360_advertiser_link_proposals), - "__call__", - ) as call: - # Designate an appropriate return value for the call. - call.return_value = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.list_display_video360_advertiser_link_proposals( - parent="parent_value", - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - - -def test_list_display_video360_advertiser_link_proposals_flattened_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_display_video360_advertiser_link_proposals( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest(), - parent="parent_value", - ) - - -@pytest.mark.asyncio -async def test_list_display_video360_advertiser_link_proposals_flattened_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_display_video360_advertiser_link_proposals), - "__call__", - ) as call: - # Designate an appropriate return value for the call. - call.return_value = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() - ) - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.list_display_video360_advertiser_link_proposals( - parent="parent_value", - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - - -@pytest.mark.asyncio -async def test_list_display_video360_advertiser_link_proposals_flattened_error_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.list_display_video360_advertiser_link_proposals( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest(), - parent="parent_value", - ) - - -def test_list_display_video360_advertiser_link_proposals_pager( - transport_name: str = "grpc", -): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_display_video360_advertiser_link_proposals), - "__call__", - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - ], - next_page_token="abc", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[], - next_page_token="def", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - ], - next_page_token="ghi", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_display_video360_advertiser_link_proposals(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all( - isinstance(i, resources.DisplayVideo360AdvertiserLinkProposal) - for i in results - ) - - -def test_list_display_video360_advertiser_link_proposals_pages( - transport_name: str = "grpc", -): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_display_video360_advertiser_link_proposals), - "__call__", - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - ], - next_page_token="abc", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[], - next_page_token="def", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - ], - next_page_token="ghi", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - ], - ), - RuntimeError, - ) - pages = list( - client.list_display_video360_advertiser_link_proposals(request={}).pages - ) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_display_video360_advertiser_link_proposals_async_pager(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_display_video360_advertiser_link_proposals), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - ], - next_page_token="abc", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[], - next_page_token="def", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - ], - next_page_token="ghi", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_display_video360_advertiser_link_proposals( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all( - isinstance(i, resources.DisplayVideo360AdvertiserLinkProposal) - for i in responses - ) - - -@pytest.mark.asyncio -async def test_list_display_video360_advertiser_link_proposals_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_display_video360_advertiser_link_proposals), - "__call__", - new_callable=mock.AsyncMock, + new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + resources.CustomDimension(), ], next_page_token="abc", ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[], + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[], next_page_token="def", ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), ], next_page_token="ghi", ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), ], ), RuntimeError, @@ -16183,7 +15796,7 @@ async def test_list_display_video360_advertiser_link_proposals_async_pages(): # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 async for page_ in ( # pragma: no branch - await client.list_display_video360_advertiser_link_proposals(request={}) + await client.list_custom_dimensions(request={}) ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): @@ -16193,13 +15806,11 @@ async def test_list_display_video360_advertiser_link_proposals_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, + analytics_admin.ArchiveCustomDimensionRequest, dict, ], ) -def test_create_display_video360_advertiser_link_proposal( - request_type, transport: str = "grpc" -): +def test_archive_custom_dimension(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -16211,35 +15822,22 @@ def test_create_display_video360_advertiser_link_proposal( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.archive_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLinkProposal( - name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - validation_email="validation_email_value", - ) - response = client.create_display_video360_advertiser_link_proposal(request) + call.return_value = None + response = client.archive_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.ArchiveCustomDimensionRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) - assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" - assert response.validation_email == "validation_email_value" + assert response is None -def test_create_display_video360_advertiser_link_proposal_empty_call(): +def test_archive_custom_dimension_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -16249,22 +15847,18 @@ def test_create_display_video360_advertiser_link_proposal_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.archive_custom_dimension), "__call__" ) as call: - client.create_display_video360_advertiser_link_proposal() + client.archive_custom_dimension() call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.ArchiveCustomDimensionRequest() @pytest.mark.asyncio -async def test_create_display_video360_advertiser_link_proposal_async( +async def test_archive_custom_dimension_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, + request_type=analytics_admin.ArchiveCustomDimensionRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16277,61 +15871,43 @@ async def test_create_display_video360_advertiser_link_proposal_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.archive_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLinkProposal( - name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - validation_email="validation_email_value", - ) - ) - response = await client.create_display_video360_advertiser_link_proposal( - request - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.archive_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.ArchiveCustomDimensionRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) - assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" - assert response.validation_email == "validation_email_value" + assert response is None @pytest.mark.asyncio -async def test_create_display_video360_advertiser_link_proposal_async_from_dict(): - await test_create_display_video360_advertiser_link_proposal_async(request_type=dict) +async def test_archive_custom_dimension_async_from_dict(): + await test_archive_custom_dimension_async(request_type=dict) -def test_create_display_video360_advertiser_link_proposal_field_headers(): +def test_archive_custom_dimension_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.ArchiveCustomDimensionRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.archive_custom_dimension), "__call__" ) as call: - call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() - client.create_display_video360_advertiser_link_proposal(request) + call.return_value = None + client.archive_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -16342,31 +15918,28 @@ def test_create_display_video360_advertiser_link_proposal_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_create_display_video360_advertiser_link_proposal_field_headers_async(): +async def test_archive_custom_dimension_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.ArchiveCustomDimensionRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.archive_custom_dimension), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLinkProposal() - ) - await client.create_display_video360_advertiser_link_proposal(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.archive_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -16377,44 +15950,37 @@ async def test_create_display_video360_advertiser_link_proposal_field_headers_as _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_create_display_video360_advertiser_link_proposal_flattened(): +def test_archive_custom_dimension_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.archive_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_display_video360_advertiser_link_proposal( - parent="parent_value", - display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( - name="name_value" - ), + client.archive_custom_dimension( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].display_video_360_advertiser_link_proposal - mock_val = resources.DisplayVideo360AdvertiserLinkProposal(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_create_display_video360_advertiser_link_proposal_flattened_error(): +def test_archive_custom_dimension_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -16422,55 +15988,43 @@ def test_create_display_video360_advertiser_link_proposal_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_display_video360_advertiser_link_proposal( - analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest(), - parent="parent_value", - display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( - name="name_value" - ), + client.archive_custom_dimension( + analytics_admin.ArchiveCustomDimensionRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_create_display_video360_advertiser_link_proposal_flattened_async(): +async def test_archive_custom_dimension_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.archive_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLinkProposal() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_display_video360_advertiser_link_proposal( - parent="parent_value", - display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( - name="name_value" - ), + response = await client.archive_custom_dimension( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].display_video_360_advertiser_link_proposal - mock_val = resources.DisplayVideo360AdvertiserLinkProposal(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_create_display_video360_advertiser_link_proposal_flattened_error_async(): +async def test_archive_custom_dimension_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -16478,25 +16032,20 @@ async def test_create_display_video360_advertiser_link_proposal_flattened_error_ # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_display_video360_advertiser_link_proposal( - analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest(), - parent="parent_value", - display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( - name="name_value" - ), + await client.archive_custom_dimension( + analytics_admin.ArchiveCustomDimensionRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, + analytics_admin.GetCustomDimensionRequest, dict, ], ) -def test_delete_display_video360_advertiser_link_proposal( - request_type, transport: str = "grpc" -): +def test_get_custom_dimension(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -16508,26 +16057,35 @@ def test_delete_display_video360_advertiser_link_proposal( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.get_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_display_video360_advertiser_link_proposal(request) + call.return_value = resources.CustomDimension( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, + ) + response = client.get_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.GetCustomDimensionRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.CustomDimension) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True -def test_delete_display_video360_advertiser_link_proposal_empty_call(): +def test_get_custom_dimension_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -16537,22 +16095,18 @@ def test_delete_display_video360_advertiser_link_proposal_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.get_custom_dimension), "__call__" ) as call: - client.delete_display_video360_advertiser_link_proposal() + client.get_custom_dimension() call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.GetCustomDimensionRequest() @pytest.mark.asyncio -async def test_delete_display_video360_advertiser_link_proposal_async( +async def test_get_custom_dimension_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, + request_type=analytics_admin.GetCustomDimensionRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16565,50 +16119,58 @@ async def test_delete_display_video360_advertiser_link_proposal_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.get_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_display_video360_advertiser_link_proposal( - request + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, + ) ) + response = await client.get_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.GetCustomDimensionRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.CustomDimension) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True @pytest.mark.asyncio -async def test_delete_display_video360_advertiser_link_proposal_async_from_dict(): - await test_delete_display_video360_advertiser_link_proposal_async(request_type=dict) +async def test_get_custom_dimension_async_from_dict(): + await test_get_custom_dimension_async(request_type=dict) -def test_delete_display_video360_advertiser_link_proposal_field_headers(): +def test_get_custom_dimension_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.GetCustomDimensionRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.get_custom_dimension), "__call__" ) as call: - call.return_value = None - client.delete_display_video360_advertiser_link_proposal(request) + call.return_value = resources.CustomDimension() + client.get_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -16624,24 +16186,25 @@ def test_delete_display_video360_advertiser_link_proposal_field_headers(): @pytest.mark.asyncio -async def test_delete_display_video360_advertiser_link_proposal_field_headers_async(): +async def test_get_custom_dimension_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.GetCustomDimensionRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.get_custom_dimension), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_display_video360_advertiser_link_proposal(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension() + ) + await client.get_custom_dimension(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -16656,21 +16219,20 @@ async def test_delete_display_video360_advertiser_link_proposal_field_headers_as ) in kw["metadata"] -def test_delete_display_video360_advertiser_link_proposal_flattened(): +def test_get_custom_dimension_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.get_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.CustomDimension() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_display_video360_advertiser_link_proposal( + client.get_custom_dimension( name="name_value", ) @@ -16683,7 +16245,7 @@ def test_delete_display_video360_advertiser_link_proposal_flattened(): assert arg == mock_val -def test_delete_display_video360_advertiser_link_proposal_flattened_error(): +def test_get_custom_dimension_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -16691,30 +16253,31 @@ def test_delete_display_video360_advertiser_link_proposal_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_display_video360_advertiser_link_proposal( - analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest(), + client.get_custom_dimension( + analytics_admin.GetCustomDimensionRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_delete_display_video360_advertiser_link_proposal_flattened_async(): +async def test_get_custom_dimension_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.get_custom_dimension), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.CustomDimension() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_display_video360_advertiser_link_proposal( + response = await client.get_custom_dimension( name="name_value", ) @@ -16728,7 +16291,7 @@ async def test_delete_display_video360_advertiser_link_proposal_flattened_async( @pytest.mark.asyncio -async def test_delete_display_video360_advertiser_link_proposal_flattened_error_async(): +async def test_get_custom_dimension_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -16736,8 +16299,8 @@ async def test_delete_display_video360_advertiser_link_proposal_flattened_error_ # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.delete_display_video360_advertiser_link_proposal( - analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest(), + await client.get_custom_dimension( + analytics_admin.GetCustomDimensionRequest(), name="name_value", ) @@ -16745,13 +16308,11 @@ async def test_delete_display_video360_advertiser_link_proposal_flattened_error_ @pytest.mark.parametrize( "request_type", [ - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, + analytics_admin.CreateCustomMetricRequest, dict, ], ) -def test_approve_display_video360_advertiser_link_proposal( - request_type, transport: str = "grpc" -): +def test_create_custom_metric(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -16763,30 +16324,41 @@ def test_approve_display_video360_advertiser_link_proposal( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.approve_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.create_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = ( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() + call.return_value = resources.CustomMetric( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + restricted_metric_type=[ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ], ) - response = client.approve_display_video360_advertiser_link_proposal(request) + response = client.create_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.CreateCustomMetricRequest() # Establish that the response is the type that we expect. - assert isinstance( - response, analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse - ) + assert isinstance(response, resources.CustomMetric) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert response.restricted_metric_type == [ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ] -def test_approve_display_video360_advertiser_link_proposal_empty_call(): +def test_create_custom_metric_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -16796,22 +16368,18 @@ def test_approve_display_video360_advertiser_link_proposal_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.approve_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.create_custom_metric), "__call__" ) as call: - client.approve_display_video360_advertiser_link_proposal() + client.create_custom_metric() call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.CreateCustomMetricRequest() @pytest.mark.asyncio -async def test_approve_display_video360_advertiser_link_proposal_async( +async def test_create_custom_metric_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, + request_type=analytics_admin.CreateCustomMetricRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -16824,58 +16392,64 @@ async def test_approve_display_video360_advertiser_link_proposal_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.approve_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.create_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() - ) - response = await client.approve_display_video360_advertiser_link_proposal( - request + resources.CustomMetric( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + restricted_metric_type=[ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ], + ) ) + response = await client.create_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.CreateCustomMetricRequest() # Establish that the response is the type that we expect. - assert isinstance( - response, analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse - ) + assert isinstance(response, resources.CustomMetric) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert response.restricted_metric_type == [ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ] @pytest.mark.asyncio -async def test_approve_display_video360_advertiser_link_proposal_async_from_dict(): - await test_approve_display_video360_advertiser_link_proposal_async( - request_type=dict - ) +async def test_create_custom_metric_async_from_dict(): + await test_create_custom_metric_async(request_type=dict) -def test_approve_display_video360_advertiser_link_proposal_field_headers(): +def test_create_custom_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.CreateCustomMetricRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.approve_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.create_custom_metric), "__call__" ) as call: - call.return_value = ( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() - ) - client.approve_display_video360_advertiser_link_proposal(request) + call.return_value = resources.CustomMetric() + client.create_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -16886,31 +16460,30 @@ def test_approve_display_video360_advertiser_link_proposal_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_approve_display_video360_advertiser_link_proposal_field_headers_async(): +async def test_create_custom_metric_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.CreateCustomMetricRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.approve_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.create_custom_metric), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() + resources.CustomMetric() ) - await client.approve_display_video360_advertiser_link_proposal(request) + await client.create_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -16921,20 +16494,114 @@ async def test_approve_display_video360_advertiser_link_proposal_field_headers_a _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] +def test_create_custom_metric_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomMetric() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_custom_metric( + parent="parent_value", + custom_metric=resources.CustomMetric(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].custom_metric + mock_val = resources.CustomMetric(name="name_value") + assert arg == mock_val + + +def test_create_custom_metric_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_custom_metric( + analytics_admin.CreateCustomMetricRequest(), + parent="parent_value", + custom_metric=resources.CustomMetric(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_create_custom_metric_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomMetric() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomMetric() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_custom_metric( + parent="parent_value", + custom_metric=resources.CustomMetric(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].custom_metric + mock_val = resources.CustomMetric(name="name_value") + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_create_custom_metric_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_custom_metric( + analytics_admin.CreateCustomMetricRequest(), + parent="parent_value", + custom_metric=resources.CustomMetric(name="name_value"), + ) + + @pytest.mark.parametrize( "request_type", [ - analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, + analytics_admin.UpdateCustomMetricRequest, dict, ], ) -def test_cancel_display_video360_advertiser_link_proposal( - request_type, transport: str = "grpc" -): +def test_update_custom_metric(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -16946,35 +16613,41 @@ def test_cancel_display_video360_advertiser_link_proposal( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.cancel_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.update_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DisplayVideo360AdvertiserLinkProposal( + call.return_value = resources.CustomMetric( name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - validation_email="validation_email_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + restricted_metric_type=[ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ], ) - response = client.cancel_display_video360_advertiser_link_proposal(request) + response = client.update_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.UpdateCustomMetricRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) + assert isinstance(response, resources.CustomMetric) assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" - assert response.validation_email == "validation_email_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert response.restricted_metric_type == [ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ] -def test_cancel_display_video360_advertiser_link_proposal_empty_call(): +def test_update_custom_metric_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -16984,22 +16657,18 @@ def test_cancel_display_video360_advertiser_link_proposal_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.cancel_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.update_custom_metric), "__call__" ) as call: - client.cancel_display_video360_advertiser_link_proposal() + client.update_custom_metric() call.assert_called() _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.UpdateCustomMetricRequest() @pytest.mark.asyncio -async def test_cancel_display_video360_advertiser_link_proposal_async( +async def test_update_custom_metric_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, + request_type=analytics_admin.UpdateCustomMetricRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17012,61 +16681,64 @@ async def test_cancel_display_video360_advertiser_link_proposal_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.cancel_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.update_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLinkProposal( + resources.CustomMetric( name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - validation_email="validation_email_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + restricted_metric_type=[ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ], ) ) - response = await client.cancel_display_video360_advertiser_link_proposal( - request - ) + response = await client.update_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert ( - args[0] - == analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() - ) + assert args[0] == analytics_admin.UpdateCustomMetricRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) + assert isinstance(response, resources.CustomMetric) assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" - assert response.validation_email == "validation_email_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert response.restricted_metric_type == [ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ] @pytest.mark.asyncio -async def test_cancel_display_video360_advertiser_link_proposal_async_from_dict(): - await test_cancel_display_video360_advertiser_link_proposal_async(request_type=dict) +async def test_update_custom_metric_async_from_dict(): + await test_update_custom_metric_async(request_type=dict) -def test_cancel_display_video360_advertiser_link_proposal_field_headers(): +def test_update_custom_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.UpdateCustomMetricRequest() - request.name = "name_value" + request.custom_metric.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.cancel_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.update_custom_metric), "__call__" ) as call: - call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() - client.cancel_display_video360_advertiser_link_proposal(request) + call.return_value = resources.CustomMetric() + client.update_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -17077,31 +16749,30 @@ def test_cancel_display_video360_advertiser_link_proposal_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "custom_metric.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_cancel_display_video360_advertiser_link_proposal_field_headers_async(): +async def test_update_custom_metric_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.UpdateCustomMetricRequest() - request.name = "name_value" + request.custom_metric.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.cancel_display_video360_advertiser_link_proposal), - "__call__", + type(client.transport.update_custom_metric), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DisplayVideo360AdvertiserLinkProposal() + resources.CustomMetric() ) - await client.cancel_display_video360_advertiser_link_proposal(request) + await client.update_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -17112,58 +16783,144 @@ async def test_cancel_display_video360_advertiser_link_proposal_field_headers_as _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "custom_metric.name=name_value", ) in kw["metadata"] -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.CreateCustomDimensionRequest, - dict, - ], -) -def test_create_custom_dimension(request_type, transport: str = "grpc"): +def test_update_custom_metric_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.update_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, + call.return_value = resources.CustomMetric() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_custom_metric( + custom_metric=resources.CustomMetric(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) - response = client.create_custom_dimension(request) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].custom_metric + mock_val = resources.CustomMetric(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +def test_update_custom_metric_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_custom_metric( + analytics_admin.UpdateCustomMetricRequest(), + custom_metric=resources.CustomMetric(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.asyncio +async def test_update_custom_metric_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomMetric() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomMetric() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_custom_metric( + custom_metric=resources.CustomMetric(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].custom_metric + mock_val = resources.CustomMetric(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_update_custom_metric_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_custom_metric( + analytics_admin.UpdateCustomMetricRequest(), + custom_metric=resources.CustomMetric(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListCustomMetricsRequest, + dict, + ], +) +def test_list_custom_metrics(request_type, transport: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.ListCustomMetricsResponse( + next_page_token="next_page_token_value", + ) + response = client.list_custom_metrics(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomDimensionRequest() + assert args[0] == analytics_admin.ListCustomMetricsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) - assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert isinstance(response, pagers.ListCustomMetricsPager) + assert response.next_page_token == "next_page_token_value" -def test_create_custom_dimension_empty_call(): +def test_list_custom_metrics_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -17173,18 +16930,18 @@ def test_create_custom_dimension_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.list_custom_metrics), "__call__" ) as call: - client.create_custom_dimension() + client.list_custom_metrics() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomDimensionRequest() + assert args[0] == analytics_admin.ListCustomMetricsRequest() @pytest.mark.asyncio -async def test_create_custom_dimension_async( +async def test_list_custom_metrics_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateCustomDimensionRequest, + request_type=analytics_admin.ListCustomMetricsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17197,58 +16954,48 @@ async def test_create_custom_dimension_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.list_custom_metrics), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, + analytics_admin.ListCustomMetricsResponse( + next_page_token="next_page_token_value", ) ) - response = await client.create_custom_dimension(request) + response = await client.list_custom_metrics(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomDimensionRequest() + assert args[0] == analytics_admin.ListCustomMetricsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) - assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert isinstance(response, pagers.ListCustomMetricsAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_create_custom_dimension_async_from_dict(): - await test_create_custom_dimension_async(request_type=dict) +async def test_list_custom_metrics_async_from_dict(): + await test_list_custom_metrics_async(request_type=dict) -def test_create_custom_dimension_field_headers(): +def test_list_custom_metrics_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateCustomDimensionRequest() + request = analytics_admin.ListCustomMetricsRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.list_custom_metrics), "__call__" ) as call: - call.return_value = resources.CustomDimension() - client.create_custom_dimension(request) + call.return_value = analytics_admin.ListCustomMetricsResponse() + client.list_custom_metrics(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -17264,25 +17011,25 @@ def test_create_custom_dimension_field_headers(): @pytest.mark.asyncio -async def test_create_custom_dimension_field_headers_async(): +async def test_list_custom_metrics_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateCustomDimensionRequest() + request = analytics_admin.ListCustomMetricsRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.list_custom_metrics), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension() + analytics_admin.ListCustomMetricsResponse() ) - await client.create_custom_dimension(request) + await client.list_custom_metrics(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -17297,22 +17044,21 @@ async def test_create_custom_dimension_field_headers_async(): ) in kw["metadata"] -def test_create_custom_dimension_flattened(): +def test_list_custom_metrics_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.list_custom_metrics), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension() + call.return_value = analytics_admin.ListCustomMetricsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_custom_dimension( + client.list_custom_metrics( parent="parent_value", - custom_dimension=resources.CustomDimension(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -17322,12 +17068,9 @@ def test_create_custom_dimension_flattened(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].custom_dimension - mock_val = resources.CustomDimension(name="name_value") - assert arg == mock_val -def test_create_custom_dimension_flattened_error(): +def test_list_custom_metrics_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17335,34 +17078,32 @@ def test_create_custom_dimension_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_custom_dimension( - analytics_admin.CreateCustomDimensionRequest(), + client.list_custom_metrics( + analytics_admin.ListCustomMetricsRequest(), parent="parent_value", - custom_dimension=resources.CustomDimension(name="name_value"), ) @pytest.mark.asyncio -async def test_create_custom_dimension_flattened_async(): +async def test_list_custom_metrics_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.list_custom_metrics), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension() + call.return_value = analytics_admin.ListCustomMetricsResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension() + analytics_admin.ListCustomMetricsResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_custom_dimension( + response = await client.list_custom_metrics( parent="parent_value", - custom_dimension=resources.CustomDimension(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -17372,13 +17113,10 @@ async def test_create_custom_dimension_flattened_async(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].custom_dimension - mock_val = resources.CustomDimension(name="name_value") - assert arg == mock_val @pytest.mark.asyncio -async def test_create_custom_dimension_flattened_error_async(): +async def test_list_custom_metrics_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17386,21 +17124,218 @@ async def test_create_custom_dimension_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_custom_dimension( - analytics_admin.CreateCustomDimensionRequest(), + await client.list_custom_metrics( + analytics_admin.ListCustomMetricsRequest(), parent="parent_value", - custom_dimension=resources.CustomDimension(name="name_value"), ) +def test_list_custom_metrics_pager(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + resources.CustomMetric(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[], + next_page_token="def", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + ], + next_page_token="ghi", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_custom_metrics(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.CustomMetric) for i in results) + + +def test_list_custom_metrics_pages(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + resources.CustomMetric(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[], + next_page_token="def", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + ], + next_page_token="ghi", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + ], + ), + RuntimeError, + ) + pages = list(client.list_custom_metrics(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_custom_metrics_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + resources.CustomMetric(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[], + next_page_token="def", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + ], + next_page_token="ghi", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_custom_metrics( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.CustomMetric) for i in responses) + + +@pytest.mark.asyncio +async def test_list_custom_metrics_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + resources.CustomMetric(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[], + next_page_token="def", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + ], + next_page_token="ghi", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + ], + ), + RuntimeError, + ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_custom_metrics(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateCustomDimensionRequest, + analytics_admin.ArchiveCustomMetricRequest, dict, ], ) -def test_update_custom_dimension(request_type, transport: str = "grpc"): +def test_archive_custom_metric(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -17412,35 +17347,22 @@ def test_update_custom_dimension(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.archive_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, - ) - response = client.update_custom_dimension(request) + call.return_value = None + response = client.archive_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomDimensionRequest() + assert args[0] == analytics_admin.ArchiveCustomMetricRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) - assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert response is None -def test_update_custom_dimension_empty_call(): +def test_archive_custom_metric_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -17450,18 +17372,18 @@ def test_update_custom_dimension_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.archive_custom_metric), "__call__" ) as call: - client.update_custom_dimension() + client.archive_custom_metric() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomDimensionRequest() + assert args[0] == analytics_admin.ArchiveCustomMetricRequest() @pytest.mark.asyncio -async def test_update_custom_dimension_async( +async def test_archive_custom_metric_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateCustomDimensionRequest, + request_type=analytics_admin.ArchiveCustomMetricRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17474,58 +17396,43 @@ async def test_update_custom_dimension_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.archive_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, - ) - ) - response = await client.update_custom_dimension(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.archive_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomDimensionRequest() + assert args[0] == analytics_admin.ArchiveCustomMetricRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) - assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert response is None @pytest.mark.asyncio -async def test_update_custom_dimension_async_from_dict(): - await test_update_custom_dimension_async(request_type=dict) +async def test_archive_custom_metric_async_from_dict(): + await test_archive_custom_metric_async(request_type=dict) -def test_update_custom_dimension_field_headers(): +def test_archive_custom_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateCustomDimensionRequest() + request = analytics_admin.ArchiveCustomMetricRequest() - request.custom_dimension.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.archive_custom_metric), "__call__" ) as call: - call.return_value = resources.CustomDimension() - client.update_custom_dimension(request) + call.return_value = None + client.archive_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -17536,30 +17443,28 @@ def test_update_custom_dimension_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "custom_dimension.name=name_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_custom_dimension_field_headers_async(): +async def test_archive_custom_metric_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateCustomDimensionRequest() + request = analytics_admin.ArchiveCustomMetricRequest() - request.custom_dimension.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.archive_custom_metric), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension() - ) - await client.update_custom_dimension(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.archive_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -17570,41 +17475,37 @@ async def test_update_custom_dimension_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "custom_dimension.name=name_value", + "name=name_value", ) in kw["metadata"] -def test_update_custom_dimension_flattened(): +def test_archive_custom_metric_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.archive_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_custom_dimension( - custom_dimension=resources.CustomDimension(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.archive_custom_metric( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].custom_dimension - mock_val = resources.CustomDimension(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_update_custom_dimension_flattened_error(): +def test_archive_custom_metric_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17612,50 +17513,43 @@ def test_update_custom_dimension_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_custom_dimension( - analytics_admin.UpdateCustomDimensionRequest(), - custom_dimension=resources.CustomDimension(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.archive_custom_metric( + analytics_admin.ArchiveCustomMetricRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_update_custom_dimension_flattened_async(): +async def test_archive_custom_metric_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.archive_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_custom_dimension( - custom_dimension=resources.CustomDimension(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + response = await client.archive_custom_metric( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].custom_dimension - mock_val = resources.CustomDimension(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_update_custom_dimension_flattened_error_async(): +async def test_archive_custom_metric_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17663,21 +17557,20 @@ async def test_update_custom_dimension_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_custom_dimension( - analytics_admin.UpdateCustomDimensionRequest(), - custom_dimension=resources.CustomDimension(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + await client.archive_custom_metric( + analytics_admin.ArchiveCustomMetricRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListCustomDimensionsRequest, + analytics_admin.GetCustomMetricRequest, dict, ], ) -def test_list_custom_dimensions(request_type, transport: str = "grpc"): +def test_get_custom_metric(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -17689,25 +17582,41 @@ def test_list_custom_dimensions(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.get_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListCustomDimensionsResponse( - next_page_token="next_page_token_value", + call.return_value = resources.CustomMetric( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + restricted_metric_type=[ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ], ) - response = client.list_custom_dimensions(request) + response = client.get_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomDimensionsRequest() + assert args[0] == analytics_admin.GetCustomMetricRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomDimensionsPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.CustomMetric) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert response.restricted_metric_type == [ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ] -def test_list_custom_dimensions_empty_call(): +def test_get_custom_metric_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -17717,18 +17626,17 @@ def test_list_custom_dimensions_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.get_custom_metric), "__call__" ) as call: - client.list_custom_dimensions() + client.get_custom_metric() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomDimensionsRequest() + assert args[0] == analytics_admin.GetCustomMetricRequest() @pytest.mark.asyncio -async def test_list_custom_dimensions_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListCustomDimensionsRequest, +async def test_get_custom_metric_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.GetCustomMetricRequest ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -17741,48 +17649,64 @@ async def test_list_custom_dimensions_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.get_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListCustomDimensionsResponse( - next_page_token="next_page_token_value", + resources.CustomMetric( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + restricted_metric_type=[ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ], ) ) - response = await client.list_custom_dimensions(request) + response = await client.get_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomDimensionsRequest() + assert args[0] == analytics_admin.GetCustomMetricRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomDimensionsAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.CustomMetric) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert response.restricted_metric_type == [ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ] @pytest.mark.asyncio -async def test_list_custom_dimensions_async_from_dict(): - await test_list_custom_dimensions_async(request_type=dict) +async def test_get_custom_metric_async_from_dict(): + await test_get_custom_metric_async(request_type=dict) -def test_list_custom_dimensions_field_headers(): +def test_get_custom_metric_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListCustomDimensionsRequest() + request = analytics_admin.GetCustomMetricRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.get_custom_metric), "__call__" ) as call: - call.return_value = analytics_admin.ListCustomDimensionsResponse() - client.list_custom_dimensions(request) + call.return_value = resources.CustomMetric() + client.get_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -17793,30 +17717,30 @@ def test_list_custom_dimensions_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_custom_dimensions_field_headers_async(): +async def test_get_custom_metric_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListCustomDimensionsRequest() + request = analytics_admin.GetCustomMetricRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.get_custom_metric), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListCustomDimensionsResponse() + resources.CustomMetric() ) - await client.list_custom_dimensions(request) + await client.get_custom_metric(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -17827,37 +17751,37 @@ async def test_list_custom_dimensions_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_list_custom_dimensions_flattened(): +def test_get_custom_metric_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.get_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListCustomDimensionsResponse() + call.return_value = resources.CustomMetric() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_custom_dimensions( - parent="parent_value", + client.get_custom_metric( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_list_custom_dimensions_flattened_error(): +def test_get_custom_metric_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17865,45 +17789,45 @@ def test_list_custom_dimensions_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_custom_dimensions( - analytics_admin.ListCustomDimensionsRequest(), - parent="parent_value", + client.get_custom_metric( + analytics_admin.GetCustomMetricRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_list_custom_dimensions_flattened_async(): +async def test_get_custom_metric_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.get_custom_metric), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListCustomDimensionsResponse() + call.return_value = resources.CustomMetric() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListCustomDimensionsResponse() + resources.CustomMetric() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_custom_dimensions( - parent="parent_value", + response = await client.get_custom_metric( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_list_custom_dimensions_flattened_error_async(): +async def test_get_custom_metric_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17911,218 +17835,20 @@ async def test_list_custom_dimensions_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_custom_dimensions( - analytics_admin.ListCustomDimensionsRequest(), - parent="parent_value", - ) - - -def test_list_custom_dimensions_pager(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - resources.CustomDimension(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[], - next_page_token="def", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - ], - next_page_token="ghi", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_custom_dimensions(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.CustomDimension) for i in results) - - -def test_list_custom_dimensions_pages(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - resources.CustomDimension(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[], - next_page_token="def", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - ], - next_page_token="ghi", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - ], - ), - RuntimeError, - ) - pages = list(client.list_custom_dimensions(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_custom_dimensions_async_pager(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_custom_dimensions), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - resources.CustomDimension(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[], - next_page_token="def", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - ], - next_page_token="ghi", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_custom_dimensions( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.CustomDimension) for i in responses) - - -@pytest.mark.asyncio -async def test_list_custom_dimensions_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_custom_dimensions), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - resources.CustomDimension(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[], - next_page_token="def", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - ], - next_page_token="ghi", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - ], - ), - RuntimeError, + await client.get_custom_metric( + analytics_admin.GetCustomMetricRequest(), + name="name_value", ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_custom_dimensions(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.ArchiveCustomDimensionRequest, + analytics_admin.GetDataRetentionSettingsRequest, dict, ], ) -def test_archive_custom_dimension(request_type, transport: str = "grpc"): +def test_get_data_retention_settings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -18134,22 +17860,32 @@ def test_archive_custom_dimension(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.archive_custom_dimension(request) + call.return_value = resources.DataRetentionSettings( + name="name_value", + event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, + reset_user_data_on_new_activity=True, + ) + response = client.get_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomDimensionRequest() + assert args[0] == analytics_admin.GetDataRetentionSettingsRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.DataRetentionSettings) + assert response.name == "name_value" + assert ( + response.event_data_retention + == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + ) + assert response.reset_user_data_on_new_activity is True -def test_archive_custom_dimension_empty_call(): +def test_get_data_retention_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -18159,18 +17895,18 @@ def test_archive_custom_dimension_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: - client.archive_custom_dimension() + client.get_data_retention_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomDimensionRequest() + assert args[0] == analytics_admin.GetDataRetentionSettingsRequest() @pytest.mark.asyncio -async def test_archive_custom_dimension_async( +async def test_get_data_retention_settings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ArchiveCustomDimensionRequest, + request_type=analytics_admin.GetDataRetentionSettingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18183,43 +17919,55 @@ async def test_archive_custom_dimension_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.archive_custom_dimension(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DataRetentionSettings( + name="name_value", + event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, + reset_user_data_on_new_activity=True, + ) + ) + response = await client.get_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomDimensionRequest() + assert args[0] == analytics_admin.GetDataRetentionSettingsRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.DataRetentionSettings) + assert response.name == "name_value" + assert ( + response.event_data_retention + == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + ) + assert response.reset_user_data_on_new_activity is True @pytest.mark.asyncio -async def test_archive_custom_dimension_async_from_dict(): - await test_archive_custom_dimension_async(request_type=dict) +async def test_get_data_retention_settings_async_from_dict(): + await test_get_data_retention_settings_async(request_type=dict) -def test_archive_custom_dimension_field_headers(): +def test_get_data_retention_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ArchiveCustomDimensionRequest() + request = analytics_admin.GetDataRetentionSettingsRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: - call.return_value = None - client.archive_custom_dimension(request) + call.return_value = resources.DataRetentionSettings() + client.get_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -18235,23 +17983,25 @@ def test_archive_custom_dimension_field_headers(): @pytest.mark.asyncio -async def test_archive_custom_dimension_field_headers_async(): +async def test_get_data_retention_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ArchiveCustomDimensionRequest() + request = analytics_admin.GetDataRetentionSettingsRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.archive_custom_dimension(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DataRetentionSettings() + ) + await client.get_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -18266,20 +18016,20 @@ async def test_archive_custom_dimension_field_headers_async(): ) in kw["metadata"] -def test_archive_custom_dimension_flattened(): +def test_get_data_retention_settings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.DataRetentionSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.archive_custom_dimension( + client.get_data_retention_settings( name="name_value", ) @@ -18292,7 +18042,7 @@ def test_archive_custom_dimension_flattened(): assert arg == mock_val -def test_archive_custom_dimension_flattened_error(): +def test_get_data_retention_settings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -18300,29 +18050,31 @@ def test_archive_custom_dimension_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.archive_custom_dimension( - analytics_admin.ArchiveCustomDimensionRequest(), + client.get_data_retention_settings( + analytics_admin.GetDataRetentionSettingsRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_archive_custom_dimension_flattened_async(): +async def test_get_data_retention_settings_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.DataRetentionSettings() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DataRetentionSettings() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.archive_custom_dimension( + response = await client.get_data_retention_settings( name="name_value", ) @@ -18336,7 +18088,7 @@ async def test_archive_custom_dimension_flattened_async(): @pytest.mark.asyncio -async def test_archive_custom_dimension_flattened_error_async(): +async def test_get_data_retention_settings_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -18344,8 +18096,8 @@ async def test_archive_custom_dimension_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.archive_custom_dimension( - analytics_admin.ArchiveCustomDimensionRequest(), + await client.get_data_retention_settings( + analytics_admin.GetDataRetentionSettingsRequest(), name="name_value", ) @@ -18353,11 +18105,11 @@ async def test_archive_custom_dimension_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetCustomDimensionRequest, + analytics_admin.UpdateDataRetentionSettingsRequest, dict, ], ) -def test_get_custom_dimension(request_type, transport: str = "grpc"): +def test_update_data_retention_settings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -18369,35 +18121,32 @@ def test_get_custom_dimension(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension( + call.return_value = resources.DataRetentionSettings( name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, + event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, + reset_user_data_on_new_activity=True, ) - response = client.get_custom_dimension(request) + response = client.update_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomDimensionRequest() + assert args[0] == analytics_admin.UpdateDataRetentionSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) + assert isinstance(response, resources.DataRetentionSettings) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert ( + response.event_data_retention + == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + ) + assert response.reset_user_data_on_new_activity is True -def test_get_custom_dimension_empty_call(): +def test_update_data_retention_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -18407,18 +18156,18 @@ def test_get_custom_dimension_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: - client.get_custom_dimension() + client.update_data_retention_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomDimensionRequest() + assert args[0] == analytics_admin.UpdateDataRetentionSettingsRequest() @pytest.mark.asyncio -async def test_get_custom_dimension_async( +async def test_update_data_retention_settings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetCustomDimensionRequest, + request_type=analytics_admin.UpdateDataRetentionSettingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18431,58 +18180,55 @@ async def test_get_custom_dimension_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension( + resources.DataRetentionSettings( name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, + event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, + reset_user_data_on_new_activity=True, ) ) - response = await client.get_custom_dimension(request) + response = await client.update_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomDimensionRequest() + assert args[0] == analytics_admin.UpdateDataRetentionSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) + assert isinstance(response, resources.DataRetentionSettings) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert ( + response.event_data_retention + == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + ) + assert response.reset_user_data_on_new_activity is True @pytest.mark.asyncio -async def test_get_custom_dimension_async_from_dict(): - await test_get_custom_dimension_async(request_type=dict) +async def test_update_data_retention_settings_async_from_dict(): + await test_update_data_retention_settings_async(request_type=dict) -def test_get_custom_dimension_field_headers(): +def test_update_data_retention_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetCustomDimensionRequest() + request = analytics_admin.UpdateDataRetentionSettingsRequest() - request.name = "name_value" + request.data_retention_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: - call.return_value = resources.CustomDimension() - client.get_custom_dimension(request) + call.return_value = resources.DataRetentionSettings() + client.update_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -18493,30 +18239,30 @@ def test_get_custom_dimension_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "data_retention_settings.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_custom_dimension_field_headers_async(): +async def test_update_data_retention_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetCustomDimensionRequest() + request = analytics_admin.UpdateDataRetentionSettingsRequest() - request.name = "name_value" + request.data_retention_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension() + resources.DataRetentionSettings() ) - await client.get_custom_dimension(request) + await client.update_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -18527,37 +18273,41 @@ async def test_get_custom_dimension_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "data_retention_settings.name=name_value", ) in kw["metadata"] -def test_get_custom_dimension_flattened(): +def test_update_data_retention_settings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension() + call.return_value = resources.DataRetentionSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_custom_dimension( - name="name_value", + client.update_data_retention_settings( + data_retention_settings=resources.DataRetentionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].data_retention_settings + mock_val = resources.DataRetentionSettings(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_get_custom_dimension_flattened_error(): +def test_update_data_retention_settings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -18565,45 +18315,50 @@ def test_get_custom_dimension_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_custom_dimension( - analytics_admin.GetCustomDimensionRequest(), - name="name_value", + client.update_data_retention_settings( + analytics_admin.UpdateDataRetentionSettingsRequest(), + data_retention_settings=resources.DataRetentionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_get_custom_dimension_flattened_async(): +async def test_update_data_retention_settings_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension() + call.return_value = resources.DataRetentionSettings() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension() + resources.DataRetentionSettings() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_custom_dimension( - name="name_value", + response = await client.update_data_retention_settings( + data_retention_settings=resources.DataRetentionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].data_retention_settings + mock_val = resources.DataRetentionSettings(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val @pytest.mark.asyncio -async def test_get_custom_dimension_flattened_error_async(): +async def test_update_data_retention_settings_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -18611,20 +18366,21 @@ async def test_get_custom_dimension_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_custom_dimension( - analytics_admin.GetCustomDimensionRequest(), - name="name_value", + await client.update_data_retention_settings( + analytics_admin.UpdateDataRetentionSettingsRequest(), + data_retention_settings=resources.DataRetentionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateCustomMetricRequest, + analytics_admin.CreateDataStreamRequest, dict, ], ) -def test_create_custom_metric(request_type, transport: str = "grpc"): +def test_create_data_stream(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -18636,41 +18392,29 @@ def test_create_custom_metric(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.create_data_stream), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric( + call.return_value = resources.DataStream( name="name_value", - parameter_name="parameter_name_value", + type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, - restricted_metric_type=[ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ], ) - response = client.create_custom_metric(request) + response = client.create_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomMetricRequest() + assert args[0] == analytics_admin.CreateDataStreamRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) + assert isinstance(response, resources.DataStream) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" + assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT - assert response.restricted_metric_type == [ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ] -def test_create_custom_metric_empty_call(): +def test_create_data_stream_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -18680,18 +18424,18 @@ def test_create_custom_metric_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.create_data_stream), "__call__" ) as call: - client.create_custom_metric() + client.create_data_stream() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomMetricRequest() + assert args[0] == analytics_admin.CreateDataStreamRequest() @pytest.mark.asyncio -async def test_create_custom_metric_async( +async def test_create_data_stream_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateCustomMetricRequest, + request_type=analytics_admin.CreateDataStreamRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18704,64 +18448,52 @@ async def test_create_custom_metric_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.create_data_stream), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric( + resources.DataStream( name="name_value", - parameter_name="parameter_name_value", + type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, - restricted_metric_type=[ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ], ) ) - response = await client.create_custom_metric(request) + response = await client.create_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomMetricRequest() + assert args[0] == analytics_admin.CreateDataStreamRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) + assert isinstance(response, resources.DataStream) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" + assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT - assert response.restricted_metric_type == [ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ] @pytest.mark.asyncio -async def test_create_custom_metric_async_from_dict(): - await test_create_custom_metric_async(request_type=dict) +async def test_create_data_stream_async_from_dict(): + await test_create_data_stream_async(request_type=dict) -def test_create_custom_metric_field_headers(): +def test_create_data_stream_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateCustomMetricRequest() + request = analytics_admin.CreateDataStreamRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.create_data_stream), "__call__" ) as call: - call.return_value = resources.CustomMetric() - client.create_custom_metric(request) + call.return_value = resources.DataStream() + client.create_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -18777,25 +18509,25 @@ def test_create_custom_metric_field_headers(): @pytest.mark.asyncio -async def test_create_custom_metric_field_headers_async(): +async def test_create_data_stream_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateCustomMetricRequest() + request = analytics_admin.CreateDataStreamRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.create_data_stream), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric() + resources.DataStream() ) - await client.create_custom_metric(request) + await client.create_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -18810,22 +18542,26 @@ async def test_create_custom_metric_field_headers_async(): ) in kw["metadata"] -def test_create_custom_metric_flattened(): +def test_create_data_stream_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.create_data_stream), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric() + call.return_value = resources.DataStream() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_custom_metric( + client.create_data_stream( parent="parent_value", - custom_metric=resources.CustomMetric(name="name_value"), + data_stream=resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ), ) # Establish that the underlying call was made with the expected @@ -18835,12 +18571,16 @@ def test_create_custom_metric_flattened(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].custom_metric - mock_val = resources.CustomMetric(name="name_value") + arg = args[0].data_stream + mock_val = resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ) assert arg == mock_val -def test_create_custom_metric_flattened_error(): +def test_create_data_stream_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -18848,34 +18588,42 @@ def test_create_custom_metric_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_custom_metric( - analytics_admin.CreateCustomMetricRequest(), + client.create_data_stream( + analytics_admin.CreateDataStreamRequest(), parent="parent_value", - custom_metric=resources.CustomMetric(name="name_value"), + data_stream=resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ), ) @pytest.mark.asyncio -async def test_create_custom_metric_flattened_async(): +async def test_create_data_stream_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.create_data_stream), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric() + call.return_value = resources.DataStream() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric() + resources.DataStream() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_custom_metric( + response = await client.create_data_stream( parent="parent_value", - custom_metric=resources.CustomMetric(name="name_value"), + data_stream=resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ), ) # Establish that the underlying call was made with the expected @@ -18885,13 +18633,17 @@ async def test_create_custom_metric_flattened_async(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].custom_metric - mock_val = resources.CustomMetric(name="name_value") + arg = args[0].data_stream + mock_val = resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ) assert arg == mock_val @pytest.mark.asyncio -async def test_create_custom_metric_flattened_error_async(): +async def test_create_data_stream_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -18899,21 +18651,25 @@ async def test_create_custom_metric_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_custom_metric( - analytics_admin.CreateCustomMetricRequest(), + await client.create_data_stream( + analytics_admin.CreateDataStreamRequest(), parent="parent_value", - custom_metric=resources.CustomMetric(name="name_value"), + data_stream=resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateCustomMetricRequest, + analytics_admin.DeleteDataStreamRequest, dict, ], ) -def test_update_custom_metric(request_type, transport: str = "grpc"): +def test_delete_data_stream(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -18925,41 +18681,22 @@ def test_update_custom_metric(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.delete_data_stream), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, - restricted_metric_type=[ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ], - ) - response = client.update_custom_metric(request) + call.return_value = None + response = client.delete_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomMetricRequest() + assert args[0] == analytics_admin.DeleteDataStreamRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) - assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT - assert response.restricted_metric_type == [ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ] + assert response is None -def test_update_custom_metric_empty_call(): +def test_delete_data_stream_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -18969,18 +18706,18 @@ def test_update_custom_metric_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.delete_data_stream), "__call__" ) as call: - client.update_custom_metric() + client.delete_data_stream() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomMetricRequest() + assert args[0] == analytics_admin.DeleteDataStreamRequest() @pytest.mark.asyncio -async def test_update_custom_metric_async( +async def test_delete_data_stream_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateCustomMetricRequest, + request_type=analytics_admin.DeleteDataStreamRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -18993,64 +18730,43 @@ async def test_update_custom_metric_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.delete_data_stream), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, - restricted_metric_type=[ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ], - ) - ) - response = await client.update_custom_metric(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomMetricRequest() + assert args[0] == analytics_admin.DeleteDataStreamRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) - assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT - assert response.restricted_metric_type == [ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ] + assert response is None @pytest.mark.asyncio -async def test_update_custom_metric_async_from_dict(): - await test_update_custom_metric_async(request_type=dict) +async def test_delete_data_stream_async_from_dict(): + await test_delete_data_stream_async(request_type=dict) -def test_update_custom_metric_field_headers(): +def test_delete_data_stream_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateCustomMetricRequest() + request = analytics_admin.DeleteDataStreamRequest() - request.custom_metric.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.delete_data_stream), "__call__" ) as call: - call.return_value = resources.CustomMetric() - client.update_custom_metric(request) + call.return_value = None + client.delete_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -19061,30 +18777,28 @@ def test_update_custom_metric_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "custom_metric.name=name_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_custom_metric_field_headers_async(): +async def test_delete_data_stream_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateCustomMetricRequest() + request = analytics_admin.DeleteDataStreamRequest() - request.custom_metric.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.delete_data_stream), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric() - ) - await client.update_custom_metric(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -19095,41 +18809,37 @@ async def test_update_custom_metric_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "custom_metric.name=name_value", + "name=name_value", ) in kw["metadata"] -def test_update_custom_metric_flattened(): +def test_delete_data_stream_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.delete_data_stream), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_custom_metric( - custom_metric=resources.CustomMetric(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.delete_data_stream( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].custom_metric - mock_val = resources.CustomMetric(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_update_custom_metric_flattened_error(): +def test_delete_data_stream_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -19137,50 +18847,43 @@ def test_update_custom_metric_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_custom_metric( - analytics_admin.UpdateCustomMetricRequest(), - custom_metric=resources.CustomMetric(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.delete_data_stream( + analytics_admin.DeleteDataStreamRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_update_custom_metric_flattened_async(): +async def test_delete_data_stream_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.delete_data_stream), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_custom_metric( - custom_metric=resources.CustomMetric(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + response = await client.delete_data_stream( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].custom_metric - mock_val = resources.CustomMetric(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_update_custom_metric_flattened_error_async(): +async def test_delete_data_stream_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -19188,21 +18891,20 @@ async def test_update_custom_metric_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_custom_metric( - analytics_admin.UpdateCustomMetricRequest(), - custom_metric=resources.CustomMetric(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + await client.delete_data_stream( + analytics_admin.DeleteDataStreamRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListCustomMetricsRequest, + analytics_admin.UpdateDataStreamRequest, dict, ], ) -def test_list_custom_metrics(request_type, transport: str = "grpc"): +def test_update_data_stream(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -19214,25 +18916,29 @@ def test_list_custom_metrics(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.update_data_stream), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListCustomMetricsResponse( - next_page_token="next_page_token_value", + call.return_value = resources.DataStream( + name="name_value", + type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, + display_name="display_name_value", ) - response = client.list_custom_metrics(request) + response = client.update_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomMetricsRequest() + assert args[0] == analytics_admin.UpdateDataStreamRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomMetricsPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.DataStream) + assert response.name == "name_value" + assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM + assert response.display_name == "display_name_value" -def test_list_custom_metrics_empty_call(): +def test_update_data_stream_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -19242,18 +18948,18 @@ def test_list_custom_metrics_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.update_data_stream), "__call__" ) as call: - client.list_custom_metrics() + client.update_data_stream() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomMetricsRequest() + assert args[0] == analytics_admin.UpdateDataStreamRequest() @pytest.mark.asyncio -async def test_list_custom_metrics_async( +async def test_update_data_stream_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListCustomMetricsRequest, + request_type=analytics_admin.UpdateDataStreamRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19266,48 +18972,52 @@ async def test_list_custom_metrics_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.update_data_stream), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListCustomMetricsResponse( - next_page_token="next_page_token_value", + resources.DataStream( + name="name_value", + type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, + display_name="display_name_value", ) ) - response = await client.list_custom_metrics(request) + response = await client.update_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomMetricsRequest() + assert args[0] == analytics_admin.UpdateDataStreamRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomMetricsAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.DataStream) + assert response.name == "name_value" + assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM + assert response.display_name == "display_name_value" @pytest.mark.asyncio -async def test_list_custom_metrics_async_from_dict(): - await test_list_custom_metrics_async(request_type=dict) +async def test_update_data_stream_async_from_dict(): + await test_update_data_stream_async(request_type=dict) -def test_list_custom_metrics_field_headers(): +def test_update_data_stream_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListCustomMetricsRequest() + request = analytics_admin.UpdateDataStreamRequest() - request.parent = "parent_value" + request.data_stream.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.update_data_stream), "__call__" ) as call: - call.return_value = analytics_admin.ListCustomMetricsResponse() - client.list_custom_metrics(request) + call.return_value = resources.DataStream() + client.update_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -19318,30 +19028,30 @@ def test_list_custom_metrics_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "data_stream.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_custom_metrics_field_headers_async(): +async def test_update_data_stream_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListCustomMetricsRequest() + request = analytics_admin.UpdateDataStreamRequest() - request.parent = "parent_value" + request.data_stream.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.update_data_stream), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListCustomMetricsResponse() + resources.DataStream() ) - await client.list_custom_metrics(request) + await client.update_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -19352,37 +19062,49 @@ async def test_list_custom_metrics_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "data_stream.name=name_value", ) in kw["metadata"] -def test_list_custom_metrics_flattened(): +def test_update_data_stream_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.update_data_stream), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListCustomMetricsResponse() + call.return_value = resources.DataStream() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_custom_metrics( - parent="parent_value", + client.update_data_stream( + data_stream=resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].data_stream + mock_val = resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ) + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_list_custom_metrics_flattened_error(): +def test_update_data_stream_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -19390,45 +19112,62 @@ def test_list_custom_metrics_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_custom_metrics( - analytics_admin.ListCustomMetricsRequest(), - parent="parent_value", + client.update_data_stream( + analytics_admin.UpdateDataStreamRequest(), + data_stream=resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_list_custom_metrics_flattened_async(): +async def test_update_data_stream_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.update_data_stream), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListCustomMetricsResponse() + call.return_value = resources.DataStream() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListCustomMetricsResponse() + resources.DataStream() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_custom_metrics( - parent="parent_value", + response = await client.update_data_stream( + data_stream=resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].data_stream + mock_val = resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ) + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val @pytest.mark.asyncio -async def test_list_custom_metrics_flattened_error_async(): +async def test_update_data_stream_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -19436,218 +19175,25 @@ async def test_list_custom_metrics_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_custom_metrics( - analytics_admin.ListCustomMetricsRequest(), - parent="parent_value", - ) - - -def test_list_custom_metrics_pager(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - resources.CustomMetric(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[], - next_page_token="def", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - ], - next_page_token="ghi", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_custom_metrics(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.CustomMetric) for i in results) - - -def test_list_custom_metrics_pages(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - resources.CustomMetric(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[], - next_page_token="def", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - ], - next_page_token="ghi", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - ], - ), - RuntimeError, - ) - pages = list(client.list_custom_metrics(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_custom_metrics_async_pager(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_custom_metrics), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - resources.CustomMetric(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[], - next_page_token="def", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - ], - next_page_token="ghi", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_custom_metrics( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.CustomMetric) for i in responses) - - -@pytest.mark.asyncio -async def test_list_custom_metrics_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_custom_metrics), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - resources.CustomMetric(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[], - next_page_token="def", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - ], - next_page_token="ghi", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - ], + await client.update_data_stream( + analytics_admin.UpdateDataStreamRequest(), + data_stream=resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) ), - RuntimeError, + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_custom_metrics(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.ArchiveCustomMetricRequest, + analytics_admin.ListDataStreamsRequest, dict, ], ) -def test_archive_custom_metric(request_type, transport: str = "grpc"): +def test_list_data_streams(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -19659,22 +19205,25 @@ def test_archive_custom_metric(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.list_data_streams), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.archive_custom_metric(request) + call.return_value = analytics_admin.ListDataStreamsResponse( + next_page_token="next_page_token_value", + ) + response = client.list_data_streams(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomMetricRequest() + assert args[0] == analytics_admin.ListDataStreamsRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, pagers.ListDataStreamsPager) + assert response.next_page_token == "next_page_token_value" -def test_archive_custom_metric_empty_call(): +def test_list_data_streams_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -19684,18 +19233,17 @@ def test_archive_custom_metric_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.list_data_streams), "__call__" ) as call: - client.archive_custom_metric() + client.list_data_streams() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomMetricRequest() + assert args[0] == analytics_admin.ListDataStreamsRequest() @pytest.mark.asyncio -async def test_archive_custom_metric_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ArchiveCustomMetricRequest, +async def test_list_data_streams_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.ListDataStreamsRequest ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19708,43 +19256,48 @@ async def test_archive_custom_metric_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.list_data_streams), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.archive_custom_metric(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListDataStreamsResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_data_streams(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomMetricRequest() + assert args[0] == analytics_admin.ListDataStreamsRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, pagers.ListDataStreamsAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_archive_custom_metric_async_from_dict(): - await test_archive_custom_metric_async(request_type=dict) +async def test_list_data_streams_async_from_dict(): + await test_list_data_streams_async(request_type=dict) -def test_archive_custom_metric_field_headers(): +def test_list_data_streams_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ArchiveCustomMetricRequest() + request = analytics_admin.ListDataStreamsRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.list_data_streams), "__call__" ) as call: - call.return_value = None - client.archive_custom_metric(request) + call.return_value = analytics_admin.ListDataStreamsResponse() + client.list_data_streams(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -19755,28 +19308,30 @@ def test_archive_custom_metric_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_archive_custom_metric_field_headers_async(): +async def test_list_data_streams_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ArchiveCustomMetricRequest() + request = analytics_admin.ListDataStreamsRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.list_data_streams), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.archive_custom_metric(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListDataStreamsResponse() + ) + await client.list_data_streams(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -19787,37 +19342,37 @@ async def test_archive_custom_metric_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_archive_custom_metric_flattened(): +def test_list_data_streams_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.list_data_streams), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = analytics_admin.ListDataStreamsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.archive_custom_metric( - name="name_value", + client.list_data_streams( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val -def test_archive_custom_metric_flattened_error(): +def test_list_data_streams_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -19825,43 +19380,45 @@ def test_archive_custom_metric_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.archive_custom_metric( - analytics_admin.ArchiveCustomMetricRequest(), - name="name_value", + client.list_data_streams( + analytics_admin.ListDataStreamsRequest(), + parent="parent_value", ) @pytest.mark.asyncio -async def test_archive_custom_metric_flattened_async(): +async def test_list_data_streams_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.list_data_streams), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = analytics_admin.ListDataStreamsResponse() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListDataStreamsResponse() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.archive_custom_metric( - name="name_value", + response = await client.list_data_streams( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val @pytest.mark.asyncio -async def test_archive_custom_metric_flattened_error_async(): +async def test_list_data_streams_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -19869,66 +19426,250 @@ async def test_archive_custom_metric_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.archive_custom_metric( - analytics_admin.ArchiveCustomMetricRequest(), - name="name_value", + await client.list_data_streams( + analytics_admin.ListDataStreamsRequest(), + parent="parent_value", ) -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.GetCustomMetricRequest, - dict, - ], -) -def test_get_custom_metric(request_type, transport: str = "grpc"): +def test_list_data_streams_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" + type(client.transport.list_data_streams), "__call__" ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, - restricted_metric_type=[ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ], + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + resources.DataStream(), + resources.DataStream(), + ], + next_page_token="abc", + ), + analytics_admin.ListDataStreamsResponse( + data_streams=[], + next_page_token="def", + ), + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + resources.DataStream(), + ], + ), + RuntimeError, ) - response = client.get_custom_metric(request) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_data_streams(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.DataStream) for i in results) + + +def test_list_data_streams_pages(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_data_streams), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + resources.DataStream(), + resources.DataStream(), + ], + next_page_token="abc", + ), + analytics_admin.ListDataStreamsResponse( + data_streams=[], + next_page_token="def", + ), + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + resources.DataStream(), + ], + ), + RuntimeError, + ) + pages = list(client.list_data_streams(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_data_streams_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_data_streams), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + resources.DataStream(), + resources.DataStream(), + ], + next_page_token="abc", + ), + analytics_admin.ListDataStreamsResponse( + data_streams=[], + next_page_token="def", + ), + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + resources.DataStream(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_data_streams( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.DataStream) for i in responses) + + +@pytest.mark.asyncio +async def test_list_data_streams_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_data_streams), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + resources.DataStream(), + resources.DataStream(), + ], + next_page_token="abc", + ), + analytics_admin.ListDataStreamsResponse( + data_streams=[], + next_page_token="def", + ), + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + resources.DataStream(), + ], + ), + RuntimeError, + ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_data_streams(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetDataStreamRequest, + dict, + ], +) +def test_get_data_stream(request_type, transport: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: + # Designate an appropriate return value for the call. + call.return_value = resources.DataStream( + name="name_value", + type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, + display_name="display_name_value", + ) + response = client.get_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomMetricRequest() + assert args[0] == analytics_admin.GetDataStreamRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) + assert isinstance(response, resources.DataStream) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" + assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT - assert response.restricted_metric_type == [ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ] -def test_get_custom_metric_empty_call(): +def test_get_data_stream_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -19937,18 +19678,16 @@ def test_get_custom_metric_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" - ) as call: - client.get_custom_metric() + with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: + client.get_data_stream() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomMetricRequest() + assert args[0] == analytics_admin.GetDataStreamRequest() @pytest.mark.asyncio -async def test_get_custom_metric_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetCustomMetricRequest +async def test_get_data_stream_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.GetDataStreamRequest ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -19960,65 +19699,49 @@ async def test_get_custom_metric_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric( + resources.DataStream( name="name_value", - parameter_name="parameter_name_value", + type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, - restricted_metric_type=[ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ], ) ) - response = await client.get_custom_metric(request) + response = await client.get_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomMetricRequest() + assert args[0] == analytics_admin.GetDataStreamRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) + assert isinstance(response, resources.DataStream) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" + assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT - assert response.restricted_metric_type == [ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ] @pytest.mark.asyncio -async def test_get_custom_metric_async_from_dict(): - await test_get_custom_metric_async(request_type=dict) +async def test_get_data_stream_async_from_dict(): + await test_get_data_stream_async(request_type=dict) -def test_get_custom_metric_field_headers(): +def test_get_data_stream_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetCustomMetricRequest() + request = analytics_admin.GetDataStreamRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" - ) as call: - call.return_value = resources.CustomMetric() - client.get_custom_metric(request) + with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: + call.return_value = resources.DataStream() + client.get_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -20034,25 +19757,23 @@ def test_get_custom_metric_field_headers(): @pytest.mark.asyncio -async def test_get_custom_metric_field_headers_async(): +async def test_get_data_stream_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetCustomMetricRequest() + request = analytics_admin.GetDataStreamRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric() + resources.DataStream() ) - await client.get_custom_metric(request) + await client.get_data_stream(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -20067,20 +19788,18 @@ async def test_get_custom_metric_field_headers_async(): ) in kw["metadata"] -def test_get_custom_metric_flattened(): +def test_get_data_stream_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric() + call.return_value = resources.DataStream() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_custom_metric( + client.get_data_stream( name="name_value", ) @@ -20093,7 +19812,7 @@ def test_get_custom_metric_flattened(): assert arg == mock_val -def test_get_custom_metric_flattened_error(): +def test_get_data_stream_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -20101,31 +19820,29 @@ def test_get_custom_metric_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_custom_metric( - analytics_admin.GetCustomMetricRequest(), + client.get_data_stream( + analytics_admin.GetDataStreamRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_get_custom_metric_flattened_async(): +async def test_get_data_stream_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric() + call.return_value = resources.DataStream() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric() + resources.DataStream() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_custom_metric( + response = await client.get_data_stream( name="name_value", ) @@ -20139,7 +19856,7 @@ async def test_get_custom_metric_flattened_async(): @pytest.mark.asyncio -async def test_get_custom_metric_flattened_error_async(): +async def test_get_data_stream_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -20147,8 +19864,8 @@ async def test_get_custom_metric_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_custom_metric( - analytics_admin.GetCustomMetricRequest(), + await client.get_data_stream( + analytics_admin.GetDataStreamRequest(), name="name_value", ) @@ -20156,11 +19873,11 @@ async def test_get_custom_metric_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataRetentionSettingsRequest, + analytics_admin.GetAudienceRequest, dict, ], ) -def test_get_data_retention_settings(request_type, transport: str = "grpc"): +def test_get_audience(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -20171,33 +19888,37 @@ def test_get_data_retention_settings(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_data_retention_settings), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_audience), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataRetentionSettings( + call.return_value = audience.Audience( name="name_value", - event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, - reset_user_data_on_new_activity=True, + display_name="display_name_value", + description="description_value", + membership_duration_days=2561, + ads_personalization_enabled=True, + exclusion_duration_mode=audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, ) - response = client.get_data_retention_settings(request) + response = client.get_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataRetentionSettingsRequest() + assert args[0] == analytics_admin.GetAudienceRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataRetentionSettings) + assert isinstance(response, audience.Audience) assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.membership_duration_days == 2561 + assert response.ads_personalization_enabled is True assert ( - response.event_data_retention - == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + response.exclusion_duration_mode + == audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY ) - assert response.reset_user_data_on_new_activity is True -def test_get_data_retention_settings_empty_call(): +def test_get_audience_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -20206,19 +19927,16 @@ def test_get_data_retention_settings_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_data_retention_settings), "__call__" - ) as call: - client.get_data_retention_settings() + with mock.patch.object(type(client.transport.get_audience), "__call__") as call: + client.get_audience() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataRetentionSettingsRequest() + assert args[0] == analytics_admin.GetAudienceRequest() @pytest.mark.asyncio -async def test_get_data_retention_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.GetDataRetentionSettingsRequest, +async def test_get_audience_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.GetAudienceRequest ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20230,56 +19948,58 @@ async def test_get_data_retention_settings_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_data_retention_settings), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_audience), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataRetentionSettings( + audience.Audience( name="name_value", - event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, - reset_user_data_on_new_activity=True, + display_name="display_name_value", + description="description_value", + membership_duration_days=2561, + ads_personalization_enabled=True, + exclusion_duration_mode=audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, ) ) - response = await client.get_data_retention_settings(request) + response = await client.get_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataRetentionSettingsRequest() + assert args[0] == analytics_admin.GetAudienceRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataRetentionSettings) + assert isinstance(response, audience.Audience) assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.membership_duration_days == 2561 + assert response.ads_personalization_enabled is True assert ( - response.event_data_retention - == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + response.exclusion_duration_mode + == audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY ) - assert response.reset_user_data_on_new_activity is True @pytest.mark.asyncio -async def test_get_data_retention_settings_async_from_dict(): - await test_get_data_retention_settings_async(request_type=dict) +async def test_get_audience_async_from_dict(): + await test_get_audience_async(request_type=dict) -def test_get_data_retention_settings_field_headers(): +def test_get_audience_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetDataRetentionSettingsRequest() + request = analytics_admin.GetAudienceRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_data_retention_settings), "__call__" - ) as call: - call.return_value = resources.DataRetentionSettings() - client.get_data_retention_settings(request) + with mock.patch.object(type(client.transport.get_audience), "__call__") as call: + call.return_value = audience.Audience() + client.get_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -20295,25 +20015,21 @@ def test_get_data_retention_settings_field_headers(): @pytest.mark.asyncio -async def test_get_data_retention_settings_field_headers_async(): +async def test_get_audience_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetDataRetentionSettingsRequest() + request = analytics_admin.GetAudienceRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_data_retention_settings), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataRetentionSettings() - ) - await client.get_data_retention_settings(request) + with mock.patch.object(type(client.transport.get_audience), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(audience.Audience()) + await client.get_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -20328,20 +20044,18 @@ async def test_get_data_retention_settings_field_headers_async(): ) in kw["metadata"] -def test_get_data_retention_settings_flattened(): +def test_get_audience_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_data_retention_settings), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_audience), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataRetentionSettings() + call.return_value = audience.Audience() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_data_retention_settings( + client.get_audience( name="name_value", ) @@ -20354,7 +20068,7 @@ def test_get_data_retention_settings_flattened(): assert arg == mock_val -def test_get_data_retention_settings_flattened_error(): +def test_get_audience_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -20362,31 +20076,27 @@ def test_get_data_retention_settings_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_data_retention_settings( - analytics_admin.GetDataRetentionSettingsRequest(), + client.get_audience( + analytics_admin.GetAudienceRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_get_data_retention_settings_flattened_async(): +async def test_get_audience_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_data_retention_settings), "__call__" - ) as call: + with mock.patch.object(type(client.transport.get_audience), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataRetentionSettings() + call.return_value = audience.Audience() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataRetentionSettings() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(audience.Audience()) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_data_retention_settings( + response = await client.get_audience( name="name_value", ) @@ -20400,7 +20110,7 @@ async def test_get_data_retention_settings_flattened_async(): @pytest.mark.asyncio -async def test_get_data_retention_settings_flattened_error_async(): +async def test_get_audience_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -20408,8 +20118,8 @@ async def test_get_data_retention_settings_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_data_retention_settings( - analytics_admin.GetDataRetentionSettingsRequest(), + await client.get_audience( + analytics_admin.GetAudienceRequest(), name="name_value", ) @@ -20417,11 +20127,11 @@ async def test_get_data_retention_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateDataRetentionSettingsRequest, + analytics_admin.ListAudiencesRequest, dict, ], ) -def test_update_data_retention_settings(request_type, transport: str = "grpc"): +def test_list_audiences(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -20432,33 +20142,24 @@ def test_update_data_retention_settings(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_retention_settings), "__call__" - ) as call: + with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataRetentionSettings( - name="name_value", - event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, - reset_user_data_on_new_activity=True, + call.return_value = analytics_admin.ListAudiencesResponse( + next_page_token="next_page_token_value", ) - response = client.update_data_retention_settings(request) + response = client.list_audiences(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDataRetentionSettingsRequest() + assert args[0] == analytics_admin.ListAudiencesRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataRetentionSettings) - assert response.name == "name_value" - assert ( - response.event_data_retention - == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS - ) - assert response.reset_user_data_on_new_activity is True + assert isinstance(response, pagers.ListAudiencesPager) + assert response.next_page_token == "next_page_token_value" -def test_update_data_retention_settings_empty_call(): +def test_list_audiences_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -20467,19 +20168,16 @@ def test_update_data_retention_settings_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_retention_settings), "__call__" - ) as call: - client.update_data_retention_settings() + with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: + client.list_audiences() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDataRetentionSettingsRequest() + assert args[0] == analytics_admin.ListAudiencesRequest() @pytest.mark.asyncio -async def test_update_data_retention_settings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateDataRetentionSettingsRequest, +async def test_list_audiences_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.ListAudiencesRequest ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20491,56 +20189,45 @@ async def test_update_data_retention_settings_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_retention_settings), "__call__" - ) as call: + with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataRetentionSettings( - name="name_value", - event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, - reset_user_data_on_new_activity=True, + analytics_admin.ListAudiencesResponse( + next_page_token="next_page_token_value", ) ) - response = await client.update_data_retention_settings(request) + response = await client.list_audiences(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDataRetentionSettingsRequest() + assert args[0] == analytics_admin.ListAudiencesRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataRetentionSettings) - assert response.name == "name_value" - assert ( - response.event_data_retention - == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS - ) - assert response.reset_user_data_on_new_activity is True + assert isinstance(response, pagers.ListAudiencesAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_update_data_retention_settings_async_from_dict(): - await test_update_data_retention_settings_async(request_type=dict) +async def test_list_audiences_async_from_dict(): + await test_list_audiences_async(request_type=dict) -def test_update_data_retention_settings_field_headers(): +def test_list_audiences_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateDataRetentionSettingsRequest() + request = analytics_admin.ListAudiencesRequest() - request.data_retention_settings.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_retention_settings), "__call__" - ) as call: - call.return_value = resources.DataRetentionSettings() - client.update_data_retention_settings(request) + with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: + call.return_value = analytics_admin.ListAudiencesResponse() + client.list_audiences(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -20551,30 +20238,28 @@ def test_update_data_retention_settings_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "data_retention_settings.name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_data_retention_settings_field_headers_async(): +async def test_list_audiences_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateDataRetentionSettingsRequest() + request = analytics_admin.ListAudiencesRequest() - request.data_retention_settings.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_retention_settings), "__call__" - ) as call: + with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataRetentionSettings() + analytics_admin.ListAudiencesResponse() ) - await client.update_data_retention_settings(request) + await client.list_audiences(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -20585,41 +20270,35 @@ async def test_update_data_retention_settings_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "data_retention_settings.name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_update_data_retention_settings_flattened(): +def test_list_audiences_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_retention_settings), "__call__" - ) as call: + with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataRetentionSettings() + call.return_value = analytics_admin.ListAudiencesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_data_retention_settings( - data_retention_settings=resources.DataRetentionSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.list_audiences( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].data_retention_settings - mock_val = resources.DataRetentionSettings(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val -def test_update_data_retention_settings_flattened_error(): +def test_list_audiences_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -20627,50 +20306,43 @@ def test_update_data_retention_settings_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_data_retention_settings( - analytics_admin.UpdateDataRetentionSettingsRequest(), - data_retention_settings=resources.DataRetentionSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.list_audiences( + analytics_admin.ListAudiencesRequest(), + parent="parent_value", ) @pytest.mark.asyncio -async def test_update_data_retention_settings_flattened_async(): +async def test_list_audiences_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_retention_settings), "__call__" - ) as call: + with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataRetentionSettings() + call.return_value = analytics_admin.ListAudiencesResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataRetentionSettings() + analytics_admin.ListAudiencesResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_data_retention_settings( - data_retention_settings=resources.DataRetentionSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + response = await client.list_audiences( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].data_retention_settings - mock_val = resources.DataRetentionSettings(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val @pytest.mark.asyncio -async def test_update_data_retention_settings_flattened_error_async(): +async def test_list_audiences_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -20678,21 +20350,210 @@ async def test_update_data_retention_settings_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_data_retention_settings( - analytics_admin.UpdateDataRetentionSettingsRequest(), - data_retention_settings=resources.DataRetentionSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + await client.list_audiences( + analytics_admin.ListAudiencesRequest(), + parent="parent_value", + ) + + +def test_list_audiences_pager(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + audience.Audience(), + audience.Audience(), + ], + next_page_token="abc", + ), + analytics_admin.ListAudiencesResponse( + audiences=[], + next_page_token="def", + ), + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + audience.Audience(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_audiences(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, audience.Audience) for i in results) + + +def test_list_audiences_pages(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + audience.Audience(), + audience.Audience(), + ], + next_page_token="abc", + ), + analytics_admin.ListAudiencesResponse( + audiences=[], + next_page_token="def", + ), + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + audience.Audience(), + ], + ), + RuntimeError, + ) + pages = list(client.list_audiences(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_audiences_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_audiences), "__call__", new_callable=mock.AsyncMock + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + audience.Audience(), + audience.Audience(), + ], + next_page_token="abc", + ), + analytics_admin.ListAudiencesResponse( + audiences=[], + next_page_token="def", + ), + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + audience.Audience(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_audiences( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, audience.Audience) for i in responses) + + +@pytest.mark.asyncio +async def test_list_audiences_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_audiences), "__call__", new_callable=mock.AsyncMock + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + audience.Audience(), + audience.Audience(), + ], + next_page_token="abc", + ), + analytics_admin.ListAudiencesResponse( + audiences=[], + next_page_token="def", + ), + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + audience.Audience(), + ], + ), + RuntimeError, ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_audiences(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateDataStreamRequest, + analytics_admin.CreateAudienceRequest, dict, ], ) -def test_create_data_stream(request_type, transport: str = "grpc"): +def test_create_audience(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -20703,30 +20564,37 @@ def test_create_data_stream(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_data_stream), "__call__" - ) as call: + with mock.patch.object(type(client.transport.create_audience), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataStream( + call.return_value = gaa_audience.Audience( name="name_value", - type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, display_name="display_name_value", + description="description_value", + membership_duration_days=2561, + ads_personalization_enabled=True, + exclusion_duration_mode=gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, ) - response = client.create_data_stream(request) + response = client.create_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateDataStreamRequest() + assert args[0] == analytics_admin.CreateAudienceRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataStream) + assert isinstance(response, gaa_audience.Audience) assert response.name == "name_value" - assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.membership_duration_days == 2561 + assert response.ads_personalization_enabled is True + assert ( + response.exclusion_duration_mode + == gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY + ) -def test_create_data_stream_empty_call(): +def test_create_audience_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -20735,19 +20603,16 @@ def test_create_data_stream_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_data_stream), "__call__" - ) as call: - client.create_data_stream() + with mock.patch.object(type(client.transport.create_audience), "__call__") as call: + client.create_audience() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateDataStreamRequest() + assert args[0] == analytics_admin.CreateAudienceRequest() @pytest.mark.asyncio -async def test_create_data_stream_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateDataStreamRequest, +async def test_create_audience_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.CreateAudienceRequest ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -20759,53 +20624,58 @@ async def test_create_data_stream_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_data_stream), "__call__" - ) as call: + with mock.patch.object(type(client.transport.create_audience), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataStream( + gaa_audience.Audience( name="name_value", - type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, display_name="display_name_value", + description="description_value", + membership_duration_days=2561, + ads_personalization_enabled=True, + exclusion_duration_mode=gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, ) ) - response = await client.create_data_stream(request) + response = await client.create_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateDataStreamRequest() + assert args[0] == analytics_admin.CreateAudienceRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataStream) + assert isinstance(response, gaa_audience.Audience) assert response.name == "name_value" - assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.membership_duration_days == 2561 + assert response.ads_personalization_enabled is True + assert ( + response.exclusion_duration_mode + == gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY + ) @pytest.mark.asyncio -async def test_create_data_stream_async_from_dict(): - await test_create_data_stream_async(request_type=dict) +async def test_create_audience_async_from_dict(): + await test_create_audience_async(request_type=dict) -def test_create_data_stream_field_headers(): +def test_create_audience_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateDataStreamRequest() + request = analytics_admin.CreateAudienceRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_data_stream), "__call__" - ) as call: - call.return_value = resources.DataStream() - client.create_data_stream(request) + with mock.patch.object(type(client.transport.create_audience), "__call__") as call: + call.return_value = gaa_audience.Audience() + client.create_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -20821,25 +20691,23 @@ def test_create_data_stream_field_headers(): @pytest.mark.asyncio -async def test_create_data_stream_field_headers_async(): +async def test_create_audience_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateDataStreamRequest() + request = analytics_admin.CreateAudienceRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_data_stream), "__call__" - ) as call: + with mock.patch.object(type(client.transport.create_audience), "__call__") as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataStream() + gaa_audience.Audience() ) - await client.create_data_stream(request) + await client.create_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -20854,26 +20722,20 @@ async def test_create_data_stream_field_headers_async(): ) in kw["metadata"] -def test_create_data_stream_flattened(): +def test_create_audience_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_data_stream), "__call__" - ) as call: + with mock.patch.object(type(client.transport.create_audience), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataStream() + call.return_value = gaa_audience.Audience() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_data_stream( + client.create_audience( parent="parent_value", - data_stream=resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ), + audience=gaa_audience.Audience(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -20883,16 +20745,12 @@ def test_create_data_stream_flattened(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].data_stream - mock_val = resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ) + arg = args[0].audience + mock_val = gaa_audience.Audience(name="name_value") assert arg == mock_val -def test_create_data_stream_flattened_error(): +def test_create_audience_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -20900,42 +20758,32 @@ def test_create_data_stream_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_data_stream( - analytics_admin.CreateDataStreamRequest(), + client.create_audience( + analytics_admin.CreateAudienceRequest(), parent="parent_value", - data_stream=resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ), + audience=gaa_audience.Audience(name="name_value"), ) @pytest.mark.asyncio -async def test_create_data_stream_flattened_async(): +async def test_create_audience_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_data_stream), "__call__" - ) as call: + with mock.patch.object(type(client.transport.create_audience), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataStream() + call.return_value = gaa_audience.Audience() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataStream() + gaa_audience.Audience() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_data_stream( + response = await client.create_audience( parent="parent_value", - data_stream=resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ), + audience=gaa_audience.Audience(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -20945,17 +20793,13 @@ async def test_create_data_stream_flattened_async(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].data_stream - mock_val = resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ) + arg = args[0].audience + mock_val = gaa_audience.Audience(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_create_data_stream_flattened_error_async(): +async def test_create_audience_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -20963,25 +20807,21 @@ async def test_create_data_stream_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_data_stream( - analytics_admin.CreateDataStreamRequest(), + await client.create_audience( + analytics_admin.CreateAudienceRequest(), parent="parent_value", - data_stream=resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ), + audience=gaa_audience.Audience(name="name_value"), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteDataStreamRequest, + analytics_admin.UpdateAudienceRequest, dict, ], ) -def test_delete_data_stream(request_type, transport: str = "grpc"): +def test_update_audience(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -20992,44 +20832,55 @@ def test_delete_data_stream(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_data_stream), "__call__" - ) as call: + with mock.patch.object(type(client.transport.update_audience), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_data_stream(request) + call.return_value = gaa_audience.Audience( + name="name_value", + display_name="display_name_value", + description="description_value", + membership_duration_days=2561, + ads_personalization_enabled=True, + exclusion_duration_mode=gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, + ) + response = client.update_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteDataStreamRequest() + assert args[0] == analytics_admin.UpdateAudienceRequest() # Establish that the response is the type that we expect. - assert response is None - - -def test_delete_data_stream_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = AnalyticsAdminServiceClient( + assert isinstance(response, gaa_audience.Audience) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.membership_duration_days == 2561 + assert response.ads_personalization_enabled is True + assert ( + response.exclusion_duration_mode + == gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY + ) + + +def test_update_audience_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_data_stream), "__call__" - ) as call: - client.delete_data_stream() + with mock.patch.object(type(client.transport.update_audience), "__call__") as call: + client.update_audience() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteDataStreamRequest() + assert args[0] == analytics_admin.UpdateAudienceRequest() @pytest.mark.asyncio -async def test_delete_data_stream_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteDataStreamRequest, +async def test_update_audience_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.UpdateAudienceRequest ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21041,44 +20892,58 @@ async def test_delete_data_stream_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_data_stream), "__call__" - ) as call: + with mock.patch.object(type(client.transport.update_audience), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_data_stream(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gaa_audience.Audience( + name="name_value", + display_name="display_name_value", + description="description_value", + membership_duration_days=2561, + ads_personalization_enabled=True, + exclusion_duration_mode=gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, + ) + ) + response = await client.update_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteDataStreamRequest() + assert args[0] == analytics_admin.UpdateAudienceRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, gaa_audience.Audience) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.membership_duration_days == 2561 + assert response.ads_personalization_enabled is True + assert ( + response.exclusion_duration_mode + == gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY + ) @pytest.mark.asyncio -async def test_delete_data_stream_async_from_dict(): - await test_delete_data_stream_async(request_type=dict) +async def test_update_audience_async_from_dict(): + await test_update_audience_async(request_type=dict) -def test_delete_data_stream_field_headers(): +def test_update_audience_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteDataStreamRequest() + request = analytics_admin.UpdateAudienceRequest() - request.name = "name_value" + request.audience.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_data_stream), "__call__" - ) as call: - call.return_value = None - client.delete_data_stream(request) + with mock.patch.object(type(client.transport.update_audience), "__call__") as call: + call.return_value = gaa_audience.Audience() + client.update_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -21089,28 +20954,28 @@ def test_delete_data_stream_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "audience.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_delete_data_stream_field_headers_async(): +async def test_update_audience_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteDataStreamRequest() + request = analytics_admin.UpdateAudienceRequest() - request.name = "name_value" + request.audience.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_data_stream), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_data_stream(request) + with mock.patch.object(type(client.transport.update_audience), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gaa_audience.Audience() + ) + await client.update_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -21121,37 +20986,39 @@ async def test_delete_data_stream_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "audience.name=name_value", ) in kw["metadata"] -def test_delete_data_stream_flattened(): +def test_update_audience_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_data_stream), "__call__" - ) as call: + with mock.patch.object(type(client.transport.update_audience), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = gaa_audience.Audience() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_data_stream( - name="name_value", + client.update_audience( + audience=gaa_audience.Audience(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].audience + mock_val = gaa_audience.Audience(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_delete_data_stream_flattened_error(): +def test_update_audience_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -21159,43 +21026,48 @@ def test_delete_data_stream_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_data_stream( - analytics_admin.DeleteDataStreamRequest(), - name="name_value", + client.update_audience( + analytics_admin.UpdateAudienceRequest(), + audience=gaa_audience.Audience(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_delete_data_stream_flattened_async(): +async def test_update_audience_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_data_stream), "__call__" - ) as call: + with mock.patch.object(type(client.transport.update_audience), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = gaa_audience.Audience() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gaa_audience.Audience() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_data_stream( - name="name_value", + response = await client.update_audience( + audience=gaa_audience.Audience(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].audience + mock_val = gaa_audience.Audience(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val @pytest.mark.asyncio -async def test_delete_data_stream_flattened_error_async(): +async def test_update_audience_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -21203,20 +21075,21 @@ async def test_delete_data_stream_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.delete_data_stream( - analytics_admin.DeleteDataStreamRequest(), - name="name_value", + await client.update_audience( + analytics_admin.UpdateAudienceRequest(), + audience=gaa_audience.Audience(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateDataStreamRequest, + analytics_admin.ArchiveAudienceRequest, dict, ], ) -def test_update_data_stream(request_type, transport: str = "grpc"): +def test_archive_audience(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -21227,30 +21100,21 @@ def test_update_data_stream(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_stream), "__call__" - ) as call: + with mock.patch.object(type(client.transport.archive_audience), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataStream( - name="name_value", - type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, - display_name="display_name_value", - ) - response = client.update_data_stream(request) + call.return_value = None + response = client.archive_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDataStreamRequest() + assert args[0] == analytics_admin.ArchiveAudienceRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataStream) - assert response.name == "name_value" - assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM - assert response.display_name == "display_name_value" + assert response is None -def test_update_data_stream_empty_call(): +def test_archive_audience_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -21259,19 +21123,16 @@ def test_update_data_stream_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_stream), "__call__" - ) as call: - client.update_data_stream() + with mock.patch.object(type(client.transport.archive_audience), "__call__") as call: + client.archive_audience() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDataStreamRequest() + assert args[0] == analytics_admin.ArchiveAudienceRequest() @pytest.mark.asyncio -async def test_update_data_stream_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateDataStreamRequest, +async def test_archive_audience_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.ArchiveAudienceRequest ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21283,53 +21144,40 @@ async def test_update_data_stream_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_stream), "__call__" - ) as call: + with mock.patch.object(type(client.transport.archive_audience), "__call__") as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataStream( - name="name_value", - type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, - display_name="display_name_value", - ) - ) - response = await client.update_data_stream(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.archive_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateDataStreamRequest() + assert args[0] == analytics_admin.ArchiveAudienceRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataStream) - assert response.name == "name_value" - assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM - assert response.display_name == "display_name_value" + assert response is None @pytest.mark.asyncio -async def test_update_data_stream_async_from_dict(): - await test_update_data_stream_async(request_type=dict) +async def test_archive_audience_async_from_dict(): + await test_archive_audience_async(request_type=dict) -def test_update_data_stream_field_headers(): +def test_archive_audience_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateDataStreamRequest() + request = analytics_admin.ArchiveAudienceRequest() - request.data_stream.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_stream), "__call__" - ) as call: - call.return_value = resources.DataStream() - client.update_data_stream(request) + with mock.patch.object(type(client.transport.archive_audience), "__call__") as call: + call.return_value = None + client.archive_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -21340,30 +21188,26 @@ def test_update_data_stream_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "data_stream.name=name_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_data_stream_field_headers_async(): +async def test_archive_audience_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateDataStreamRequest() + request = analytics_admin.ArchiveAudienceRequest() - request.data_stream.name = "name_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_stream), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataStream() - ) - await client.update_data_stream(request) + with mock.patch.object(type(client.transport.archive_audience), "__call__") as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.archive_audience(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -21374,138 +21218,18 @@ async def test_update_data_stream_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "data_stream.name=name_value", + "name=name_value", ) in kw["metadata"] -def test_update_data_stream_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_stream), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.DataStream() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_data_stream( - data_stream=resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].data_stream - mock_val = resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ) - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) - assert arg == mock_val - - -def test_update_data_stream_flattened_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_data_stream( - analytics_admin.UpdateDataStreamRequest(), - data_stream=resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) - - -@pytest.mark.asyncio -async def test_update_data_stream_flattened_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_data_stream), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.DataStream() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataStream() - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_data_stream( - data_stream=resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].data_stream - mock_val = resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ) - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) - assert arg == mock_val - - -@pytest.mark.asyncio -async def test_update_data_stream_flattened_error_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_data_stream( - analytics_admin.UpdateDataStreamRequest(), - data_stream=resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) - - @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListDataStreamsRequest, + analytics_admin.GetSearchAds360LinkRequest, dict, ], ) -def test_list_data_streams(request_type, transport: str = "grpc"): +def test_get_search_ads360_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -21517,25 +21241,29 @@ def test_list_data_streams(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_data_streams), "__call__" + type(client.transport.get_search_ads360_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListDataStreamsResponse( - next_page_token="next_page_token_value", + call.return_value = resources.SearchAds360Link( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) - response = client.list_data_streams(request) + response = client.get_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListDataStreamsRequest() + assert args[0] == analytics_admin.GetSearchAds360LinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDataStreamsPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.SearchAds360Link) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_list_data_streams_empty_call(): +def test_get_search_ads360_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -21545,17 +21273,18 @@ def test_list_data_streams_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_data_streams), "__call__" + type(client.transport.get_search_ads360_link), "__call__" ) as call: - client.list_data_streams() + client.get_search_ads360_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListDataStreamsRequest() + assert args[0] == analytics_admin.GetSearchAds360LinkRequest() @pytest.mark.asyncio -async def test_list_data_streams_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ListDataStreamsRequest +async def test_get_search_ads360_link_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.GetSearchAds360LinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -21568,48 +21297,52 @@ async def test_list_data_streams_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_data_streams), "__call__" + type(client.transport.get_search_ads360_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListDataStreamsResponse( - next_page_token="next_page_token_value", + resources.SearchAds360Link( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) ) - response = await client.list_data_streams(request) + response = await client.get_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListDataStreamsRequest() + assert args[0] == analytics_admin.GetSearchAds360LinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDataStreamsAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.SearchAds360Link) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" @pytest.mark.asyncio -async def test_list_data_streams_async_from_dict(): - await test_list_data_streams_async(request_type=dict) +async def test_get_search_ads360_link_async_from_dict(): + await test_get_search_ads360_link_async(request_type=dict) -def test_list_data_streams_field_headers(): +def test_get_search_ads360_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListDataStreamsRequest() + request = analytics_admin.GetSearchAds360LinkRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_data_streams), "__call__" + type(client.transport.get_search_ads360_link), "__call__" ) as call: - call.return_value = analytics_admin.ListDataStreamsResponse() - client.list_data_streams(request) + call.return_value = resources.SearchAds360Link() + client.get_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -21620,30 +21353,30 @@ def test_list_data_streams_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_data_streams_field_headers_async(): +async def test_get_search_ads360_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListDataStreamsRequest() + request = analytics_admin.GetSearchAds360LinkRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_data_streams), "__call__" + type(client.transport.get_search_ads360_link), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListDataStreamsResponse() + resources.SearchAds360Link() ) - await client.list_data_streams(request) + await client.get_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -21654,37 +21387,37 @@ async def test_list_data_streams_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_list_data_streams_flattened(): +def test_get_search_ads360_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_data_streams), "__call__" + type(client.transport.get_search_ads360_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListDataStreamsResponse() + call.return_value = resources.SearchAds360Link() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_data_streams( - parent="parent_value", + client.get_search_ads360_link( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_list_data_streams_flattened_error(): +def test_get_search_ads360_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -21692,45 +21425,45 @@ def test_list_data_streams_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_data_streams( - analytics_admin.ListDataStreamsRequest(), - parent="parent_value", + client.get_search_ads360_link( + analytics_admin.GetSearchAds360LinkRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_list_data_streams_flattened_async(): +async def test_get_search_ads360_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_data_streams), "__call__" + type(client.transport.get_search_ads360_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListDataStreamsResponse() + call.return_value = resources.SearchAds360Link() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListDataStreamsResponse() + resources.SearchAds360Link() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_data_streams( - parent="parent_value", + response = await client.get_search_ads360_link( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_list_data_streams_flattened_error_async(): +async def test_get_search_ads360_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -21738,46 +21471,293 @@ async def test_list_data_streams_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_data_streams( - analytics_admin.ListDataStreamsRequest(), - parent="parent_value", + await client.get_search_ads360_link( + analytics_admin.GetSearchAds360LinkRequest(), + name="name_value", ) -def test_list_data_streams_pager(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListSearchAds360LinksRequest, + dict, + ], +) +def test_list_search_ads360_links(request_type, transport: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_data_streams), "__call__" + type(client.transport.list_search_ads360_links), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.ListSearchAds360LinksResponse( + next_page_token="next_page_token_value", + ) + response = client.list_search_ads360_links(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ListSearchAds360LinksRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListSearchAds360LinksPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_search_ads360_links_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_search_ads360_links), "__call__" + ) as call: + client.list_search_ads360_links() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ListSearchAds360LinksRequest() + + +@pytest.mark.asyncio +async def test_list_search_ads360_links_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.ListSearchAds360LinksRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_search_ads360_links), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListSearchAds360LinksResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_search_ads360_links(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ListSearchAds360LinksRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListSearchAds360LinksAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_search_ads360_links_async_from_dict(): + await test_list_search_ads360_links_async(request_type=dict) + + +def test_list_search_ads360_links_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ListSearchAds360LinksRequest() + + request.parent = "parent_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_search_ads360_links), "__call__" + ) as call: + call.return_value = analytics_admin.ListSearchAds360LinksResponse() + client.list_search_ads360_links(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_search_ads360_links_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ListSearchAds360LinksRequest() + + request.parent = "parent_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_search_ads360_links), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListSearchAds360LinksResponse() + ) + await client.list_search_ads360_links(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] + + +def test_list_search_ads360_links_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_search_ads360_links), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.ListSearchAds360LinksResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_search_ads360_links( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +def test_list_search_ads360_links_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_search_ads360_links( + analytics_admin.ListSearchAds360LinksRequest(), + parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_search_ads360_links_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_search_ads360_links), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.ListSearchAds360LinksResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListSearchAds360LinksResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_search_ads360_links( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_list_search_ads360_links_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_search_ads360_links( + analytics_admin.ListSearchAds360LinksRequest(), + parent="parent_value", + ) + + +def test_list_search_ads360_links_pager(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_search_ads360_links), "__call__" ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), - resources.DataStream(), - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), + resources.SearchAds360Link(), + resources.SearchAds360Link(), ], next_page_token="abc", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[], + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[], next_page_token="def", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), ], next_page_token="ghi", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), + resources.SearchAds360Link(), ], ), RuntimeError, @@ -21787,16 +21767,16 @@ def test_list_data_streams_pager(transport_name: str = "grpc"): metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), ) - pager = client.list_data_streams(request={}) + pager = client.list_search_ads360_links(request={}) assert pager._metadata == metadata results = list(pager) assert len(results) == 6 - assert all(isinstance(i, resources.DataStream) for i in results) + assert all(isinstance(i, resources.SearchAds360Link) for i in results) -def test_list_data_streams_pages(transport_name: str = "grpc"): +def test_list_search_ads360_links_pages(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials, transport=transport_name, @@ -21804,82 +21784,82 @@ def test_list_data_streams_pages(transport_name: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_data_streams), "__call__" + type(client.transport.list_search_ads360_links), "__call__" ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), - resources.DataStream(), - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), + resources.SearchAds360Link(), + resources.SearchAds360Link(), ], next_page_token="abc", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[], + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[], next_page_token="def", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), ], next_page_token="ghi", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), + resources.SearchAds360Link(), ], ), RuntimeError, ) - pages = list(client.list_data_streams(request={}).pages) + pages = list(client.list_search_ads360_links(request={}).pages) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_list_data_streams_async_pager(): +async def test_list_search_ads360_links_async_pager(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_data_streams), + type(client.transport.list_search_ads360_links), "__call__", new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), - resources.DataStream(), - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), + resources.SearchAds360Link(), + resources.SearchAds360Link(), ], next_page_token="abc", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[], + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[], next_page_token="def", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), ], next_page_token="ghi", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), + resources.SearchAds360Link(), ], ), RuntimeError, ) - async_pager = await client.list_data_streams( + async_pager = await client.list_search_ads360_links( request={}, ) assert async_pager.next_page_token == "abc" @@ -21888,45 +21868,45 @@ async def test_list_data_streams_async_pager(): responses.append(response) assert len(responses) == 6 - assert all(isinstance(i, resources.DataStream) for i in responses) + assert all(isinstance(i, resources.SearchAds360Link) for i in responses) @pytest.mark.asyncio -async def test_list_data_streams_async_pages(): +async def test_list_search_ads360_links_async_pages(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_data_streams), + type(client.transport.list_search_ads360_links), "__call__", new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), - resources.DataStream(), - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), + resources.SearchAds360Link(), + resources.SearchAds360Link(), ], next_page_token="abc", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[], + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[], next_page_token="def", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), ], next_page_token="ghi", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), + resources.SearchAds360Link(), ], ), RuntimeError, @@ -21935,7 +21915,7 @@ async def test_list_data_streams_async_pages(): # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 async for page_ in ( # pragma: no branch - await client.list_data_streams(request={}) + await client.list_search_ads360_links(request={}) ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): @@ -21945,11 +21925,11 @@ async def test_list_data_streams_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataStreamRequest, + analytics_admin.CreateSearchAds360LinkRequest, dict, ], ) -def test_get_data_stream(request_type, transport: str = "grpc"): +def test_create_search_ads360_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -21960,28 +21940,30 @@ def test_get_data_stream(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: + with mock.patch.object( + type(client.transport.create_search_ads360_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataStream( + call.return_value = resources.SearchAds360Link( name="name_value", - type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, - display_name="display_name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) - response = client.get_data_stream(request) + response = client.create_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataStreamRequest() + assert args[0] == analytics_admin.CreateSearchAds360LinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataStream) + assert isinstance(response, resources.SearchAds360Link) assert response.name == "name_value" - assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM - assert response.display_name == "display_name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_get_data_stream_empty_call(): +def test_create_search_ads360_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -21990,16 +21972,19 @@ def test_get_data_stream_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: - client.get_data_stream() + with mock.patch.object( + type(client.transport.create_search_ads360_link), "__call__" + ) as call: + client.create_search_ads360_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataStreamRequest() + assert args[0] == analytics_admin.CreateSearchAds360LinkRequest() @pytest.mark.asyncio -async def test_get_data_stream_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetDataStreamRequest +async def test_create_search_ads360_link_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.CreateSearchAds360LinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22011,49 +21996,53 @@ async def test_get_data_stream_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: + with mock.patch.object( + type(client.transport.create_search_ads360_link), "__call__" + ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataStream( + resources.SearchAds360Link( name="name_value", - type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, - display_name="display_name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) ) - response = await client.get_data_stream(request) + response = await client.create_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetDataStreamRequest() + assert args[0] == analytics_admin.CreateSearchAds360LinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataStream) + assert isinstance(response, resources.SearchAds360Link) assert response.name == "name_value" - assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM - assert response.display_name == "display_name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" @pytest.mark.asyncio -async def test_get_data_stream_async_from_dict(): - await test_get_data_stream_async(request_type=dict) +async def test_create_search_ads360_link_async_from_dict(): + await test_create_search_ads360_link_async(request_type=dict) -def test_get_data_stream_field_headers(): +def test_create_search_ads360_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetDataStreamRequest() + request = analytics_admin.CreateSearchAds360LinkRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: - call.return_value = resources.DataStream() - client.get_data_stream(request) + with mock.patch.object( + type(client.transport.create_search_ads360_link), "__call__" + ) as call: + call.return_value = resources.SearchAds360Link() + client.create_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -22064,28 +22053,30 @@ def test_get_data_stream_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_data_stream_field_headers_async(): +async def test_create_search_ads360_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetDataStreamRequest() + request = analytics_admin.CreateSearchAds360LinkRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: + with mock.patch.object( + type(client.transport.create_search_ads360_link), "__call__" + ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataStream() + resources.SearchAds360Link() ) - await client.get_data_stream(request) + await client.create_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -22096,35 +22087,41 @@ async def test_get_data_stream_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_data_stream_flattened(): +def test_create_search_ads360_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: + with mock.patch.object( + type(client.transport.create_search_ads360_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataStream() + call.return_value = resources.SearchAds360Link() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_data_stream( - name="name_value", + client.create_search_ads360_link( + parent="parent_value", + search_ads_360_link=resources.SearchAds360Link(name="name_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].search_ads_360_link + mock_val = resources.SearchAds360Link(name="name_value") assert arg == mock_val -def test_get_data_stream_flattened_error(): +def test_create_search_ads360_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -22132,43 +22129,50 @@ def test_get_data_stream_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_data_stream( - analytics_admin.GetDataStreamRequest(), - name="name_value", - ) - + client.create_search_ads360_link( + analytics_admin.CreateSearchAds360LinkRequest(), + parent="parent_value", + search_ads_360_link=resources.SearchAds360Link(name="name_value"), + ) + @pytest.mark.asyncio -async def test_get_data_stream_flattened_async(): +async def test_create_search_ads360_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_data_stream), "__call__") as call: + with mock.patch.object( + type(client.transport.create_search_ads360_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.DataStream() + call.return_value = resources.SearchAds360Link() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.DataStream() + resources.SearchAds360Link() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_data_stream( - name="name_value", + response = await client.create_search_ads360_link( + parent="parent_value", + search_ads_360_link=resources.SearchAds360Link(name="name_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].search_ads_360_link + mock_val = resources.SearchAds360Link(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_get_data_stream_flattened_error_async(): +async def test_create_search_ads360_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -22176,20 +22180,21 @@ async def test_get_data_stream_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_data_stream( - analytics_admin.GetDataStreamRequest(), - name="name_value", + await client.create_search_ads360_link( + analytics_admin.CreateSearchAds360LinkRequest(), + parent="parent_value", + search_ads_360_link=resources.SearchAds360Link(name="name_value"), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAudienceRequest, + analytics_admin.DeleteSearchAds360LinkRequest, dict, ], ) -def test_get_audience(request_type, transport: str = "grpc"): +def test_delete_search_ads360_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -22200,37 +22205,23 @@ def test_get_audience(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.delete_search_ads360_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = audience.Audience( - name="name_value", - display_name="display_name_value", - description="description_value", - membership_duration_days=2561, - ads_personalization_enabled=True, - exclusion_duration_mode=audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, - ) - response = client.get_audience(request) + call.return_value = None + response = client.delete_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAudienceRequest() + assert args[0] == analytics_admin.DeleteSearchAds360LinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, audience.Audience) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.membership_duration_days == 2561 - assert response.ads_personalization_enabled is True - assert ( - response.exclusion_duration_mode - == audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY - ) + assert response is None -def test_get_audience_empty_call(): +def test_delete_search_ads360_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -22239,16 +22230,19 @@ def test_get_audience_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_audience), "__call__") as call: - client.get_audience() + with mock.patch.object( + type(client.transport.delete_search_ads360_link), "__call__" + ) as call: + client.delete_search_ads360_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAudienceRequest() + assert args[0] == analytics_admin.DeleteSearchAds360LinkRequest() @pytest.mark.asyncio -async def test_get_audience_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetAudienceRequest +async def test_delete_search_ads360_link_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.DeleteSearchAds360LinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22260,58 +22254,44 @@ async def test_get_audience_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.delete_search_ads360_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - audience.Audience( - name="name_value", - display_name="display_name_value", - description="description_value", - membership_duration_days=2561, - ads_personalization_enabled=True, - exclusion_duration_mode=audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, - ) - ) - response = await client.get_audience(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAudienceRequest() + assert args[0] == analytics_admin.DeleteSearchAds360LinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, audience.Audience) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.membership_duration_days == 2561 - assert response.ads_personalization_enabled is True - assert ( - response.exclusion_duration_mode - == audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY - ) + assert response is None @pytest.mark.asyncio -async def test_get_audience_async_from_dict(): - await test_get_audience_async(request_type=dict) +async def test_delete_search_ads360_link_async_from_dict(): + await test_delete_search_ads360_link_async(request_type=dict) -def test_get_audience_field_headers(): +def test_delete_search_ads360_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetAudienceRequest() + request = analytics_admin.DeleteSearchAds360LinkRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_audience), "__call__") as call: - call.return_value = audience.Audience() - client.get_audience(request) + with mock.patch.object( + type(client.transport.delete_search_ads360_link), "__call__" + ) as call: + call.return_value = None + client.delete_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -22327,21 +22307,23 @@ def test_get_audience_field_headers(): @pytest.mark.asyncio -async def test_get_audience_field_headers_async(): +async def test_delete_search_ads360_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetAudienceRequest() + request = analytics_admin.DeleteSearchAds360LinkRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_audience), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(audience.Audience()) - await client.get_audience(request) + with mock.patch.object( + type(client.transport.delete_search_ads360_link), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -22356,18 +22338,20 @@ async def test_get_audience_field_headers_async(): ) in kw["metadata"] -def test_get_audience_flattened(): +def test_delete_search_ads360_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.delete_search_ads360_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = audience.Audience() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_audience( + client.delete_search_ads360_link( name="name_value", ) @@ -22380,7 +22364,7 @@ def test_get_audience_flattened(): assert arg == mock_val -def test_get_audience_flattened_error(): +def test_delete_search_ads360_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -22388,27 +22372,29 @@ def test_get_audience_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_audience( - analytics_admin.GetAudienceRequest(), + client.delete_search_ads360_link( + analytics_admin.DeleteSearchAds360LinkRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_get_audience_flattened_async(): +async def test_delete_search_ads360_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.get_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.delete_search_ads360_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = audience.Audience() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(audience.Audience()) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_audience( + response = await client.delete_search_ads360_link( name="name_value", ) @@ -22422,7 +22408,7 @@ async def test_get_audience_flattened_async(): @pytest.mark.asyncio -async def test_get_audience_flattened_error_async(): +async def test_delete_search_ads360_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -22430,8 +22416,8 @@ async def test_get_audience_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_audience( - analytics_admin.GetAudienceRequest(), + await client.delete_search_ads360_link( + analytics_admin.DeleteSearchAds360LinkRequest(), name="name_value", ) @@ -22439,11 +22425,11 @@ async def test_get_audience_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAudiencesRequest, + analytics_admin.UpdateSearchAds360LinkRequest, dict, ], ) -def test_list_audiences(request_type, transport: str = "grpc"): +def test_update_search_ads360_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -22454,24 +22440,30 @@ def test_list_audiences(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: + with mock.patch.object( + type(client.transport.update_search_ads360_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListAudiencesResponse( - next_page_token="next_page_token_value", + call.return_value = resources.SearchAds360Link( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) - response = client.list_audiences(request) + response = client.update_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAudiencesRequest() + assert args[0] == analytics_admin.UpdateSearchAds360LinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAudiencesPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.SearchAds360Link) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_list_audiences_empty_call(): +def test_update_search_ads360_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -22480,16 +22472,19 @@ def test_list_audiences_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: - client.list_audiences() + with mock.patch.object( + type(client.transport.update_search_ads360_link), "__call__" + ) as call: + client.update_search_ads360_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAudiencesRequest() + assert args[0] == analytics_admin.UpdateSearchAds360LinkRequest() @pytest.mark.asyncio -async def test_list_audiences_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ListAudiencesRequest +async def test_update_search_ads360_link_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.UpdateSearchAds360LinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -22501,45 +22496,53 @@ async def test_list_audiences_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: + with mock.patch.object( + type(client.transport.update_search_ads360_link), "__call__" + ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListAudiencesResponse( - next_page_token="next_page_token_value", + resources.SearchAds360Link( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) ) - response = await client.list_audiences(request) + response = await client.update_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAudiencesRequest() + assert args[0] == analytics_admin.UpdateSearchAds360LinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAudiencesAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.SearchAds360Link) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" @pytest.mark.asyncio -async def test_list_audiences_async_from_dict(): - await test_list_audiences_async(request_type=dict) +async def test_update_search_ads360_link_async_from_dict(): + await test_update_search_ads360_link_async(request_type=dict) -def test_list_audiences_field_headers(): +def test_update_search_ads360_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListAudiencesRequest() + request = analytics_admin.UpdateSearchAds360LinkRequest() - request.parent = "parent_value" + request.search_ads_360_link.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: - call.return_value = analytics_admin.ListAudiencesResponse() - client.list_audiences(request) + with mock.patch.object( + type(client.transport.update_search_ads360_link), "__call__" + ) as call: + call.return_value = resources.SearchAds360Link() + client.update_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -22550,28 +22553,30 @@ def test_list_audiences_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "search_ads_360_link.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_audiences_field_headers_async(): +async def test_update_search_ads360_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListAudiencesRequest() + request = analytics_admin.UpdateSearchAds360LinkRequest() - request.parent = "parent_value" + request.search_ads_360_link.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: + with mock.patch.object( + type(client.transport.update_search_ads360_link), "__call__" + ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListAudiencesResponse() + resources.SearchAds360Link() ) - await client.list_audiences(request) + await client.update_search_ads360_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -22582,35 +22587,41 @@ async def test_list_audiences_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "search_ads_360_link.name=name_value", ) in kw["metadata"] -def test_list_audiences_flattened(): +def test_update_search_ads360_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: + with mock.patch.object( + type(client.transport.update_search_ads360_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListAudiencesResponse() + call.return_value = resources.SearchAds360Link() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_audiences( - parent="parent_value", + client.update_search_ads360_link( + search_ads_360_link=resources.SearchAds360Link(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].search_ads_360_link + mock_val = resources.SearchAds360Link(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_list_audiences_flattened_error(): +def test_update_search_ads360_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -22618,43 +22629,50 @@ def test_list_audiences_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_audiences( - analytics_admin.ListAudiencesRequest(), - parent="parent_value", + client.update_search_ads360_link( + analytics_admin.UpdateSearchAds360LinkRequest(), + search_ads_360_link=resources.SearchAds360Link(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_list_audiences_flattened_async(): +async def test_update_search_ads360_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: + with mock.patch.object( + type(client.transport.update_search_ads360_link), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListAudiencesResponse() + call.return_value = resources.SearchAds360Link() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListAudiencesResponse() + resources.SearchAds360Link() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_audiences( - parent="parent_value", + response = await client.update_search_ads360_link( + search_ads_360_link=resources.SearchAds360Link(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].search_ads_360_link + mock_val = resources.SearchAds360Link(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val @pytest.mark.asyncio -async def test_list_audiences_flattened_error_async(): +async def test_update_search_ads360_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -22662,332 +22680,166 @@ async def test_list_audiences_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_audiences( - analytics_admin.ListAudiencesRequest(), - parent="parent_value", + await client.update_search_ads360_link( + analytics_admin.UpdateSearchAds360LinkRequest(), + search_ads_360_link=resources.SearchAds360Link(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_list_audiences_pager(transport_name: str = "grpc"): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.GetAttributionSettingsRequest, + dict, + ], +) +def test_get_attribution_settings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - audience.Audience(), - audience.Audience(), - ], - next_page_token="abc", - ), - analytics_admin.ListAudiencesResponse( - audiences=[], - next_page_token="def", - ), - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - audience.Audience(), - ], - ), - RuntimeError, - ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_attribution_settings), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.AttributionSettings( + name="name_value", + acquisition_conversion_event_lookback_window=resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS, + other_conversion_event_lookback_window=resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS, + reporting_attribution_model=resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN, + ads_web_conversion_data_export_scope=resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET, ) - pager = client.list_audiences(request={}) + response = client.get_attribution_settings(request) - assert pager._metadata == metadata + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.GetAttributionSettingsRequest() - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, audience.Audience) for i in results) + # Establish that the response is the type that we expect. + assert isinstance(response, resources.AttributionSettings) + assert response.name == "name_value" + assert ( + response.acquisition_conversion_event_lookback_window + == resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS + ) + assert ( + response.other_conversion_event_lookback_window + == resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS + ) + assert ( + response.reporting_attribution_model + == resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN + ) + assert ( + response.ads_web_conversion_data_export_scope + == resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET + ) -def test_list_audiences_pages(transport_name: str = "grpc"): +def test_get_attribution_settings_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.list_audiences), "__call__") as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - audience.Audience(), - audience.Audience(), - ], - next_page_token="abc", - ), - analytics_admin.ListAudiencesResponse( - audiences=[], - next_page_token="def", - ), - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - audience.Audience(), - ], - ), - RuntimeError, - ) - pages = list(client.list_audiences(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token + with mock.patch.object( + type(client.transport.get_attribution_settings), "__call__" + ) as call: + client.get_attribution_settings() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.GetAttributionSettingsRequest() @pytest.mark.asyncio -async def test_list_audiences_async_pager(): +async def test_get_attribution_settings_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.GetAttributionSettingsRequest, +): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_audiences), "__call__", new_callable=mock.AsyncMock + type(client.transport.get_attribution_settings), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - audience.Audience(), - audience.Audience(), - ], - next_page_token="abc", - ), - analytics_admin.ListAudiencesResponse( - audiences=[], - next_page_token="def", - ), - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - audience.Audience(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_audiences( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, audience.Audience) for i in responses) - - -@pytest.mark.asyncio -async def test_list_audiences_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_audiences), "__call__", new_callable=mock.AsyncMock - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - audience.Audience(), - audience.Audience(), - ], - next_page_token="abc", - ), - analytics_admin.ListAudiencesResponse( - audiences=[], - next_page_token="def", - ), - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - audience.Audience(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_audiences(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.CreateAudienceRequest, - dict, - ], -) -def test_create_audience(request_type, transport: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_audience), "__call__") as call: - # Designate an appropriate return value for the call. - call.return_value = gaa_audience.Audience( - name="name_value", - display_name="display_name_value", - description="description_value", - membership_duration_days=2561, - ads_personalization_enabled=True, - exclusion_duration_mode=gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, - ) - response = client.create_audience(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateAudienceRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, gaa_audience.Audience) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.membership_duration_days == 2561 - assert response.ads_personalization_enabled is True - assert ( - response.exclusion_duration_mode - == gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY - ) - - -def test_create_audience_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_audience), "__call__") as call: - client.create_audience() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateAudienceRequest() - - -@pytest.mark.asyncio -async def test_create_audience_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.CreateAudienceRequest -): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_audience), "__call__") as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_audience.Audience( + resources.AttributionSettings( name="name_value", - display_name="display_name_value", - description="description_value", - membership_duration_days=2561, - ads_personalization_enabled=True, - exclusion_duration_mode=gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, + acquisition_conversion_event_lookback_window=resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS, + other_conversion_event_lookback_window=resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS, + reporting_attribution_model=resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN, + ads_web_conversion_data_export_scope=resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET, ) ) - response = await client.create_audience(request) + response = await client.get_attribution_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateAudienceRequest() + assert args[0] == analytics_admin.GetAttributionSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, gaa_audience.Audience) + assert isinstance(response, resources.AttributionSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.membership_duration_days == 2561 - assert response.ads_personalization_enabled is True assert ( - response.exclusion_duration_mode - == gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY + response.acquisition_conversion_event_lookback_window + == resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS + ) + assert ( + response.other_conversion_event_lookback_window + == resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS + ) + assert ( + response.reporting_attribution_model + == resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN + ) + assert ( + response.ads_web_conversion_data_export_scope + == resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET ) @pytest.mark.asyncio -async def test_create_audience_async_from_dict(): - await test_create_audience_async(request_type=dict) +async def test_get_attribution_settings_async_from_dict(): + await test_get_attribution_settings_async(request_type=dict) -def test_create_audience_field_headers(): +def test_get_attribution_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateAudienceRequest() + request = analytics_admin.GetAttributionSettingsRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_audience), "__call__") as call: - call.return_value = gaa_audience.Audience() - client.create_audience(request) + with mock.patch.object( + type(client.transport.get_attribution_settings), "__call__" + ) as call: + call.return_value = resources.AttributionSettings() + client.get_attribution_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -22998,28 +22850,30 @@ def test_create_audience_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_create_audience_field_headers_async(): +async def test_get_attribution_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateAudienceRequest() + request = analytics_admin.GetAttributionSettingsRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.get_attribution_settings), "__call__" + ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_audience.Audience() + resources.AttributionSettings() ) - await client.create_audience(request) + await client.get_attribution_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -23030,39 +22884,37 @@ async def test_create_audience_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_create_audience_flattened(): +def test_get_attribution_settings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.get_attribution_settings), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_audience.Audience() + call.return_value = resources.AttributionSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_audience( - parent="parent_value", - audience=gaa_audience.Audience(name="name_value"), + client.get_attribution_settings( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].audience - mock_val = gaa_audience.Audience(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_create_audience_flattened_error(): +def test_get_attribution_settings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -23070,48 +22922,45 @@ def test_create_audience_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_audience( - analytics_admin.CreateAudienceRequest(), - parent="parent_value", - audience=gaa_audience.Audience(name="name_value"), + client.get_attribution_settings( + analytics_admin.GetAttributionSettingsRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_create_audience_flattened_async(): +async def test_get_attribution_settings_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.create_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.get_attribution_settings), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_audience.Audience() + call.return_value = resources.AttributionSettings() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_audience.Audience() + resources.AttributionSettings() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_audience( - parent="parent_value", - audience=gaa_audience.Audience(name="name_value"), + response = await client.get_attribution_settings( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].audience - mock_val = gaa_audience.Audience(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_create_audience_flattened_error_async(): +async def test_get_attribution_settings_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -23119,21 +22968,20 @@ async def test_create_audience_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_audience( - analytics_admin.CreateAudienceRequest(), - parent="parent_value", - audience=gaa_audience.Audience(name="name_value"), + await client.get_attribution_settings( + analytics_admin.GetAttributionSettingsRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateAudienceRequest, + analytics_admin.UpdateAttributionSettingsRequest, dict, ], ) -def test_update_audience(request_type, transport: str = "grpc"): +def test_update_attribution_settings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -23144,37 +22992,46 @@ def test_update_audience(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.update_attribution_settings), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_audience.Audience( + call.return_value = resources.AttributionSettings( name="name_value", - display_name="display_name_value", - description="description_value", - membership_duration_days=2561, - ads_personalization_enabled=True, - exclusion_duration_mode=gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, + acquisition_conversion_event_lookback_window=resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS, + other_conversion_event_lookback_window=resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS, + reporting_attribution_model=resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN, + ads_web_conversion_data_export_scope=resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET, ) - response = client.update_audience(request) + response = client.update_attribution_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAudienceRequest() + assert args[0] == analytics_admin.UpdateAttributionSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, gaa_audience.Audience) + assert isinstance(response, resources.AttributionSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.membership_duration_days == 2561 - assert response.ads_personalization_enabled is True assert ( - response.exclusion_duration_mode - == gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY + response.acquisition_conversion_event_lookback_window + == resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS + ) + assert ( + response.other_conversion_event_lookback_window + == resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS + ) + assert ( + response.reporting_attribution_model + == resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN + ) + assert ( + response.ads_web_conversion_data_export_scope + == resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET ) -def test_update_audience_empty_call(): +def test_update_attribution_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -23183,16 +23040,19 @@ def test_update_audience_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_audience), "__call__") as call: - client.update_audience() + with mock.patch.object( + type(client.transport.update_attribution_settings), "__call__" + ) as call: + client.update_attribution_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAudienceRequest() + assert args[0] == analytics_admin.UpdateAttributionSettingsRequest() @pytest.mark.asyncio -async def test_update_audience_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.UpdateAudienceRequest +async def test_update_attribution_settings_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.UpdateAttributionSettingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23204,58 +23064,69 @@ async def test_update_audience_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.update_attribution_settings), "__call__" + ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_audience.Audience( + resources.AttributionSettings( name="name_value", - display_name="display_name_value", - description="description_value", - membership_duration_days=2561, - ads_personalization_enabled=True, - exclusion_duration_mode=gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, + acquisition_conversion_event_lookback_window=resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS, + other_conversion_event_lookback_window=resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS, + reporting_attribution_model=resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN, + ads_web_conversion_data_export_scope=resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET, ) ) - response = await client.update_audience(request) + response = await client.update_attribution_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAudienceRequest() + assert args[0] == analytics_admin.UpdateAttributionSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, gaa_audience.Audience) + assert isinstance(response, resources.AttributionSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.membership_duration_days == 2561 - assert response.ads_personalization_enabled is True assert ( - response.exclusion_duration_mode - == gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY + response.acquisition_conversion_event_lookback_window + == resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS + ) + assert ( + response.other_conversion_event_lookback_window + == resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS + ) + assert ( + response.reporting_attribution_model + == resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN + ) + assert ( + response.ads_web_conversion_data_export_scope + == resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET ) @pytest.mark.asyncio -async def test_update_audience_async_from_dict(): - await test_update_audience_async(request_type=dict) +async def test_update_attribution_settings_async_from_dict(): + await test_update_attribution_settings_async(request_type=dict) -def test_update_audience_field_headers(): +def test_update_attribution_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateAudienceRequest() + request = analytics_admin.UpdateAttributionSettingsRequest() - request.audience.name = "name_value" + request.attribution_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_audience), "__call__") as call: - call.return_value = gaa_audience.Audience() - client.update_audience(request) + with mock.patch.object( + type(client.transport.update_attribution_settings), "__call__" + ) as call: + call.return_value = resources.AttributionSettings() + client.update_attribution_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -23266,28 +23137,30 @@ def test_update_audience_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "audience.name=name_value", + "attribution_settings.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_audience_field_headers_async(): +async def test_update_attribution_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateAudienceRequest() + request = analytics_admin.UpdateAttributionSettingsRequest() - request.audience.name = "name_value" + request.attribution_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.update_attribution_settings), "__call__" + ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_audience.Audience() + resources.AttributionSettings() ) - await client.update_audience(request) + await client.update_attribution_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -23298,23 +23171,25 @@ async def test_update_audience_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "audience.name=name_value", + "attribution_settings.name=name_value", ) in kw["metadata"] -def test_update_audience_flattened(): +def test_update_attribution_settings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.update_attribution_settings), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_audience.Audience() + call.return_value = resources.AttributionSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_audience( - audience=gaa_audience.Audience(name="name_value"), + client.update_attribution_settings( + attribution_settings=resources.AttributionSettings(name="name_value"), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -23322,15 +23197,15 @@ def test_update_audience_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].audience - mock_val = gaa_audience.Audience(name="name_value") + arg = args[0].attribution_settings + mock_val = resources.AttributionSettings(name="name_value") assert arg == mock_val arg = args[0].update_mask mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_update_audience_flattened_error(): +def test_update_attribution_settings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -23338,31 +23213,33 @@ def test_update_audience_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_audience( - analytics_admin.UpdateAudienceRequest(), - audience=gaa_audience.Audience(name="name_value"), + client.update_attribution_settings( + analytics_admin.UpdateAttributionSettingsRequest(), + attribution_settings=resources.AttributionSettings(name="name_value"), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_update_audience_flattened_async(): +async def test_update_attribution_settings_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.update_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.update_attribution_settings), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_audience.Audience() + call.return_value = resources.AttributionSettings() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_audience.Audience() + resources.AttributionSettings() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_audience( - audience=gaa_audience.Audience(name="name_value"), + response = await client.update_attribution_settings( + attribution_settings=resources.AttributionSettings(name="name_value"), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -23370,8 +23247,8 @@ async def test_update_audience_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].audience - mock_val = gaa_audience.Audience(name="name_value") + arg = args[0].attribution_settings + mock_val = resources.AttributionSettings(name="name_value") assert arg == mock_val arg = args[0].update_mask mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) @@ -23379,7 +23256,7 @@ async def test_update_audience_flattened_async(): @pytest.mark.asyncio -async def test_update_audience_flattened_error_async(): +async def test_update_attribution_settings_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -23387,9 +23264,9 @@ async def test_update_audience_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_audience( - analytics_admin.UpdateAudienceRequest(), - audience=gaa_audience.Audience(name="name_value"), + await client.update_attribution_settings( + analytics_admin.UpdateAttributionSettingsRequest(), + attribution_settings=resources.AttributionSettings(name="name_value"), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -23397,11 +23274,11 @@ async def test_update_audience_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ArchiveAudienceRequest, + analytics_admin.RunAccessReportRequest, dict, ], ) -def test_archive_audience(request_type, transport: str = "grpc"): +def test_run_access_report(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -23412,21 +23289,26 @@ def test_archive_audience(request_type, transport: str = "grpc"): request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.archive_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.run_access_report), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.archive_audience(request) + call.return_value = analytics_admin.RunAccessReportResponse( + row_count=992, + ) + response = client.run_access_report(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveAudienceRequest() + assert args[0] == analytics_admin.RunAccessReportRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, analytics_admin.RunAccessReportResponse) + assert response.row_count == 992 -def test_archive_audience_empty_call(): +def test_run_access_report_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -23435,16 +23317,18 @@ def test_archive_audience_empty_call(): ) # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.archive_audience), "__call__") as call: - client.archive_audience() + with mock.patch.object( + type(client.transport.run_access_report), "__call__" + ) as call: + client.run_access_report() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveAudienceRequest() + assert args[0] == analytics_admin.RunAccessReportRequest() @pytest.mark.asyncio -async def test_archive_audience_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.ArchiveAudienceRequest +async def test_run_access_report_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.RunAccessReportRequest ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23456,40 +23340,49 @@ async def test_archive_audience_async( request = request_type() # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.archive_audience), "__call__") as call: + with mock.patch.object( + type(client.transport.run_access_report), "__call__" + ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.archive_audience(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.RunAccessReportResponse( + row_count=992, + ) + ) + response = await client.run_access_report(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveAudienceRequest() + assert args[0] == analytics_admin.RunAccessReportRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, analytics_admin.RunAccessReportResponse) + assert response.row_count == 992 @pytest.mark.asyncio -async def test_archive_audience_async_from_dict(): - await test_archive_audience_async(request_type=dict) +async def test_run_access_report_async_from_dict(): + await test_run_access_report_async(request_type=dict) -def test_archive_audience_field_headers(): +def test_run_access_report_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ArchiveAudienceRequest() + request = analytics_admin.RunAccessReportRequest() - request.name = "name_value" + request.entity = "entity_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.archive_audience), "__call__") as call: - call.return_value = None - client.archive_audience(request) + with mock.patch.object( + type(client.transport.run_access_report), "__call__" + ) as call: + call.return_value = analytics_admin.RunAccessReportResponse() + client.run_access_report(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -23500,26 +23393,30 @@ def test_archive_audience_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "entity=entity_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_archive_audience_field_headers_async(): +async def test_run_access_report_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ArchiveAudienceRequest() + request = analytics_admin.RunAccessReportRequest() - request.name = "name_value" + request.entity = "entity_value" # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object(type(client.transport.archive_audience), "__call__") as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.archive_audience(request) + with mock.patch.object( + type(client.transport.run_access_report), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.RunAccessReportResponse() + ) + await client.run_access_report(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -23530,18 +23427,18 @@ async def test_archive_audience_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "entity=entity_value", ) in kw["metadata"] @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetSearchAds360LinkRequest, + analytics_admin.CreateAccessBindingRequest, dict, ], ) -def test_get_search_ads360_link(request_type, transport: str = "grpc"): +def test_create_access_binding(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -23553,29 +23450,28 @@ def test_get_search_ads360_link(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_search_ads360_link), "__call__" + type(client.transport.create_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SearchAds360Link( + call.return_value = resources.AccessBinding( name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", + roles=["roles_value"], + user="user_value", ) - response = client.get_search_ads360_link(request) + response = client.create_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetSearchAds360LinkRequest() + assert args[0] == analytics_admin.CreateAccessBindingRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.SearchAds360Link) + assert isinstance(response, resources.AccessBinding) assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.roles == ["roles_value"] -def test_get_search_ads360_link_empty_call(): +def test_create_access_binding_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -23585,18 +23481,18 @@ def test_get_search_ads360_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_search_ads360_link), "__call__" + type(client.transport.create_access_binding), "__call__" ) as call: - client.get_search_ads360_link() + client.create_access_binding() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetSearchAds360LinkRequest() + assert args[0] == analytics_admin.CreateAccessBindingRequest() @pytest.mark.asyncio -async def test_get_search_ads360_link_async( +async def test_create_access_binding_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetSearchAds360LinkRequest, + request_type=analytics_admin.CreateAccessBindingRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23609,52 +23505,50 @@ async def test_get_search_ads360_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_search_ads360_link), "__call__" + type(client.transport.create_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SearchAds360Link( + resources.AccessBinding( name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", + roles=["roles_value"], ) ) - response = await client.get_search_ads360_link(request) + response = await client.create_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetSearchAds360LinkRequest() + assert args[0] == analytics_admin.CreateAccessBindingRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.SearchAds360Link) + assert isinstance(response, resources.AccessBinding) assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.roles == ["roles_value"] @pytest.mark.asyncio -async def test_get_search_ads360_link_async_from_dict(): - await test_get_search_ads360_link_async(request_type=dict) +async def test_create_access_binding_async_from_dict(): + await test_create_access_binding_async(request_type=dict) -def test_get_search_ads360_link_field_headers(): +def test_create_access_binding_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetSearchAds360LinkRequest() + request = analytics_admin.CreateAccessBindingRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_search_ads360_link), "__call__" + type(client.transport.create_access_binding), "__call__" ) as call: - call.return_value = resources.SearchAds360Link() - client.get_search_ads360_link(request) + call.return_value = resources.AccessBinding() + client.create_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -23665,30 +23559,30 @@ def test_get_search_ads360_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_search_ads360_link_field_headers_async(): +async def test_create_access_binding_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetSearchAds360LinkRequest() + request = analytics_admin.CreateAccessBindingRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_search_ads360_link), "__call__" + type(client.transport.create_access_binding), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SearchAds360Link() + resources.AccessBinding() ) - await client.get_search_ads360_link(request) + await client.create_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -23699,37 +23593,41 @@ async def test_get_search_ads360_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_search_ads360_link_flattened(): +def test_create_access_binding_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_search_ads360_link), "__call__" + type(client.transport.create_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SearchAds360Link() + call.return_value = resources.AccessBinding() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_search_ads360_link( - name="name_value", + client.create_access_binding( + parent="parent_value", + access_binding=resources.AccessBinding(user="user_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].access_binding + mock_val = resources.AccessBinding(user="user_value") assert arg == mock_val -def test_get_search_ads360_link_flattened_error(): +def test_create_access_binding_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -23737,45 +23635,50 @@ def test_get_search_ads360_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_search_ads360_link( - analytics_admin.GetSearchAds360LinkRequest(), - name="name_value", + client.create_access_binding( + analytics_admin.CreateAccessBindingRequest(), + parent="parent_value", + access_binding=resources.AccessBinding(user="user_value"), ) @pytest.mark.asyncio -async def test_get_search_ads360_link_flattened_async(): +async def test_create_access_binding_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_search_ads360_link), "__call__" + type(client.transport.create_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SearchAds360Link() + call.return_value = resources.AccessBinding() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SearchAds360Link() + resources.AccessBinding() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_search_ads360_link( - name="name_value", + response = await client.create_access_binding( + parent="parent_value", + access_binding=resources.AccessBinding(user="user_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].access_binding + mock_val = resources.AccessBinding(user="user_value") assert arg == mock_val @pytest.mark.asyncio -async def test_get_search_ads360_link_flattened_error_async(): +async def test_create_access_binding_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -23783,20 +23686,21 @@ async def test_get_search_ads360_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_search_ads360_link( - analytics_admin.GetSearchAds360LinkRequest(), - name="name_value", + await client.create_access_binding( + analytics_admin.CreateAccessBindingRequest(), + parent="parent_value", + access_binding=resources.AccessBinding(user="user_value"), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListSearchAds360LinksRequest, + analytics_admin.GetAccessBindingRequest, dict, ], ) -def test_list_search_ads360_links(request_type, transport: str = "grpc"): +def test_get_access_binding(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -23808,25 +23712,28 @@ def test_list_search_ads360_links(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_search_ads360_links), "__call__" + type(client.transport.get_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListSearchAds360LinksResponse( - next_page_token="next_page_token_value", + call.return_value = resources.AccessBinding( + name="name_value", + roles=["roles_value"], + user="user_value", ) - response = client.list_search_ads360_links(request) + response = client.get_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListSearchAds360LinksRequest() + assert args[0] == analytics_admin.GetAccessBindingRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListSearchAds360LinksPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.AccessBinding) + assert response.name == "name_value" + assert response.roles == ["roles_value"] -def test_list_search_ads360_links_empty_call(): +def test_get_access_binding_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -23836,18 +23743,18 @@ def test_list_search_ads360_links_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_search_ads360_links), "__call__" + type(client.transport.get_access_binding), "__call__" ) as call: - client.list_search_ads360_links() + client.get_access_binding() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListSearchAds360LinksRequest() + assert args[0] == analytics_admin.GetAccessBindingRequest() @pytest.mark.asyncio -async def test_list_search_ads360_links_async( +async def test_get_access_binding_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListSearchAds360LinksRequest, + request_type=analytics_admin.GetAccessBindingRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -23860,48 +23767,50 @@ async def test_list_search_ads360_links_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_search_ads360_links), "__call__" + type(client.transport.get_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListSearchAds360LinksResponse( - next_page_token="next_page_token_value", + resources.AccessBinding( + name="name_value", + roles=["roles_value"], ) ) - response = await client.list_search_ads360_links(request) + response = await client.get_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListSearchAds360LinksRequest() + assert args[0] == analytics_admin.GetAccessBindingRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListSearchAds360LinksAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.AccessBinding) + assert response.name == "name_value" + assert response.roles == ["roles_value"] @pytest.mark.asyncio -async def test_list_search_ads360_links_async_from_dict(): - await test_list_search_ads360_links_async(request_type=dict) +async def test_get_access_binding_async_from_dict(): + await test_get_access_binding_async(request_type=dict) -def test_list_search_ads360_links_field_headers(): +def test_get_access_binding_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListSearchAds360LinksRequest() + request = analytics_admin.GetAccessBindingRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_search_ads360_links), "__call__" + type(client.transport.get_access_binding), "__call__" ) as call: - call.return_value = analytics_admin.ListSearchAds360LinksResponse() - client.list_search_ads360_links(request) + call.return_value = resources.AccessBinding() + client.get_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -23912,30 +23821,30 @@ def test_list_search_ads360_links_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_search_ads360_links_field_headers_async(): +async def test_get_access_binding_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListSearchAds360LinksRequest() + request = analytics_admin.GetAccessBindingRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_search_ads360_links), "__call__" + type(client.transport.get_access_binding), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListSearchAds360LinksResponse() + resources.AccessBinding() ) - await client.list_search_ads360_links(request) + await client.get_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -23946,37 +23855,37 @@ async def test_list_search_ads360_links_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_list_search_ads360_links_flattened(): +def test_get_access_binding_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_search_ads360_links), "__call__" + type(client.transport.get_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListSearchAds360LinksResponse() + call.return_value = resources.AccessBinding() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_search_ads360_links( - parent="parent_value", + client.get_access_binding( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_list_search_ads360_links_flattened_error(): +def test_get_access_binding_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -23984,45 +23893,45 @@ def test_list_search_ads360_links_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_search_ads360_links( - analytics_admin.ListSearchAds360LinksRequest(), - parent="parent_value", + client.get_access_binding( + analytics_admin.GetAccessBindingRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_list_search_ads360_links_flattened_async(): +async def test_get_access_binding_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_search_ads360_links), "__call__" + type(client.transport.get_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListSearchAds360LinksResponse() + call.return_value = resources.AccessBinding() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListSearchAds360LinksResponse() + resources.AccessBinding() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_search_ads360_links( - parent="parent_value", + response = await client.get_access_binding( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_list_search_ads360_links_flattened_error_async(): +async def test_get_access_binding_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -24030,331 +23939,130 @@ async def test_list_search_ads360_links_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_search_ads360_links( - analytics_admin.ListSearchAds360LinksRequest(), - parent="parent_value", + await client.get_access_binding( + analytics_admin.GetAccessBindingRequest(), + name="name_value", ) -def test_list_search_ads360_links_pager(transport_name: str = "grpc"): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateAccessBindingRequest, + dict, + ], +) +def test_update_access_binding(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_search_ads360_links), "__call__" + type(client.transport.update_access_binding), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - resources.SearchAds360Link(), - resources.SearchAds360Link(), - ], - next_page_token="abc", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[], - next_page_token="def", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - ], - next_page_token="ghi", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - resources.SearchAds360Link(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + # Designate an appropriate return value for the call. + call.return_value = resources.AccessBinding( + name="name_value", + roles=["roles_value"], + user="user_value", ) - pager = client.list_search_ads360_links(request={}) + response = client.update_access_binding(request) - assert pager._metadata == metadata + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.UpdateAccessBindingRequest() - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.SearchAds360Link) for i in results) + # Establish that the response is the type that we expect. + assert isinstance(response, resources.AccessBinding) + assert response.name == "name_value" + assert response.roles == ["roles_value"] -def test_list_search_ads360_links_pages(transport_name: str = "grpc"): +def test_update_access_binding_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_search_ads360_links), "__call__" + type(client.transport.update_access_binding), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - resources.SearchAds360Link(), - resources.SearchAds360Link(), - ], - next_page_token="abc", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[], - next_page_token="def", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - ], - next_page_token="ghi", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - resources.SearchAds360Link(), - ], - ), - RuntimeError, - ) - pages = list(client.list_search_ads360_links(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token + client.update_access_binding() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.UpdateAccessBindingRequest() @pytest.mark.asyncio -async def test_list_search_ads360_links_async_pager(): +async def test_update_access_binding_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.UpdateAccessBindingRequest, +): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_search_ads360_links), - "__call__", - new_callable=mock.AsyncMock, + type(client.transport.update_access_binding), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - resources.SearchAds360Link(), - resources.SearchAds360Link(), - ], - next_page_token="abc", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[], - next_page_token="def", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - ], - next_page_token="ghi", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - resources.SearchAds360Link(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_search_ads360_links( - request={}, + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.AccessBinding( + name="name_value", + roles=["roles_value"], + ) ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) + response = await client.update_access_binding(request) - assert len(responses) == 6 - assert all(isinstance(i, resources.SearchAds360Link) for i in responses) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.UpdateAccessBindingRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.AccessBinding) + assert response.name == "name_value" + assert response.roles == ["roles_value"] @pytest.mark.asyncio -async def test_list_search_ads360_links_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, +async def test_update_access_binding_async_from_dict(): + await test_update_access_binding_async(request_type=dict) + + +def test_update_access_binding_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), ) + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.UpdateAccessBindingRequest() + + request.access_binding.name = "name_value" + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_search_ads360_links), - "__call__", - new_callable=mock.AsyncMock, + type(client.transport.update_access_binding), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - resources.SearchAds360Link(), - resources.SearchAds360Link(), - ], - next_page_token="abc", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[], - next_page_token="def", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - ], - next_page_token="ghi", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - resources.SearchAds360Link(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_search_ads360_links(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.CreateSearchAds360LinkRequest, - dict, - ], -) -def test_create_search_ads360_link(request_type, transport: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_search_ads360_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.SearchAds360Link( - name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - ) - response = client.create_search_ads360_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateSearchAds360LinkRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, resources.SearchAds360Link) - assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" - - -def test_create_search_ads360_link_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_search_ads360_link), "__call__" - ) as call: - client.create_search_ads360_link() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateSearchAds360LinkRequest() - - -@pytest.mark.asyncio -async def test_create_search_ads360_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateSearchAds360LinkRequest, -): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_search_ads360_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SearchAds360Link( - name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - ) - ) - response = await client.create_search_ads360_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateSearchAds360LinkRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, resources.SearchAds360Link) - assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" - - -@pytest.mark.asyncio -async def test_create_search_ads360_link_async_from_dict(): - await test_create_search_ads360_link_async(request_type=dict) - - -def test_create_search_ads360_link_field_headers(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.CreateSearchAds360LinkRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.create_search_ads360_link), "__call__" - ) as call: - call.return_value = resources.SearchAds360Link() - client.create_search_ads360_link(request) + call.return_value = resources.AccessBinding() + client.update_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -24365,30 +24073,30 @@ def test_create_search_ads360_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "access_binding.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_create_search_ads360_link_field_headers_async(): +async def test_update_access_binding_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateSearchAds360LinkRequest() + request = analytics_admin.UpdateAccessBindingRequest() - request.parent = "parent_value" + request.access_binding.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_search_ads360_link), "__call__" + type(client.transport.update_access_binding), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SearchAds360Link() + resources.AccessBinding() ) - await client.create_search_ads360_link(request) + await client.update_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -24399,41 +24107,37 @@ async def test_create_search_ads360_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "access_binding.name=name_value", ) in kw["metadata"] -def test_create_search_ads360_link_flattened(): +def test_update_access_binding_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_search_ads360_link), "__call__" + type(client.transport.update_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SearchAds360Link() + call.return_value = resources.AccessBinding() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_search_ads360_link( - parent="parent_value", - search_ads_360_link=resources.SearchAds360Link(name="name_value"), + client.update_access_binding( + access_binding=resources.AccessBinding(user="user_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].search_ads_360_link - mock_val = resources.SearchAds360Link(name="name_value") + arg = args[0].access_binding + mock_val = resources.AccessBinding(user="user_value") assert arg == mock_val -def test_create_search_ads360_link_flattened_error(): +def test_update_access_binding_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -24441,50 +24145,45 @@ def test_create_search_ads360_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_search_ads360_link( - analytics_admin.CreateSearchAds360LinkRequest(), - parent="parent_value", - search_ads_360_link=resources.SearchAds360Link(name="name_value"), + client.update_access_binding( + analytics_admin.UpdateAccessBindingRequest(), + access_binding=resources.AccessBinding(user="user_value"), ) @pytest.mark.asyncio -async def test_create_search_ads360_link_flattened_async(): +async def test_update_access_binding_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_search_ads360_link), "__call__" + type(client.transport.update_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SearchAds360Link() + call.return_value = resources.AccessBinding() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SearchAds360Link() + resources.AccessBinding() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_search_ads360_link( - parent="parent_value", - search_ads_360_link=resources.SearchAds360Link(name="name_value"), + response = await client.update_access_binding( + access_binding=resources.AccessBinding(user="user_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].search_ads_360_link - mock_val = resources.SearchAds360Link(name="name_value") + arg = args[0].access_binding + mock_val = resources.AccessBinding(user="user_value") assert arg == mock_val @pytest.mark.asyncio -async def test_create_search_ads360_link_flattened_error_async(): +async def test_update_access_binding_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -24492,21 +24191,20 @@ async def test_create_search_ads360_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_search_ads360_link( - analytics_admin.CreateSearchAds360LinkRequest(), - parent="parent_value", - search_ads_360_link=resources.SearchAds360Link(name="name_value"), + await client.update_access_binding( + analytics_admin.UpdateAccessBindingRequest(), + access_binding=resources.AccessBinding(user="user_value"), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteSearchAds360LinkRequest, + analytics_admin.DeleteAccessBindingRequest, dict, ], ) -def test_delete_search_ads360_link(request_type, transport: str = "grpc"): +def test_delete_access_binding(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -24518,22 +24216,22 @@ def test_delete_search_ads360_link(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_search_ads360_link), "__call__" + type(client.transport.delete_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = None - response = client.delete_search_ads360_link(request) + response = client.delete_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteSearchAds360LinkRequest() + assert args[0] == analytics_admin.DeleteAccessBindingRequest() # Establish that the response is the type that we expect. assert response is None -def test_delete_search_ads360_link_empty_call(): +def test_delete_access_binding_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -24543,18 +24241,18 @@ def test_delete_search_ads360_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_search_ads360_link), "__call__" + type(client.transport.delete_access_binding), "__call__" ) as call: - client.delete_search_ads360_link() + client.delete_access_binding() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteSearchAds360LinkRequest() + assert args[0] == analytics_admin.DeleteAccessBindingRequest() @pytest.mark.asyncio -async def test_delete_search_ads360_link_async( +async def test_delete_access_binding_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteSearchAds360LinkRequest, + request_type=analytics_admin.DeleteAccessBindingRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24567,43 +24265,43 @@ async def test_delete_search_ads360_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_search_ads360_link), "__call__" + type(client.transport.delete_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_search_ads360_link(request) + response = await client.delete_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteSearchAds360LinkRequest() + assert args[0] == analytics_admin.DeleteAccessBindingRequest() # Establish that the response is the type that we expect. assert response is None @pytest.mark.asyncio -async def test_delete_search_ads360_link_async_from_dict(): - await test_delete_search_ads360_link_async(request_type=dict) +async def test_delete_access_binding_async_from_dict(): + await test_delete_access_binding_async(request_type=dict) -def test_delete_search_ads360_link_field_headers(): +def test_delete_access_binding_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteSearchAds360LinkRequest() + request = analytics_admin.DeleteAccessBindingRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_search_ads360_link), "__call__" + type(client.transport.delete_access_binding), "__call__" ) as call: call.return_value = None - client.delete_search_ads360_link(request) + client.delete_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -24619,23 +24317,23 @@ def test_delete_search_ads360_link_field_headers(): @pytest.mark.asyncio -async def test_delete_search_ads360_link_field_headers_async(): +async def test_delete_access_binding_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteSearchAds360LinkRequest() + request = analytics_admin.DeleteAccessBindingRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_search_ads360_link), "__call__" + type(client.transport.delete_access_binding), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_search_ads360_link(request) + await client.delete_access_binding(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -24650,20 +24348,20 @@ async def test_delete_search_ads360_link_field_headers_async(): ) in kw["metadata"] -def test_delete_search_ads360_link_flattened(): +def test_delete_access_binding_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_search_ads360_link), "__call__" + type(client.transport.delete_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_search_ads360_link( + client.delete_access_binding( name="name_value", ) @@ -24676,7 +24374,7 @@ def test_delete_search_ads360_link_flattened(): assert arg == mock_val -def test_delete_search_ads360_link_flattened_error(): +def test_delete_access_binding_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -24684,21 +24382,21 @@ def test_delete_search_ads360_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_search_ads360_link( - analytics_admin.DeleteSearchAds360LinkRequest(), + client.delete_access_binding( + analytics_admin.DeleteAccessBindingRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_delete_search_ads360_link_flattened_async(): +async def test_delete_access_binding_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_search_ads360_link), "__call__" + type(client.transport.delete_access_binding), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = None @@ -24706,7 +24404,7 @@ async def test_delete_search_ads360_link_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_search_ads360_link( + response = await client.delete_access_binding( name="name_value", ) @@ -24720,7 +24418,7 @@ async def test_delete_search_ads360_link_flattened_async(): @pytest.mark.asyncio -async def test_delete_search_ads360_link_flattened_error_async(): +async def test_delete_access_binding_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -24728,8 +24426,8 @@ async def test_delete_search_ads360_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.delete_search_ads360_link( - analytics_admin.DeleteSearchAds360LinkRequest(), + await client.delete_access_binding( + analytics_admin.DeleteAccessBindingRequest(), name="name_value", ) @@ -24737,11 +24435,11 @@ async def test_delete_search_ads360_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateSearchAds360LinkRequest, + analytics_admin.ListAccessBindingsRequest, dict, ], ) -def test_update_search_ads360_link(request_type, transport: str = "grpc"): +def test_list_access_bindings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -24753,29 +24451,25 @@ def test_update_search_ads360_link(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_search_ads360_link), "__call__" + type(client.transport.list_access_bindings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SearchAds360Link( - name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", + call.return_value = analytics_admin.ListAccessBindingsResponse( + next_page_token="next_page_token_value", ) - response = client.update_search_ads360_link(request) + response = client.list_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateSearchAds360LinkRequest() + assert args[0] == analytics_admin.ListAccessBindingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.SearchAds360Link) - assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" + assert isinstance(response, pagers.ListAccessBindingsPager) + assert response.next_page_token == "next_page_token_value" -def test_update_search_ads360_link_empty_call(): +def test_list_access_bindings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -24785,18 +24479,18 @@ def test_update_search_ads360_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_search_ads360_link), "__call__" + type(client.transport.list_access_bindings), "__call__" ) as call: - client.update_search_ads360_link() + client.list_access_bindings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateSearchAds360LinkRequest() + assert args[0] == analytics_admin.ListAccessBindingsRequest() @pytest.mark.asyncio -async def test_update_search_ads360_link_async( +async def test_list_access_bindings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateSearchAds360LinkRequest, + request_type=analytics_admin.ListAccessBindingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -24809,52 +24503,48 @@ async def test_update_search_ads360_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_search_ads360_link), "__call__" + type(client.transport.list_access_bindings), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SearchAds360Link( - name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", + analytics_admin.ListAccessBindingsResponse( + next_page_token="next_page_token_value", ) ) - response = await client.update_search_ads360_link(request) + response = await client.list_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateSearchAds360LinkRequest() + assert args[0] == analytics_admin.ListAccessBindingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.SearchAds360Link) - assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" + assert isinstance(response, pagers.ListAccessBindingsAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_update_search_ads360_link_async_from_dict(): - await test_update_search_ads360_link_async(request_type=dict) +async def test_list_access_bindings_async_from_dict(): + await test_list_access_bindings_async(request_type=dict) -def test_update_search_ads360_link_field_headers(): +def test_list_access_bindings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateSearchAds360LinkRequest() + request = analytics_admin.ListAccessBindingsRequest() - request.search_ads_360_link.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_search_ads360_link), "__call__" + type(client.transport.list_access_bindings), "__call__" ) as call: - call.return_value = resources.SearchAds360Link() - client.update_search_ads360_link(request) + call.return_value = analytics_admin.ListAccessBindingsResponse() + client.list_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -24865,30 +24555,30 @@ def test_update_search_ads360_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "search_ads_360_link.name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_search_ads360_link_field_headers_async(): +async def test_list_access_bindings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateSearchAds360LinkRequest() + request = analytics_admin.ListAccessBindingsRequest() - request.search_ads_360_link.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_search_ads360_link), "__call__" + type(client.transport.list_access_bindings), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SearchAds360Link() + analytics_admin.ListAccessBindingsResponse() ) - await client.update_search_ads360_link(request) + await client.list_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -24899,41 +24589,37 @@ async def test_update_search_ads360_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "search_ads_360_link.name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_update_search_ads360_link_flattened(): +def test_list_access_bindings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_search_ads360_link), "__call__" + type(client.transport.list_access_bindings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SearchAds360Link() + call.return_value = analytics_admin.ListAccessBindingsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_search_ads360_link( - search_ads_360_link=resources.SearchAds360Link(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.list_access_bindings( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].search_ads_360_link - mock_val = resources.SearchAds360Link(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val -def test_update_search_ads360_link_flattened_error(): +def test_list_access_bindings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -24941,50 +24627,45 @@ def test_update_search_ads360_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_search_ads360_link( - analytics_admin.UpdateSearchAds360LinkRequest(), - search_ads_360_link=resources.SearchAds360Link(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.list_access_bindings( + analytics_admin.ListAccessBindingsRequest(), + parent="parent_value", ) @pytest.mark.asyncio -async def test_update_search_ads360_link_flattened_async(): +async def test_list_access_bindings_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_search_ads360_link), "__call__" + type(client.transport.list_access_bindings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.SearchAds360Link() + call.return_value = analytics_admin.ListAccessBindingsResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.SearchAds360Link() + analytics_admin.ListAccessBindingsResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_search_ads360_link( - search_ads_360_link=resources.SearchAds360Link(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + response = await client.list_access_bindings( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].search_ads_360_link - mock_val = resources.SearchAds360Link(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val @pytest.mark.asyncio -async def test_update_search_ads360_link_flattened_error_async(): +async def test_list_access_bindings_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -24992,71 +24673,245 @@ async def test_update_search_ads360_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_search_ads360_link( - analytics_admin.UpdateSearchAds360LinkRequest(), - search_ads_360_link=resources.SearchAds360Link(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + await client.list_access_bindings( + analytics_admin.ListAccessBindingsRequest(), + parent="parent_value", ) -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.GetAttributionSettingsRequest, - dict, - ], -) -def test_get_attribution_settings(request_type, transport: str = "grpc"): +def test_list_access_bindings_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_attribution_settings), "__call__" + type(client.transport.list_access_bindings), "__call__" ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.AttributionSettings( - name="name_value", - acquisition_conversion_event_lookback_window=resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS, - other_conversion_event_lookback_window=resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS, - reporting_attribution_model=resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN, - ads_web_conversion_data_export_scope=resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET, + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + resources.AccessBinding(), + resources.AccessBinding(), + ], + next_page_token="abc", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[], + next_page_token="def", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + resources.AccessBinding(), + ], + ), + RuntimeError, ) - response = client.get_attribution_settings(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAttributionSettingsRequest() + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_access_bindings(request={}) - # Establish that the response is the type that we expect. - assert isinstance(response, resources.AttributionSettings) - assert response.name == "name_value" - assert ( - response.acquisition_conversion_event_lookback_window - == resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS - ) - assert ( - response.other_conversion_event_lookback_window - == resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS - ) - assert ( - response.reporting_attribution_model - == resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN - ) - assert ( - response.ads_web_conversion_data_export_scope - == resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.AccessBinding) for i in results) + + +def test_list_access_bindings_pages(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_access_bindings), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + resources.AccessBinding(), + resources.AccessBinding(), + ], + next_page_token="abc", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[], + next_page_token="def", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + resources.AccessBinding(), + ], + ), + RuntimeError, + ) + pages = list(client.list_access_bindings(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + -def test_get_attribution_settings_empty_call(): +@pytest.mark.asyncio +async def test_list_access_bindings_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_access_bindings), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + resources.AccessBinding(), + resources.AccessBinding(), + ], + next_page_token="abc", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[], + next_page_token="def", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + resources.AccessBinding(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_access_bindings( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.AccessBinding) for i in responses) + + +@pytest.mark.asyncio +async def test_list_access_bindings_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_access_bindings), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + resources.AccessBinding(), + resources.AccessBinding(), + ], + next_page_token="abc", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[], + next_page_token="def", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + resources.AccessBinding(), + ], + ), + RuntimeError, + ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_access_bindings(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.BatchCreateAccessBindingsRequest, + dict, + ], +) +def test_batch_create_access_bindings(request_type, transport: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.batch_create_access_bindings), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.BatchCreateAccessBindingsResponse() + response = client.batch_create_access_bindings(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.BatchCreateAccessBindingsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, analytics_admin.BatchCreateAccessBindingsResponse) + + +def test_batch_create_access_bindings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -25066,18 +24921,18 @@ def test_get_attribution_settings_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_attribution_settings), "__call__" + type(client.transport.batch_create_access_bindings), "__call__" ) as call: - client.get_attribution_settings() + client.batch_create_access_bindings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAttributionSettingsRequest() + assert args[0] == analytics_admin.BatchCreateAccessBindingsRequest() @pytest.mark.asyncio -async def test_get_attribution_settings_async( +async def test_batch_create_access_bindings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetAttributionSettingsRequest, + request_type=analytics_admin.BatchCreateAccessBindingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25090,68 +24945,45 @@ async def test_get_attribution_settings_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_attribution_settings), "__call__" + type(client.transport.batch_create_access_bindings), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AttributionSettings( - name="name_value", - acquisition_conversion_event_lookback_window=resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS, - other_conversion_event_lookback_window=resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS, - reporting_attribution_model=resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN, - ads_web_conversion_data_export_scope=resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET, - ) + analytics_admin.BatchCreateAccessBindingsResponse() ) - response = await client.get_attribution_settings(request) + response = await client.batch_create_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAttributionSettingsRequest() + assert args[0] == analytics_admin.BatchCreateAccessBindingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.AttributionSettings) - assert response.name == "name_value" - assert ( - response.acquisition_conversion_event_lookback_window - == resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS - ) - assert ( - response.other_conversion_event_lookback_window - == resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS - ) - assert ( - response.reporting_attribution_model - == resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN - ) - assert ( - response.ads_web_conversion_data_export_scope - == resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET - ) + assert isinstance(response, analytics_admin.BatchCreateAccessBindingsResponse) @pytest.mark.asyncio -async def test_get_attribution_settings_async_from_dict(): - await test_get_attribution_settings_async(request_type=dict) +async def test_batch_create_access_bindings_async_from_dict(): + await test_batch_create_access_bindings_async(request_type=dict) -def test_get_attribution_settings_field_headers(): +def test_batch_create_access_bindings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetAttributionSettingsRequest() + request = analytics_admin.BatchCreateAccessBindingsRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_attribution_settings), "__call__" + type(client.transport.batch_create_access_bindings), "__call__" ) as call: - call.return_value = resources.AttributionSettings() - client.get_attribution_settings(request) + call.return_value = analytics_admin.BatchCreateAccessBindingsResponse() + client.batch_create_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -25162,30 +24994,30 @@ def test_get_attribution_settings_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_attribution_settings_field_headers_async(): +async def test_batch_create_access_bindings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetAttributionSettingsRequest() + request = analytics_admin.BatchCreateAccessBindingsRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_attribution_settings), "__call__" + type(client.transport.batch_create_access_bindings), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AttributionSettings() + analytics_admin.BatchCreateAccessBindingsResponse() ) - await client.get_attribution_settings(request) + await client.batch_create_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -25196,104 +25028,18 @@ async def test_get_attribution_settings_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_attribution_settings_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_attribution_settings), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.AttributionSettings() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_attribution_settings( - name="name_value", - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val - - -def test_get_attribution_settings_flattened_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_attribution_settings( - analytics_admin.GetAttributionSettingsRequest(), - name="name_value", - ) - - -@pytest.mark.asyncio -async def test_get_attribution_settings_flattened_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_attribution_settings), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.AttributionSettings() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AttributionSettings() - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_attribution_settings( - name="name_value", - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val - - -@pytest.mark.asyncio -async def test_get_attribution_settings_flattened_error_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_attribution_settings( - analytics_admin.GetAttributionSettingsRequest(), - name="name_value", - ) - - @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateAttributionSettingsRequest, + analytics_admin.BatchGetAccessBindingsRequest, dict, ], ) -def test_update_attribution_settings(request_type, transport: str = "grpc"): +def test_batch_get_access_bindings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -25305,45 +25051,22 @@ def test_update_attribution_settings(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_attribution_settings), "__call__" + type(client.transport.batch_get_access_bindings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AttributionSettings( - name="name_value", - acquisition_conversion_event_lookback_window=resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS, - other_conversion_event_lookback_window=resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS, - reporting_attribution_model=resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN, - ads_web_conversion_data_export_scope=resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET, - ) - response = client.update_attribution_settings(request) + call.return_value = analytics_admin.BatchGetAccessBindingsResponse() + response = client.batch_get_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAttributionSettingsRequest() + assert args[0] == analytics_admin.BatchGetAccessBindingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.AttributionSettings) - assert response.name == "name_value" - assert ( - response.acquisition_conversion_event_lookback_window - == resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS - ) - assert ( - response.other_conversion_event_lookback_window - == resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS - ) - assert ( - response.reporting_attribution_model - == resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN - ) - assert ( - response.ads_web_conversion_data_export_scope - == resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET - ) + assert isinstance(response, analytics_admin.BatchGetAccessBindingsResponse) -def test_update_attribution_settings_empty_call(): +def test_batch_get_access_bindings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -25353,18 +25076,18 @@ def test_update_attribution_settings_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_attribution_settings), "__call__" + type(client.transport.batch_get_access_bindings), "__call__" ) as call: - client.update_attribution_settings() + client.batch_get_access_bindings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAttributionSettingsRequest() + assert args[0] == analytics_admin.BatchGetAccessBindingsRequest() @pytest.mark.asyncio -async def test_update_attribution_settings_async( +async def test_batch_get_access_bindings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateAttributionSettingsRequest, + request_type=analytics_admin.BatchGetAccessBindingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25377,68 +25100,45 @@ async def test_update_attribution_settings_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_attribution_settings), "__call__" + type(client.transport.batch_get_access_bindings), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AttributionSettings( - name="name_value", - acquisition_conversion_event_lookback_window=resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS, - other_conversion_event_lookback_window=resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS, - reporting_attribution_model=resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN, - ads_web_conversion_data_export_scope=resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET, - ) + analytics_admin.BatchGetAccessBindingsResponse() ) - response = await client.update_attribution_settings(request) + response = await client.batch_get_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAttributionSettingsRequest() + assert args[0] == analytics_admin.BatchGetAccessBindingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.AttributionSettings) - assert response.name == "name_value" - assert ( - response.acquisition_conversion_event_lookback_window - == resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS - ) - assert ( - response.other_conversion_event_lookback_window - == resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS - ) - assert ( - response.reporting_attribution_model - == resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN - ) - assert ( - response.ads_web_conversion_data_export_scope - == resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET - ) + assert isinstance(response, analytics_admin.BatchGetAccessBindingsResponse) @pytest.mark.asyncio -async def test_update_attribution_settings_async_from_dict(): - await test_update_attribution_settings_async(request_type=dict) +async def test_batch_get_access_bindings_async_from_dict(): + await test_batch_get_access_bindings_async(request_type=dict) -def test_update_attribution_settings_field_headers(): +def test_batch_get_access_bindings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateAttributionSettingsRequest() + request = analytics_admin.BatchGetAccessBindingsRequest() - request.attribution_settings.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_attribution_settings), "__call__" + type(client.transport.batch_get_access_bindings), "__call__" ) as call: - call.return_value = resources.AttributionSettings() - client.update_attribution_settings(request) + call.return_value = analytics_admin.BatchGetAccessBindingsResponse() + client.batch_get_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -25449,30 +25149,30 @@ def test_update_attribution_settings_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "attribution_settings.name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_attribution_settings_field_headers_async(): +async def test_batch_get_access_bindings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateAttributionSettingsRequest() + request = analytics_admin.BatchGetAccessBindingsRequest() - request.attribution_settings.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_attribution_settings), "__call__" + type(client.transport.batch_get_access_bindings), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AttributionSettings() + analytics_admin.BatchGetAccessBindingsResponse() ) - await client.update_attribution_settings(request) + await client.batch_get_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -25483,114 +25183,173 @@ async def test_update_attribution_settings_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "attribution_settings.name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_update_attribution_settings_flattened(): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.BatchUpdateAccessBindingsRequest, + dict, + ], +) +def test_batch_update_access_bindings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_attribution_settings), "__call__" + type(client.transport.batch_update_access_bindings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AttributionSettings() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_attribution_settings( - attribution_settings=resources.AttributionSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) + call.return_value = analytics_admin.BatchUpdateAccessBindingsResponse() + response = client.batch_update_access_bindings(request) - # Establish that the underlying call was made with the expected - # request object values. + # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].attribution_settings - mock_val = resources.AttributionSettings(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) - assert arg == mock_val + assert args[0] == analytics_admin.BatchUpdateAccessBindingsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, analytics_admin.BatchUpdateAccessBindingsResponse) -def test_update_attribution_settings_flattened_error(): +def test_batch_update_access_bindings_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_attribution_settings( - analytics_admin.UpdateAttributionSettingsRequest(), - attribution_settings=resources.AttributionSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.batch_update_access_bindings), "__call__" + ) as call: + client.batch_update_access_bindings() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.BatchUpdateAccessBindingsRequest() @pytest.mark.asyncio -async def test_update_attribution_settings_flattened_async(): +async def test_batch_update_access_bindings_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.BatchUpdateAccessBindingsRequest, +): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_attribution_settings), "__call__" + type(client.transport.batch_update_access_bindings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AttributionSettings() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AttributionSettings() - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_attribution_settings( - attribution_settings=resources.AttributionSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + analytics_admin.BatchUpdateAccessBindingsResponse() ) + response = await client.batch_update_access_bindings(request) - # Establish that the underlying call was made with the expected - # request object values. + # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].attribution_settings - mock_val = resources.AttributionSettings(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) - assert arg == mock_val + assert args[0] == analytics_admin.BatchUpdateAccessBindingsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, analytics_admin.BatchUpdateAccessBindingsResponse) @pytest.mark.asyncio -async def test_update_attribution_settings_flattened_error_async(): +async def test_batch_update_access_bindings_async_from_dict(): + await test_batch_update_access_bindings_async(request_type=dict) + + +def test_batch_update_access_bindings_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.BatchUpdateAccessBindingsRequest() + + request.parent = "parent_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.batch_update_access_bindings), "__call__" + ) as call: + call.return_value = analytics_admin.BatchUpdateAccessBindingsResponse() + client.batch_update_access_bindings(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_batch_update_access_bindings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_attribution_settings( - analytics_admin.UpdateAttributionSettingsRequest(), - attribution_settings=resources.AttributionSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.BatchUpdateAccessBindingsRequest() + + request.parent = "parent_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.batch_update_access_bindings), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.BatchUpdateAccessBindingsResponse() ) + await client.batch_update_access_bindings(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] @pytest.mark.parametrize( "request_type", [ - analytics_admin.RunAccessReportRequest, + analytics_admin.BatchDeleteAccessBindingsRequest, dict, ], ) -def test_run_access_report(request_type, transport: str = "grpc"): +def test_batch_delete_access_bindings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -25602,25 +25361,22 @@ def test_run_access_report(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.run_access_report), "__call__" + type(client.transport.batch_delete_access_bindings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.RunAccessReportResponse( - row_count=992, - ) - response = client.run_access_report(request) + call.return_value = None + response = client.batch_delete_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.RunAccessReportRequest() + assert args[0] == analytics_admin.BatchDeleteAccessBindingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.RunAccessReportResponse) - assert response.row_count == 992 + assert response is None -def test_run_access_report_empty_call(): +def test_batch_delete_access_bindings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -25630,17 +25386,18 @@ def test_run_access_report_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.run_access_report), "__call__" + type(client.transport.batch_delete_access_bindings), "__call__" ) as call: - client.run_access_report() + client.batch_delete_access_bindings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.RunAccessReportRequest() + assert args[0] == analytics_admin.BatchDeleteAccessBindingsRequest() @pytest.mark.asyncio -async def test_run_access_report_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.RunAccessReportRequest +async def test_batch_delete_access_bindings_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.BatchDeleteAccessBindingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25653,48 +25410,43 @@ async def test_run_access_report_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.run_access_report), "__call__" + type(client.transport.batch_delete_access_bindings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.RunAccessReportResponse( - row_count=992, - ) - ) - response = await client.run_access_report(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.batch_delete_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.RunAccessReportRequest() + assert args[0] == analytics_admin.BatchDeleteAccessBindingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.RunAccessReportResponse) - assert response.row_count == 992 + assert response is None @pytest.mark.asyncio -async def test_run_access_report_async_from_dict(): - await test_run_access_report_async(request_type=dict) +async def test_batch_delete_access_bindings_async_from_dict(): + await test_batch_delete_access_bindings_async(request_type=dict) -def test_run_access_report_field_headers(): +def test_batch_delete_access_bindings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.RunAccessReportRequest() + request = analytics_admin.BatchDeleteAccessBindingsRequest() - request.entity = "entity_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.run_access_report), "__call__" + type(client.transport.batch_delete_access_bindings), "__call__" ) as call: - call.return_value = analytics_admin.RunAccessReportResponse() - client.run_access_report(request) + call.return_value = None + client.batch_delete_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -25705,30 +25457,28 @@ def test_run_access_report_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "entity=entity_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_run_access_report_field_headers_async(): +async def test_batch_delete_access_bindings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.RunAccessReportRequest() + request = analytics_admin.BatchDeleteAccessBindingsRequest() - request.entity = "entity_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.run_access_report), "__call__" + type(client.transport.batch_delete_access_bindings), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.RunAccessReportResponse() - ) - await client.run_access_report(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.batch_delete_access_bindings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -25739,18 +25489,18 @@ async def test_run_access_report_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "entity=entity_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateAccessBindingRequest, + analytics_admin.GetExpandedDataSetRequest, dict, ], ) -def test_create_access_binding(request_type, transport: str = "grpc"): +def test_get_expanded_data_set(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -25762,28 +25512,33 @@ def test_create_access_binding(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_access_binding), "__call__" + type(client.transport.get_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AccessBinding( + call.return_value = expanded_data_set.ExpandedDataSet( name="name_value", - roles=["roles_value"], - user="user_value", + display_name="display_name_value", + description="description_value", + dimension_names=["dimension_names_value"], + metric_names=["metric_names_value"], ) - response = client.create_access_binding(request) + response = client.get_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateAccessBindingRequest() + assert args[0] == analytics_admin.GetExpandedDataSetRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.AccessBinding) + assert isinstance(response, expanded_data_set.ExpandedDataSet) assert response.name == "name_value" - assert response.roles == ["roles_value"] + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.dimension_names == ["dimension_names_value"] + assert response.metric_names == ["metric_names_value"] -def test_create_access_binding_empty_call(): +def test_get_expanded_data_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -25793,18 +25548,18 @@ def test_create_access_binding_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_access_binding), "__call__" + type(client.transport.get_expanded_data_set), "__call__" ) as call: - client.create_access_binding() + client.get_expanded_data_set() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateAccessBindingRequest() + assert args[0] == analytics_admin.GetExpandedDataSetRequest() @pytest.mark.asyncio -async def test_create_access_binding_async( +async def test_get_expanded_data_set_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateAccessBindingRequest, + request_type=analytics_admin.GetExpandedDataSetRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -25817,50 +25572,56 @@ async def test_create_access_binding_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_access_binding), "__call__" + type(client.transport.get_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AccessBinding( + expanded_data_set.ExpandedDataSet( name="name_value", - roles=["roles_value"], + display_name="display_name_value", + description="description_value", + dimension_names=["dimension_names_value"], + metric_names=["metric_names_value"], ) ) - response = await client.create_access_binding(request) + response = await client.get_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateAccessBindingRequest() + assert args[0] == analytics_admin.GetExpandedDataSetRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.AccessBinding) + assert isinstance(response, expanded_data_set.ExpandedDataSet) assert response.name == "name_value" - assert response.roles == ["roles_value"] + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.dimension_names == ["dimension_names_value"] + assert response.metric_names == ["metric_names_value"] @pytest.mark.asyncio -async def test_create_access_binding_async_from_dict(): - await test_create_access_binding_async(request_type=dict) +async def test_get_expanded_data_set_async_from_dict(): + await test_get_expanded_data_set_async(request_type=dict) -def test_create_access_binding_field_headers(): +def test_get_expanded_data_set_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateAccessBindingRequest() + request = analytics_admin.GetExpandedDataSetRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_access_binding), "__call__" + type(client.transport.get_expanded_data_set), "__call__" ) as call: - call.return_value = resources.AccessBinding() - client.create_access_binding(request) + call.return_value = expanded_data_set.ExpandedDataSet() + client.get_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -25871,30 +25632,30 @@ def test_create_access_binding_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_create_access_binding_field_headers_async(): +async def test_get_expanded_data_set_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateAccessBindingRequest() + request = analytics_admin.GetExpandedDataSetRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_access_binding), "__call__" + type(client.transport.get_expanded_data_set), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AccessBinding() + expanded_data_set.ExpandedDataSet() ) - await client.create_access_binding(request) + await client.get_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -25905,41 +25666,37 @@ async def test_create_access_binding_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_create_access_binding_flattened(): +def test_get_expanded_data_set_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_access_binding), "__call__" + type(client.transport.get_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AccessBinding() + call.return_value = expanded_data_set.ExpandedDataSet() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_access_binding( - parent="parent_value", - access_binding=resources.AccessBinding(user="user_value"), + client.get_expanded_data_set( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].access_binding - mock_val = resources.AccessBinding(user="user_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_create_access_binding_flattened_error(): +def test_get_expanded_data_set_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -25947,50 +25704,45 @@ def test_create_access_binding_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_access_binding( - analytics_admin.CreateAccessBindingRequest(), - parent="parent_value", - access_binding=resources.AccessBinding(user="user_value"), + client.get_expanded_data_set( + analytics_admin.GetExpandedDataSetRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_create_access_binding_flattened_async(): +async def test_get_expanded_data_set_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_access_binding), "__call__" + type(client.transport.get_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AccessBinding() + call.return_value = expanded_data_set.ExpandedDataSet() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AccessBinding() + expanded_data_set.ExpandedDataSet() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_access_binding( - parent="parent_value", - access_binding=resources.AccessBinding(user="user_value"), + response = await client.get_expanded_data_set( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].access_binding - mock_val = resources.AccessBinding(user="user_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_create_access_binding_flattened_error_async(): +async def test_get_expanded_data_set_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -25998,21 +25750,20 @@ async def test_create_access_binding_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_access_binding( - analytics_admin.CreateAccessBindingRequest(), - parent="parent_value", - access_binding=resources.AccessBinding(user="user_value"), + await client.get_expanded_data_set( + analytics_admin.GetExpandedDataSetRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAccessBindingRequest, + analytics_admin.ListExpandedDataSetsRequest, dict, ], ) -def test_get_access_binding(request_type, transport: str = "grpc"): +def test_list_expanded_data_sets(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -26024,28 +25775,25 @@ def test_get_access_binding(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_access_binding), "__call__" + type(client.transport.list_expanded_data_sets), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AccessBinding( - name="name_value", - roles=["roles_value"], - user="user_value", + call.return_value = analytics_admin.ListExpandedDataSetsResponse( + next_page_token="next_page_token_value", ) - response = client.get_access_binding(request) + response = client.list_expanded_data_sets(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAccessBindingRequest() + assert args[0] == analytics_admin.ListExpandedDataSetsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.AccessBinding) - assert response.name == "name_value" - assert response.roles == ["roles_value"] + assert isinstance(response, pagers.ListExpandedDataSetsPager) + assert response.next_page_token == "next_page_token_value" -def test_get_access_binding_empty_call(): +def test_list_expanded_data_sets_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -26055,18 +25803,18 @@ def test_get_access_binding_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_access_binding), "__call__" + type(client.transport.list_expanded_data_sets), "__call__" ) as call: - client.get_access_binding() + client.list_expanded_data_sets() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAccessBindingRequest() + assert args[0] == analytics_admin.ListExpandedDataSetsRequest() @pytest.mark.asyncio -async def test_get_access_binding_async( +async def test_list_expanded_data_sets_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetAccessBindingRequest, + request_type=analytics_admin.ListExpandedDataSetsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26079,50 +25827,48 @@ async def test_get_access_binding_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_access_binding), "__call__" + type(client.transport.list_expanded_data_sets), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AccessBinding( - name="name_value", - roles=["roles_value"], + analytics_admin.ListExpandedDataSetsResponse( + next_page_token="next_page_token_value", ) ) - response = await client.get_access_binding(request) + response = await client.list_expanded_data_sets(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAccessBindingRequest() + assert args[0] == analytics_admin.ListExpandedDataSetsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.AccessBinding) - assert response.name == "name_value" - assert response.roles == ["roles_value"] + assert isinstance(response, pagers.ListExpandedDataSetsAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_get_access_binding_async_from_dict(): - await test_get_access_binding_async(request_type=dict) +async def test_list_expanded_data_sets_async_from_dict(): + await test_list_expanded_data_sets_async(request_type=dict) -def test_get_access_binding_field_headers(): +def test_list_expanded_data_sets_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetAccessBindingRequest() + request = analytics_admin.ListExpandedDataSetsRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_access_binding), "__call__" + type(client.transport.list_expanded_data_sets), "__call__" ) as call: - call.return_value = resources.AccessBinding() - client.get_access_binding(request) + call.return_value = analytics_admin.ListExpandedDataSetsResponse() + client.list_expanded_data_sets(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -26133,30 +25879,30 @@ def test_get_access_binding_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_access_binding_field_headers_async(): +async def test_list_expanded_data_sets_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetAccessBindingRequest() + request = analytics_admin.ListExpandedDataSetsRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_access_binding), "__call__" + type(client.transport.list_expanded_data_sets), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AccessBinding() + analytics_admin.ListExpandedDataSetsResponse() ) - await client.get_access_binding(request) + await client.list_expanded_data_sets(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -26167,37 +25913,37 @@ async def test_get_access_binding_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_access_binding_flattened(): +def test_list_expanded_data_sets_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_access_binding), "__call__" + type(client.transport.list_expanded_data_sets), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AccessBinding() + call.return_value = analytics_admin.ListExpandedDataSetsResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_access_binding( - name="name_value", + client.list_expanded_data_sets( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val -def test_get_access_binding_flattened_error(): +def test_list_expanded_data_sets_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -26205,45 +25951,45 @@ def test_get_access_binding_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_access_binding( - analytics_admin.GetAccessBindingRequest(), - name="name_value", + client.list_expanded_data_sets( + analytics_admin.ListExpandedDataSetsRequest(), + parent="parent_value", ) @pytest.mark.asyncio -async def test_get_access_binding_flattened_async(): +async def test_list_expanded_data_sets_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_access_binding), "__call__" + type(client.transport.list_expanded_data_sets), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AccessBinding() + call.return_value = analytics_admin.ListExpandedDataSetsResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AccessBinding() + analytics_admin.ListExpandedDataSetsResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_access_binding( - name="name_value", + response = await client.list_expanded_data_sets( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val @pytest.mark.asyncio -async def test_get_access_binding_flattened_error_async(): +async def test_list_expanded_data_sets_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -26251,74 +25997,277 @@ async def test_get_access_binding_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_access_binding( - analytics_admin.GetAccessBindingRequest(), - name="name_value", + await client.list_expanded_data_sets( + analytics_admin.ListExpandedDataSetsRequest(), + parent="parent_value", ) -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.UpdateAccessBindingRequest, - dict, - ], -) -def test_update_access_binding(request_type, transport: str = "grpc"): +def test_list_expanded_data_sets_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_access_binding), "__call__" + type(client.transport.list_expanded_data_sets), "__call__" ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.AccessBinding( - name="name_value", - roles=["roles_value"], - user="user_value", - ) - response = client.update_access_binding(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAccessBindingRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, resources.AccessBinding) - assert response.name == "name_value" - assert response.roles == ["roles_value"] - - -def test_update_access_binding_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + ], + next_page_token="abc", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[], + next_page_token="def", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + ], + next_page_token="ghi", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_expanded_data_sets(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, expanded_data_set.ExpandedDataSet) for i in results) + + +def test_list_expanded_data_sets_pages(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_access_binding), "__call__" + type(client.transport.list_expanded_data_sets), "__call__" ) as call: - client.update_access_binding() + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + ], + next_page_token="abc", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[], + next_page_token="def", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + ], + next_page_token="ghi", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + ], + ), + RuntimeError, + ) + pages = list(client.list_expanded_data_sets(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_expanded_data_sets_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_expanded_data_sets), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + ], + next_page_token="abc", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[], + next_page_token="def", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + ], + next_page_token="ghi", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_expanded_data_sets( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, expanded_data_set.ExpandedDataSet) for i in responses) + + +@pytest.mark.asyncio +async def test_list_expanded_data_sets_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_expanded_data_sets), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + ], + next_page_token="abc", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[], + next_page_token="def", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + ], + next_page_token="ghi", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + ], + ), + RuntimeError, + ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_expanded_data_sets(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateExpandedDataSetRequest, + dict, + ], +) +def test_create_expanded_data_set(request_type, transport: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_expanded_data_set), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gaa_expanded_data_set.ExpandedDataSet( + name="name_value", + display_name="display_name_value", + description="description_value", + dimension_names=["dimension_names_value"], + metric_names=["metric_names_value"], + ) + response = client.create_expanded_data_set(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateExpandedDataSetRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, gaa_expanded_data_set.ExpandedDataSet) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.dimension_names == ["dimension_names_value"] + assert response.metric_names == ["metric_names_value"] + + +def test_create_expanded_data_set_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_expanded_data_set), "__call__" + ) as call: + client.create_expanded_data_set() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAccessBindingRequest() + assert args[0] == analytics_admin.CreateExpandedDataSetRequest() @pytest.mark.asyncio -async def test_update_access_binding_async( +async def test_create_expanded_data_set_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateAccessBindingRequest, + request_type=analytics_admin.CreateExpandedDataSetRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26331,50 +26280,56 @@ async def test_update_access_binding_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_access_binding), "__call__" + type(client.transport.create_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AccessBinding( + gaa_expanded_data_set.ExpandedDataSet( name="name_value", - roles=["roles_value"], + display_name="display_name_value", + description="description_value", + dimension_names=["dimension_names_value"], + metric_names=["metric_names_value"], ) ) - response = await client.update_access_binding(request) + response = await client.create_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateAccessBindingRequest() + assert args[0] == analytics_admin.CreateExpandedDataSetRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.AccessBinding) + assert isinstance(response, gaa_expanded_data_set.ExpandedDataSet) assert response.name == "name_value" - assert response.roles == ["roles_value"] + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.dimension_names == ["dimension_names_value"] + assert response.metric_names == ["metric_names_value"] @pytest.mark.asyncio -async def test_update_access_binding_async_from_dict(): - await test_update_access_binding_async(request_type=dict) +async def test_create_expanded_data_set_async_from_dict(): + await test_create_expanded_data_set_async(request_type=dict) -def test_update_access_binding_field_headers(): +def test_create_expanded_data_set_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateAccessBindingRequest() + request = analytics_admin.CreateExpandedDataSetRequest() - request.access_binding.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_access_binding), "__call__" + type(client.transport.create_expanded_data_set), "__call__" ) as call: - call.return_value = resources.AccessBinding() - client.update_access_binding(request) + call.return_value = gaa_expanded_data_set.ExpandedDataSet() + client.create_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -26385,30 +26340,30 @@ def test_update_access_binding_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "access_binding.name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_access_binding_field_headers_async(): +async def test_create_expanded_data_set_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateAccessBindingRequest() + request = analytics_admin.CreateExpandedDataSetRequest() - request.access_binding.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_access_binding), "__call__" + type(client.transport.create_expanded_data_set), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AccessBinding() + gaa_expanded_data_set.ExpandedDataSet() ) - await client.update_access_binding(request) + await client.create_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -26419,37 +26374,41 @@ async def test_update_access_binding_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "access_binding.name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_update_access_binding_flattened(): +def test_create_expanded_data_set_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_access_binding), "__call__" + type(client.transport.create_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AccessBinding() + call.return_value = gaa_expanded_data_set.ExpandedDataSet() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_access_binding( - access_binding=resources.AccessBinding(user="user_value"), + client.create_expanded_data_set( + parent="parent_value", + expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].access_binding - mock_val = resources.AccessBinding(user="user_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].expanded_data_set + mock_val = gaa_expanded_data_set.ExpandedDataSet(name="name_value") assert arg == mock_val -def test_update_access_binding_flattened_error(): +def test_create_expanded_data_set_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -26457,45 +26416,50 @@ def test_update_access_binding_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_access_binding( - analytics_admin.UpdateAccessBindingRequest(), - access_binding=resources.AccessBinding(user="user_value"), + client.create_expanded_data_set( + analytics_admin.CreateExpandedDataSetRequest(), + parent="parent_value", + expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), ) @pytest.mark.asyncio -async def test_update_access_binding_flattened_async(): +async def test_create_expanded_data_set_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_access_binding), "__call__" + type(client.transport.create_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AccessBinding() + call.return_value = gaa_expanded_data_set.ExpandedDataSet() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AccessBinding() + gaa_expanded_data_set.ExpandedDataSet() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_access_binding( - access_binding=resources.AccessBinding(user="user_value"), + response = await client.create_expanded_data_set( + parent="parent_value", + expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].access_binding - mock_val = resources.AccessBinding(user="user_value") + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].expanded_data_set + mock_val = gaa_expanded_data_set.ExpandedDataSet(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_update_access_binding_flattened_error_async(): +async def test_create_expanded_data_set_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -26503,20 +26467,21 @@ async def test_update_access_binding_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_access_binding( - analytics_admin.UpdateAccessBindingRequest(), - access_binding=resources.AccessBinding(user="user_value"), + await client.create_expanded_data_set( + analytics_admin.CreateExpandedDataSetRequest(), + parent="parent_value", + expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteAccessBindingRequest, + analytics_admin.UpdateExpandedDataSetRequest, dict, ], ) -def test_delete_access_binding(request_type, transport: str = "grpc"): +def test_update_expanded_data_set(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -26528,22 +26493,33 @@ def test_delete_access_binding(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_access_binding), "__call__" + type(client.transport.update_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_access_binding(request) + call.return_value = gaa_expanded_data_set.ExpandedDataSet( + name="name_value", + display_name="display_name_value", + description="description_value", + dimension_names=["dimension_names_value"], + metric_names=["metric_names_value"], + ) + response = client.update_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteAccessBindingRequest() + assert args[0] == analytics_admin.UpdateExpandedDataSetRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, gaa_expanded_data_set.ExpandedDataSet) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.dimension_names == ["dimension_names_value"] + assert response.metric_names == ["metric_names_value"] -def test_delete_access_binding_empty_call(): +def test_update_expanded_data_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -26553,18 +26529,18 @@ def test_delete_access_binding_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_access_binding), "__call__" + type(client.transport.update_expanded_data_set), "__call__" ) as call: - client.delete_access_binding() + client.update_expanded_data_set() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteAccessBindingRequest() + assert args[0] == analytics_admin.UpdateExpandedDataSetRequest() @pytest.mark.asyncio -async def test_delete_access_binding_async( +async def test_update_expanded_data_set_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteAccessBindingRequest, + request_type=analytics_admin.UpdateExpandedDataSetRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26577,43 +26553,56 @@ async def test_delete_access_binding_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_access_binding), "__call__" + type(client.transport.update_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_access_binding(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gaa_expanded_data_set.ExpandedDataSet( + name="name_value", + display_name="display_name_value", + description="description_value", + dimension_names=["dimension_names_value"], + metric_names=["metric_names_value"], + ) + ) + response = await client.update_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteAccessBindingRequest() + assert args[0] == analytics_admin.UpdateExpandedDataSetRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, gaa_expanded_data_set.ExpandedDataSet) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.dimension_names == ["dimension_names_value"] + assert response.metric_names == ["metric_names_value"] @pytest.mark.asyncio -async def test_delete_access_binding_async_from_dict(): - await test_delete_access_binding_async(request_type=dict) +async def test_update_expanded_data_set_async_from_dict(): + await test_update_expanded_data_set_async(request_type=dict) -def test_delete_access_binding_field_headers(): +def test_update_expanded_data_set_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteAccessBindingRequest() + request = analytics_admin.UpdateExpandedDataSetRequest() - request.name = "name_value" + request.expanded_data_set.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_access_binding), "__call__" + type(client.transport.update_expanded_data_set), "__call__" ) as call: - call.return_value = None - client.delete_access_binding(request) + call.return_value = gaa_expanded_data_set.ExpandedDataSet() + client.update_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -26624,28 +26613,30 @@ def test_delete_access_binding_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "expanded_data_set.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_delete_access_binding_field_headers_async(): +async def test_update_expanded_data_set_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteAccessBindingRequest() + request = analytics_admin.UpdateExpandedDataSetRequest() - request.name = "name_value" + request.expanded_data_set.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_access_binding), "__call__" + type(client.transport.update_expanded_data_set), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_access_binding(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gaa_expanded_data_set.ExpandedDataSet() + ) + await client.update_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -26656,37 +26647,41 @@ async def test_delete_access_binding_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "expanded_data_set.name=name_value", ) in kw["metadata"] -def test_delete_access_binding_flattened(): +def test_update_expanded_data_set_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_access_binding), "__call__" + type(client.transport.update_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = gaa_expanded_data_set.ExpandedDataSet() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_access_binding( - name="name_value", + client.update_expanded_data_set( + expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].expanded_data_set + mock_val = gaa_expanded_data_set.ExpandedDataSet(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_delete_access_binding_flattened_error(): +def test_update_expanded_data_set_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -26694,43 +26689,50 @@ def test_delete_access_binding_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_access_binding( - analytics_admin.DeleteAccessBindingRequest(), - name="name_value", + client.update_expanded_data_set( + analytics_admin.UpdateExpandedDataSetRequest(), + expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_delete_access_binding_flattened_async(): +async def test_update_expanded_data_set_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_access_binding), "__call__" + type(client.transport.update_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = gaa_expanded_data_set.ExpandedDataSet() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gaa_expanded_data_set.ExpandedDataSet() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_access_binding( - name="name_value", + response = await client.update_expanded_data_set( + expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].expanded_data_set + mock_val = gaa_expanded_data_set.ExpandedDataSet(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val @pytest.mark.asyncio -async def test_delete_access_binding_flattened_error_async(): +async def test_update_expanded_data_set_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -26738,20 +26740,21 @@ async def test_delete_access_binding_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.delete_access_binding( - analytics_admin.DeleteAccessBindingRequest(), - name="name_value", + await client.update_expanded_data_set( + analytics_admin.UpdateExpandedDataSetRequest(), + expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAccessBindingsRequest, + analytics_admin.DeleteExpandedDataSetRequest, dict, ], ) -def test_list_access_bindings(request_type, transport: str = "grpc"): +def test_delete_expanded_data_set(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -26763,25 +26766,22 @@ def test_list_access_bindings(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_access_bindings), "__call__" + type(client.transport.delete_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListAccessBindingsResponse( - next_page_token="next_page_token_value", - ) - response = client.list_access_bindings(request) + call.return_value = None + response = client.delete_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAccessBindingsRequest() + assert args[0] == analytics_admin.DeleteExpandedDataSetRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAccessBindingsPager) - assert response.next_page_token == "next_page_token_value" + assert response is None -def test_list_access_bindings_empty_call(): +def test_delete_expanded_data_set_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -26791,18 +26791,18 @@ def test_list_access_bindings_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_access_bindings), "__call__" + type(client.transport.delete_expanded_data_set), "__call__" ) as call: - client.list_access_bindings() + client.delete_expanded_data_set() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAccessBindingsRequest() + assert args[0] == analytics_admin.DeleteExpandedDataSetRequest() @pytest.mark.asyncio -async def test_list_access_bindings_async( +async def test_delete_expanded_data_set_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListAccessBindingsRequest, + request_type=analytics_admin.DeleteExpandedDataSetRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -26815,48 +26815,43 @@ async def test_list_access_bindings_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_access_bindings), "__call__" + type(client.transport.delete_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListAccessBindingsResponse( - next_page_token="next_page_token_value", - ) - ) - response = await client.list_access_bindings(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAccessBindingsRequest() + assert args[0] == analytics_admin.DeleteExpandedDataSetRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAccessBindingsAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert response is None @pytest.mark.asyncio -async def test_list_access_bindings_async_from_dict(): - await test_list_access_bindings_async(request_type=dict) +async def test_delete_expanded_data_set_async_from_dict(): + await test_delete_expanded_data_set_async(request_type=dict) -def test_list_access_bindings_field_headers(): +def test_delete_expanded_data_set_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListAccessBindingsRequest() + request = analytics_admin.DeleteExpandedDataSetRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_access_bindings), "__call__" + type(client.transport.delete_expanded_data_set), "__call__" ) as call: - call.return_value = analytics_admin.ListAccessBindingsResponse() - client.list_access_bindings(request) + call.return_value = None + client.delete_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -26867,30 +26862,28 @@ def test_list_access_bindings_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_access_bindings_field_headers_async(): +async def test_delete_expanded_data_set_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListAccessBindingsRequest() + request = analytics_admin.DeleteExpandedDataSetRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_access_bindings), "__call__" + type(client.transport.delete_expanded_data_set), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListAccessBindingsResponse() - ) - await client.list_access_bindings(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_expanded_data_set(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -26901,37 +26894,37 @@ async def test_list_access_bindings_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_list_access_bindings_flattened(): +def test_delete_expanded_data_set_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_access_bindings), "__call__" + type(client.transport.delete_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListAccessBindingsResponse() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_access_bindings( - parent="parent_value", + client.delete_expanded_data_set( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_list_access_bindings_flattened_error(): +def test_delete_expanded_data_set_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -26939,45 +26932,43 @@ def test_list_access_bindings_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_access_bindings( - analytics_admin.ListAccessBindingsRequest(), - parent="parent_value", + client.delete_expanded_data_set( + analytics_admin.DeleteExpandedDataSetRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_list_access_bindings_flattened_async(): +async def test_delete_expanded_data_set_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_access_bindings), "__call__" + type(client.transport.delete_expanded_data_set), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListAccessBindingsResponse() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListAccessBindingsResponse() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_access_bindings( - parent="parent_value", + response = await client.delete_expanded_data_set( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_list_access_bindings_flattened_error_async(): +async def test_delete_expanded_data_set_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -26985,218 +26976,20 @@ async def test_list_access_bindings_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_access_bindings( - analytics_admin.ListAccessBindingsRequest(), - parent="parent_value", - ) - - -def test_list_access_bindings_pager(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_access_bindings), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - resources.AccessBinding(), - resources.AccessBinding(), - ], - next_page_token="abc", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[], - next_page_token="def", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - resources.AccessBinding(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_access_bindings(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.AccessBinding) for i in results) - - -def test_list_access_bindings_pages(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_access_bindings), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - resources.AccessBinding(), - resources.AccessBinding(), - ], - next_page_token="abc", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[], - next_page_token="def", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - resources.AccessBinding(), - ], - ), - RuntimeError, - ) - pages = list(client.list_access_bindings(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_access_bindings_async_pager(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_access_bindings), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - resources.AccessBinding(), - resources.AccessBinding(), - ], - next_page_token="abc", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[], - next_page_token="def", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - resources.AccessBinding(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_access_bindings( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.AccessBinding) for i in responses) - - -@pytest.mark.asyncio -async def test_list_access_bindings_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_access_bindings), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - resources.AccessBinding(), - resources.AccessBinding(), - ], - next_page_token="abc", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[], - next_page_token="def", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - resources.AccessBinding(), - ], - ), - RuntimeError, + await client.delete_expanded_data_set( + analytics_admin.DeleteExpandedDataSetRequest(), + name="name_value", ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_access_bindings(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchCreateAccessBindingsRequest, + analytics_admin.GetChannelGroupRequest, dict, ], ) -def test_batch_create_access_bindings(request_type, transport: str = "grpc"): +def test_get_channel_group(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -27208,22 +27001,31 @@ def test_batch_create_access_bindings(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_create_access_bindings), "__call__" + type(client.transport.get_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.BatchCreateAccessBindingsResponse() - response = client.batch_create_access_bindings(request) + call.return_value = channel_group.ChannelGroup( + name="name_value", + display_name="display_name_value", + description="description_value", + system_defined=True, + ) + response = client.get_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchCreateAccessBindingsRequest() + assert args[0] == analytics_admin.GetChannelGroupRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchCreateAccessBindingsResponse) + assert isinstance(response, channel_group.ChannelGroup) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.system_defined is True -def test_batch_create_access_bindings_empty_call(): +def test_get_channel_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -27233,18 +27035,17 @@ def test_batch_create_access_bindings_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_create_access_bindings), "__call__" + type(client.transport.get_channel_group), "__call__" ) as call: - client.batch_create_access_bindings() + client.get_channel_group() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchCreateAccessBindingsRequest() + assert args[0] == analytics_admin.GetChannelGroupRequest() @pytest.mark.asyncio -async def test_batch_create_access_bindings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.BatchCreateAccessBindingsRequest, +async def test_get_channel_group_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.GetChannelGroupRequest ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -27257,45 +27058,54 @@ async def test_batch_create_access_bindings_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_create_access_bindings), "__call__" + type(client.transport.get_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.BatchCreateAccessBindingsResponse() + channel_group.ChannelGroup( + name="name_value", + display_name="display_name_value", + description="description_value", + system_defined=True, + ) ) - response = await client.batch_create_access_bindings(request) + response = await client.get_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchCreateAccessBindingsRequest() + assert args[0] == analytics_admin.GetChannelGroupRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchCreateAccessBindingsResponse) + assert isinstance(response, channel_group.ChannelGroup) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.system_defined is True @pytest.mark.asyncio -async def test_batch_create_access_bindings_async_from_dict(): - await test_batch_create_access_bindings_async(request_type=dict) +async def test_get_channel_group_async_from_dict(): + await test_get_channel_group_async(request_type=dict) -def test_batch_create_access_bindings_field_headers(): +def test_get_channel_group_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.BatchCreateAccessBindingsRequest() + request = analytics_admin.GetChannelGroupRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_create_access_bindings), "__call__" + type(client.transport.get_channel_group), "__call__" ) as call: - call.return_value = analytics_admin.BatchCreateAccessBindingsResponse() - client.batch_create_access_bindings(request) + call.return_value = channel_group.ChannelGroup() + client.get_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -27306,30 +27116,30 @@ def test_batch_create_access_bindings_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_batch_create_access_bindings_field_headers_async(): +async def test_get_channel_group_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.BatchCreateAccessBindingsRequest() + request = analytics_admin.GetChannelGroupRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_create_access_bindings), "__call__" + type(client.transport.get_channel_group), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.BatchCreateAccessBindingsResponse() + channel_group.ChannelGroup() ) - await client.batch_create_access_bindings(request) + await client.get_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -27340,173 +27150,104 @@ async def test_batch_create_access_bindings_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.BatchGetAccessBindingsRequest, - dict, - ], -) -def test_batch_get_access_bindings(request_type, transport: str = "grpc"): +def test_get_channel_group_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_get_access_bindings), "__call__" + type(client.transport.get_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.BatchGetAccessBindingsResponse() - response = client.batch_get_access_bindings(request) + call.return_value = channel_group.ChannelGroup() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_channel_group( + name="name_value", + ) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying call was made with the expected + # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchGetAccessBindingsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchGetAccessBindingsResponse) + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val -def test_batch_get_access_bindings_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. +def test_get_channel_group_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.batch_get_access_bindings), "__call__" - ) as call: - client.batch_get_access_bindings() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchGetAccessBindingsRequest() + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_channel_group( + analytics_admin.GetChannelGroupRequest(), + name="name_value", + ) @pytest.mark.asyncio -async def test_batch_get_access_bindings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.BatchGetAccessBindingsRequest, -): +async def test_get_channel_group_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_get_access_bindings), "__call__" + type(client.transport.get_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. + call.return_value = channel_group.ChannelGroup() + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.BatchGetAccessBindingsResponse() + channel_group.ChannelGroup() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_channel_group( + name="name_value", ) - response = await client.batch_get_access_bindings(request) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying call was made with the expected + # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchGetAccessBindingsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchGetAccessBindingsResponse) + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio -async def test_batch_get_access_bindings_async_from_dict(): - await test_batch_get_access_bindings_async(request_type=dict) - - -def test_batch_get_access_bindings_field_headers(): - client = AnalyticsAdminServiceClient( +async def test_get_channel_group_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.BatchGetAccessBindingsRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.batch_get_access_bindings), "__call__" - ) as call: - call.return_value = analytics_admin.BatchGetAccessBindingsResponse() - client.batch_get_access_bindings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_batch_get_access_bindings_field_headers_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.BatchGetAccessBindingsRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.batch_get_access_bindings), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.BatchGetAccessBindingsResponse() - ) - await client.batch_get_access_bindings(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_channel_group( + analytics_admin.GetChannelGroupRequest(), + name="name_value", + ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchUpdateAccessBindingsRequest, + analytics_admin.ListChannelGroupsRequest, dict, ], ) -def test_batch_update_access_bindings(request_type, transport: str = "grpc"): +def test_list_channel_groups(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -27518,22 +27259,25 @@ def test_batch_update_access_bindings(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_update_access_bindings), "__call__" + type(client.transport.list_channel_groups), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.BatchUpdateAccessBindingsResponse() - response = client.batch_update_access_bindings(request) + call.return_value = analytics_admin.ListChannelGroupsResponse( + next_page_token="next_page_token_value", + ) + response = client.list_channel_groups(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchUpdateAccessBindingsRequest() + assert args[0] == analytics_admin.ListChannelGroupsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchUpdateAccessBindingsResponse) + assert isinstance(response, pagers.ListChannelGroupsPager) + assert response.next_page_token == "next_page_token_value" -def test_batch_update_access_bindings_empty_call(): +def test_list_channel_groups_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -27543,18 +27287,18 @@ def test_batch_update_access_bindings_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_update_access_bindings), "__call__" + type(client.transport.list_channel_groups), "__call__" ) as call: - client.batch_update_access_bindings() + client.list_channel_groups() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchUpdateAccessBindingsRequest() + assert args[0] == analytics_admin.ListChannelGroupsRequest() @pytest.mark.asyncio -async def test_batch_update_access_bindings_async( +async def test_list_channel_groups_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.BatchUpdateAccessBindingsRequest, + request_type=analytics_admin.ListChannelGroupsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -27567,45 +27311,48 @@ async def test_batch_update_access_bindings_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_update_access_bindings), "__call__" + type(client.transport.list_channel_groups), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.BatchUpdateAccessBindingsResponse() + analytics_admin.ListChannelGroupsResponse( + next_page_token="next_page_token_value", + ) ) - response = await client.batch_update_access_bindings(request) + response = await client.list_channel_groups(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchUpdateAccessBindingsRequest() + assert args[0] == analytics_admin.ListChannelGroupsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchUpdateAccessBindingsResponse) + assert isinstance(response, pagers.ListChannelGroupsAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_batch_update_access_bindings_async_from_dict(): - await test_batch_update_access_bindings_async(request_type=dict) +async def test_list_channel_groups_async_from_dict(): + await test_list_channel_groups_async(request_type=dict) -def test_batch_update_access_bindings_field_headers(): +def test_list_channel_groups_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.BatchUpdateAccessBindingsRequest() + request = analytics_admin.ListChannelGroupsRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_update_access_bindings), "__call__" + type(client.transport.list_channel_groups), "__call__" ) as call: - call.return_value = analytics_admin.BatchUpdateAccessBindingsResponse() - client.batch_update_access_bindings(request) + call.return_value = analytics_admin.ListChannelGroupsResponse() + client.list_channel_groups(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -27621,25 +27368,25 @@ def test_batch_update_access_bindings_field_headers(): @pytest.mark.asyncio -async def test_batch_update_access_bindings_field_headers_async(): +async def test_list_channel_groups_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.BatchUpdateAccessBindingsRequest() + request = analytics_admin.ListChannelGroupsRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_update_access_bindings), "__call__" + type(client.transport.list_channel_groups), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.BatchUpdateAccessBindingsResponse() + analytics_admin.ListChannelGroupsResponse() ) - await client.batch_update_access_bindings(request) + await client.list_channel_groups(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -27654,165 +27401,298 @@ async def test_batch_update_access_bindings_field_headers_async(): ) in kw["metadata"] -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.BatchDeleteAccessBindingsRequest, - dict, - ], -) -def test_batch_delete_access_bindings(request_type, transport: str = "grpc"): +def test_list_channel_groups_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_delete_access_bindings), "__call__" + type(client.transport.list_channel_groups), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.batch_delete_access_bindings(request) + call.return_value = analytics_admin.ListChannelGroupsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_channel_groups( + parent="parent_value", + ) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying call was made with the expected + # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchDeleteAccessBindingsRequest() - - # Establish that the response is the type that we expect. - assert response is None + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val -def test_batch_delete_access_bindings_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. +def test_list_channel_groups_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.batch_delete_access_bindings), "__call__" - ) as call: - client.batch_delete_access_bindings() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchDeleteAccessBindingsRequest() + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_channel_groups( + analytics_admin.ListChannelGroupsRequest(), + parent="parent_value", + ) @pytest.mark.asyncio -async def test_batch_delete_access_bindings_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.BatchDeleteAccessBindingsRequest, -): +async def test_list_channel_groups_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_delete_access_bindings), "__call__" + type(client.transport.list_channel_groups), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.batch_delete_access_bindings(request) + call.return_value = analytics_admin.ListChannelGroupsResponse() - # Establish that the underlying gRPC stub method was called. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListChannelGroupsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_channel_groups( + parent="parent_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.BatchDeleteAccessBindingsRequest() - - # Establish that the response is the type that we expect. - assert response is None + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val @pytest.mark.asyncio -async def test_batch_delete_access_bindings_async_from_dict(): - await test_batch_delete_access_bindings_async(request_type=dict) - - -def test_batch_delete_access_bindings_field_headers(): - client = AnalyticsAdminServiceClient( +async def test_list_channel_groups_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.BatchDeleteAccessBindingsRequest() + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_channel_groups( + analytics_admin.ListChannelGroupsRequest(), + parent="parent_value", + ) - request.parent = "parent_value" + +def test_list_channel_groups_pager(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_delete_access_bindings), "__call__" + type(client.transport.list_channel_groups), "__call__" ) as call: - call.return_value = None - client.batch_delete_access_bindings(request) + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + ], + next_page_token="abc", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[], + next_page_token="def", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + ], + next_page_token="ghi", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + ], + ), + RuntimeError, + ) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_channel_groups(request={}) - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] + assert pager._metadata == metadata + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, channel_group.ChannelGroup) for i in results) -@pytest.mark.asyncio -async def test_batch_delete_access_bindings_field_headers_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), + +def test_list_channel_groups_pages(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.BatchDeleteAccessBindingsRequest() + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_groups), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + ], + next_page_token="abc", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[], + next_page_token="def", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + ], + next_page_token="ghi", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + ], + ), + RuntimeError, + ) + pages = list(client.list_channel_groups(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token - request.parent = "parent_value" + +@pytest.mark.asyncio +async def test_list_channel_groups_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.batch_delete_access_bindings), "__call__" + type(client.transport.list_channel_groups), + "__call__", + new_callable=mock.AsyncMock, ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.batch_delete_access_bindings(request) + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + ], + next_page_token="abc", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[], + next_page_token="def", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + ], + next_page_token="ghi", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_channel_groups( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request + assert len(responses) == 6 + assert all(isinstance(i, channel_group.ChannelGroup) for i in responses) - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] + +@pytest.mark.asyncio +async def test_list_channel_groups_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_channel_groups), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + ], + next_page_token="abc", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[], + next_page_token="def", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + ], + next_page_token="ghi", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + ], + ), + RuntimeError, + ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_channel_groups(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetExpandedDataSetRequest, + analytics_admin.CreateChannelGroupRequest, dict, ], ) -def test_get_expanded_data_set(request_type, transport: str = "grpc"): +def test_create_channel_group(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -27824,33 +27704,31 @@ def test_get_expanded_data_set(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_expanded_data_set), "__call__" + type(client.transport.create_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = expanded_data_set.ExpandedDataSet( + call.return_value = gaa_channel_group.ChannelGroup( name="name_value", display_name="display_name_value", description="description_value", - dimension_names=["dimension_names_value"], - metric_names=["metric_names_value"], + system_defined=True, ) - response = client.get_expanded_data_set(request) + response = client.create_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetExpandedDataSetRequest() + assert args[0] == analytics_admin.CreateChannelGroupRequest() # Establish that the response is the type that we expect. - assert isinstance(response, expanded_data_set.ExpandedDataSet) + assert isinstance(response, gaa_channel_group.ChannelGroup) assert response.name == "name_value" assert response.display_name == "display_name_value" assert response.description == "description_value" - assert response.dimension_names == ["dimension_names_value"] - assert response.metric_names == ["metric_names_value"] + assert response.system_defined is True -def test_get_expanded_data_set_empty_call(): +def test_create_channel_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -27860,18 +27738,18 @@ def test_get_expanded_data_set_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_expanded_data_set), "__call__" + type(client.transport.create_channel_group), "__call__" ) as call: - client.get_expanded_data_set() + client.create_channel_group() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetExpandedDataSetRequest() + assert args[0] == analytics_admin.CreateChannelGroupRequest() @pytest.mark.asyncio -async def test_get_expanded_data_set_async( +async def test_create_channel_group_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetExpandedDataSetRequest, + request_type=analytics_admin.CreateChannelGroupRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -27884,56 +27762,54 @@ async def test_get_expanded_data_set_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_expanded_data_set), "__call__" + type(client.transport.create_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - expanded_data_set.ExpandedDataSet( + gaa_channel_group.ChannelGroup( name="name_value", display_name="display_name_value", description="description_value", - dimension_names=["dimension_names_value"], - metric_names=["metric_names_value"], + system_defined=True, ) ) - response = await client.get_expanded_data_set(request) + response = await client.create_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetExpandedDataSetRequest() + assert args[0] == analytics_admin.CreateChannelGroupRequest() # Establish that the response is the type that we expect. - assert isinstance(response, expanded_data_set.ExpandedDataSet) + assert isinstance(response, gaa_channel_group.ChannelGroup) assert response.name == "name_value" assert response.display_name == "display_name_value" assert response.description == "description_value" - assert response.dimension_names == ["dimension_names_value"] - assert response.metric_names == ["metric_names_value"] + assert response.system_defined is True @pytest.mark.asyncio -async def test_get_expanded_data_set_async_from_dict(): - await test_get_expanded_data_set_async(request_type=dict) +async def test_create_channel_group_async_from_dict(): + await test_create_channel_group_async(request_type=dict) -def test_get_expanded_data_set_field_headers(): +def test_create_channel_group_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetExpandedDataSetRequest() + request = analytics_admin.CreateChannelGroupRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_expanded_data_set), "__call__" + type(client.transport.create_channel_group), "__call__" ) as call: - call.return_value = expanded_data_set.ExpandedDataSet() - client.get_expanded_data_set(request) + call.return_value = gaa_channel_group.ChannelGroup() + client.create_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -27944,30 +27820,30 @@ def test_get_expanded_data_set_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_expanded_data_set_field_headers_async(): +async def test_create_channel_group_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetExpandedDataSetRequest() + request = analytics_admin.CreateChannelGroupRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_expanded_data_set), "__call__" + type(client.transport.create_channel_group), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - expanded_data_set.ExpandedDataSet() + gaa_channel_group.ChannelGroup() ) - await client.get_expanded_data_set(request) + await client.create_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -27978,37 +27854,41 @@ async def test_get_expanded_data_set_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_expanded_data_set_flattened(): +def test_create_channel_group_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_expanded_data_set), "__call__" + type(client.transport.create_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = expanded_data_set.ExpandedDataSet() + call.return_value = gaa_channel_group.ChannelGroup() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_expanded_data_set( - name="name_value", + client.create_channel_group( + parent="parent_value", + channel_group=gaa_channel_group.ChannelGroup(name="name_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].channel_group + mock_val = gaa_channel_group.ChannelGroup(name="name_value") assert arg == mock_val -def test_get_expanded_data_set_flattened_error(): +def test_create_channel_group_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -28016,45 +27896,50 @@ def test_get_expanded_data_set_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_expanded_data_set( - analytics_admin.GetExpandedDataSetRequest(), - name="name_value", + client.create_channel_group( + analytics_admin.CreateChannelGroupRequest(), + parent="parent_value", + channel_group=gaa_channel_group.ChannelGroup(name="name_value"), ) @pytest.mark.asyncio -async def test_get_expanded_data_set_flattened_async(): +async def test_create_channel_group_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_expanded_data_set), "__call__" + type(client.transport.create_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = expanded_data_set.ExpandedDataSet() + call.return_value = gaa_channel_group.ChannelGroup() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - expanded_data_set.ExpandedDataSet() + gaa_channel_group.ChannelGroup() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_expanded_data_set( - name="name_value", + response = await client.create_channel_group( + parent="parent_value", + channel_group=gaa_channel_group.ChannelGroup(name="name_value"), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].channel_group + mock_val = gaa_channel_group.ChannelGroup(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_get_expanded_data_set_flattened_error_async(): +async def test_create_channel_group_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -28062,20 +27947,21 @@ async def test_get_expanded_data_set_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_expanded_data_set( - analytics_admin.GetExpandedDataSetRequest(), - name="name_value", + await client.create_channel_group( + analytics_admin.CreateChannelGroupRequest(), + parent="parent_value", + channel_group=gaa_channel_group.ChannelGroup(name="name_value"), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListExpandedDataSetsRequest, + analytics_admin.UpdateChannelGroupRequest, dict, ], ) -def test_list_expanded_data_sets(request_type, transport: str = "grpc"): +def test_update_channel_group(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -28087,25 +27973,31 @@ def test_list_expanded_data_sets(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_expanded_data_sets), "__call__" + type(client.transport.update_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListExpandedDataSetsResponse( - next_page_token="next_page_token_value", + call.return_value = gaa_channel_group.ChannelGroup( + name="name_value", + display_name="display_name_value", + description="description_value", + system_defined=True, ) - response = client.list_expanded_data_sets(request) + response = client.update_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListExpandedDataSetsRequest() + assert args[0] == analytics_admin.UpdateChannelGroupRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListExpandedDataSetsPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, gaa_channel_group.ChannelGroup) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.system_defined is True -def test_list_expanded_data_sets_empty_call(): +def test_update_channel_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -28115,18 +28007,18 @@ def test_list_expanded_data_sets_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_expanded_data_sets), "__call__" + type(client.transport.update_channel_group), "__call__" ) as call: - client.list_expanded_data_sets() + client.update_channel_group() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListExpandedDataSetsRequest() + assert args[0] == analytics_admin.UpdateChannelGroupRequest() @pytest.mark.asyncio -async def test_list_expanded_data_sets_async( +async def test_update_channel_group_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListExpandedDataSetsRequest, + request_type=analytics_admin.UpdateChannelGroupRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28139,48 +28031,54 @@ async def test_list_expanded_data_sets_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_expanded_data_sets), "__call__" + type(client.transport.update_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListExpandedDataSetsResponse( - next_page_token="next_page_token_value", + gaa_channel_group.ChannelGroup( + name="name_value", + display_name="display_name_value", + description="description_value", + system_defined=True, ) ) - response = await client.list_expanded_data_sets(request) + response = await client.update_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListExpandedDataSetsRequest() + assert args[0] == analytics_admin.UpdateChannelGroupRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListExpandedDataSetsAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, gaa_channel_group.ChannelGroup) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.system_defined is True @pytest.mark.asyncio -async def test_list_expanded_data_sets_async_from_dict(): - await test_list_expanded_data_sets_async(request_type=dict) +async def test_update_channel_group_async_from_dict(): + await test_update_channel_group_async(request_type=dict) -def test_list_expanded_data_sets_field_headers(): +def test_update_channel_group_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListExpandedDataSetsRequest() + request = analytics_admin.UpdateChannelGroupRequest() - request.parent = "parent_value" + request.channel_group.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_expanded_data_sets), "__call__" + type(client.transport.update_channel_group), "__call__" ) as call: - call.return_value = analytics_admin.ListExpandedDataSetsResponse() - client.list_expanded_data_sets(request) + call.return_value = gaa_channel_group.ChannelGroup() + client.update_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -28191,30 +28089,30 @@ def test_list_expanded_data_sets_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "channel_group.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_expanded_data_sets_field_headers_async(): +async def test_update_channel_group_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListExpandedDataSetsRequest() + request = analytics_admin.UpdateChannelGroupRequest() - request.parent = "parent_value" + request.channel_group.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_expanded_data_sets), "__call__" + type(client.transport.update_channel_group), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListExpandedDataSetsResponse() + gaa_channel_group.ChannelGroup() ) - await client.list_expanded_data_sets(request) + await client.update_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -28225,37 +28123,41 @@ async def test_list_expanded_data_sets_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "channel_group.name=name_value", ) in kw["metadata"] -def test_list_expanded_data_sets_flattened(): +def test_update_channel_group_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_expanded_data_sets), "__call__" + type(client.transport.update_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListExpandedDataSetsResponse() + call.return_value = gaa_channel_group.ChannelGroup() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_expanded_data_sets( - parent="parent_value", + client.update_channel_group( + channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].channel_group + mock_val = gaa_channel_group.ChannelGroup(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_list_expanded_data_sets_flattened_error(): +def test_update_channel_group_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -28263,45 +28165,50 @@ def test_list_expanded_data_sets_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_expanded_data_sets( - analytics_admin.ListExpandedDataSetsRequest(), - parent="parent_value", + client.update_channel_group( + analytics_admin.UpdateChannelGroupRequest(), + channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_list_expanded_data_sets_flattened_async(): +async def test_update_channel_group_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_expanded_data_sets), "__call__" + type(client.transport.update_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListExpandedDataSetsResponse() + call.return_value = gaa_channel_group.ChannelGroup() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListExpandedDataSetsResponse() + gaa_channel_group.ChannelGroup() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_expanded_data_sets( - parent="parent_value", + response = await client.update_channel_group( + channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].channel_group + mock_val = gaa_channel_group.ChannelGroup(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val @pytest.mark.asyncio -async def test_list_expanded_data_sets_flattened_error_async(): +async def test_update_channel_group_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -28309,218 +28216,21 @@ async def test_list_expanded_data_sets_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_expanded_data_sets( - analytics_admin.ListExpandedDataSetsRequest(), - parent="parent_value", - ) - - -def test_list_expanded_data_sets_pager(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_expanded_data_sets), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - ], - next_page_token="abc", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[], - next_page_token="def", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - ], - next_page_token="ghi", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_expanded_data_sets(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, expanded_data_set.ExpandedDataSet) for i in results) - - -def test_list_expanded_data_sets_pages(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_expanded_data_sets), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - ], - next_page_token="abc", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[], - next_page_token="def", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - ], - next_page_token="ghi", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - ], - ), - RuntimeError, - ) - pages = list(client.list_expanded_data_sets(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_expanded_data_sets_async_pager(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_expanded_data_sets), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - ], - next_page_token="abc", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[], - next_page_token="def", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - ], - next_page_token="ghi", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_expanded_data_sets( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, expanded_data_set.ExpandedDataSet) for i in responses) - - -@pytest.mark.asyncio -async def test_list_expanded_data_sets_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_expanded_data_sets), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - ], - next_page_token="abc", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[], - next_page_token="def", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - ], - next_page_token="ghi", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - ], - ), - RuntimeError, + await client.update_channel_group( + analytics_admin.UpdateChannelGroupRequest(), + channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_expanded_data_sets(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateExpandedDataSetRequest, + analytics_admin.DeleteChannelGroupRequest, dict, ], ) -def test_create_expanded_data_set(request_type, transport: str = "grpc"): +def test_delete_channel_group(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -28532,33 +28242,22 @@ def test_create_expanded_data_set(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_expanded_data_set), "__call__" + type(client.transport.delete_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_expanded_data_set.ExpandedDataSet( - name="name_value", - display_name="display_name_value", - description="description_value", - dimension_names=["dimension_names_value"], - metric_names=["metric_names_value"], - ) - response = client.create_expanded_data_set(request) + call.return_value = None + response = client.delete_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateExpandedDataSetRequest() + assert args[0] == analytics_admin.DeleteChannelGroupRequest() # Establish that the response is the type that we expect. - assert isinstance(response, gaa_expanded_data_set.ExpandedDataSet) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.dimension_names == ["dimension_names_value"] - assert response.metric_names == ["metric_names_value"] + assert response is None -def test_create_expanded_data_set_empty_call(): +def test_delete_channel_group_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -28568,18 +28267,18 @@ def test_create_expanded_data_set_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_expanded_data_set), "__call__" + type(client.transport.delete_channel_group), "__call__" ) as call: - client.create_expanded_data_set() + client.delete_channel_group() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateExpandedDataSetRequest() + assert args[0] == analytics_admin.DeleteChannelGroupRequest() @pytest.mark.asyncio -async def test_create_expanded_data_set_async( +async def test_delete_channel_group_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateExpandedDataSetRequest, + request_type=analytics_admin.DeleteChannelGroupRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28592,56 +28291,43 @@ async def test_create_expanded_data_set_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_expanded_data_set), "__call__" + type(client.transport.delete_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_expanded_data_set.ExpandedDataSet( - name="name_value", - display_name="display_name_value", - description="description_value", - dimension_names=["dimension_names_value"], - metric_names=["metric_names_value"], - ) - ) - response = await client.create_expanded_data_set(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateExpandedDataSetRequest() + assert args[0] == analytics_admin.DeleteChannelGroupRequest() # Establish that the response is the type that we expect. - assert isinstance(response, gaa_expanded_data_set.ExpandedDataSet) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.dimension_names == ["dimension_names_value"] - assert response.metric_names == ["metric_names_value"] + assert response is None @pytest.mark.asyncio -async def test_create_expanded_data_set_async_from_dict(): - await test_create_expanded_data_set_async(request_type=dict) +async def test_delete_channel_group_async_from_dict(): + await test_delete_channel_group_async(request_type=dict) -def test_create_expanded_data_set_field_headers(): +def test_delete_channel_group_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateExpandedDataSetRequest() + request = analytics_admin.DeleteChannelGroupRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_expanded_data_set), "__call__" + type(client.transport.delete_channel_group), "__call__" ) as call: - call.return_value = gaa_expanded_data_set.ExpandedDataSet() - client.create_expanded_data_set(request) + call.return_value = None + client.delete_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -28652,30 +28338,28 @@ def test_create_expanded_data_set_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_create_expanded_data_set_field_headers_async(): +async def test_delete_channel_group_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateExpandedDataSetRequest() + request = analytics_admin.DeleteChannelGroupRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_expanded_data_set), "__call__" + type(client.transport.delete_channel_group), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_expanded_data_set.ExpandedDataSet() - ) - await client.create_expanded_data_set(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_channel_group(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -28686,41 +28370,37 @@ async def test_create_expanded_data_set_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_create_expanded_data_set_flattened(): +def test_delete_channel_group_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_expanded_data_set), "__call__" + type(client.transport.delete_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_expanded_data_set.ExpandedDataSet() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_expanded_data_set( - parent="parent_value", - expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), - ) + client.delete_channel_group( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].expanded_data_set - mock_val = gaa_expanded_data_set.ExpandedDataSet(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_create_expanded_data_set_flattened_error(): +def test_delete_channel_group_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -28728,50 +28408,43 @@ def test_create_expanded_data_set_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_expanded_data_set( - analytics_admin.CreateExpandedDataSetRequest(), - parent="parent_value", - expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), + client.delete_channel_group( + analytics_admin.DeleteChannelGroupRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_create_expanded_data_set_flattened_async(): +async def test_delete_channel_group_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_expanded_data_set), "__call__" + type(client.transport.delete_channel_group), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_expanded_data_set.ExpandedDataSet() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_expanded_data_set.ExpandedDataSet() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_expanded_data_set( - parent="parent_value", - expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), + response = await client.delete_channel_group( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].expanded_data_set - mock_val = gaa_expanded_data_set.ExpandedDataSet(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_create_expanded_data_set_flattened_error_async(): +async def test_delete_channel_group_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -28779,21 +28452,20 @@ async def test_create_expanded_data_set_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_expanded_data_set( - analytics_admin.CreateExpandedDataSetRequest(), - parent="parent_value", - expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), + await client.delete_channel_group( + analytics_admin.DeleteChannelGroupRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateExpandedDataSetRequest, + analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, dict, ], ) -def test_update_expanded_data_set(request_type, transport: str = "grpc"): +def test_set_automated_ga4_configuration_opt_out(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -28805,33 +28477,24 @@ def test_update_expanded_data_set(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_expanded_data_set), "__call__" + type(client.transport.set_automated_ga4_configuration_opt_out), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_expanded_data_set.ExpandedDataSet( - name="name_value", - display_name="display_name_value", - description="description_value", - dimension_names=["dimension_names_value"], - metric_names=["metric_names_value"], - ) - response = client.update_expanded_data_set(request) + call.return_value = analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse() + response = client.set_automated_ga4_configuration_opt_out(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateExpandedDataSetRequest() + assert args[0] == analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest() # Establish that the response is the type that we expect. - assert isinstance(response, gaa_expanded_data_set.ExpandedDataSet) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.dimension_names == ["dimension_names_value"] - assert response.metric_names == ["metric_names_value"] + assert isinstance( + response, analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse + ) -def test_update_expanded_data_set_empty_call(): +def test_set_automated_ga4_configuration_opt_out_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -28841,18 +28504,18 @@ def test_update_expanded_data_set_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_expanded_data_set), "__call__" + type(client.transport.set_automated_ga4_configuration_opt_out), "__call__" ) as call: - client.update_expanded_data_set() + client.set_automated_ga4_configuration_opt_out() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateExpandedDataSetRequest() + assert args[0] == analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest() @pytest.mark.asyncio -async def test_update_expanded_data_set_async( +async def test_set_automated_ga4_configuration_opt_out_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateExpandedDataSetRequest, + request_type=analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -28865,208 +28528,142 @@ async def test_update_expanded_data_set_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_expanded_data_set), "__call__" + type(client.transport.set_automated_ga4_configuration_opt_out), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_expanded_data_set.ExpandedDataSet( - name="name_value", - display_name="display_name_value", - description="description_value", - dimension_names=["dimension_names_value"], - metric_names=["metric_names_value"], - ) + analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse() ) - response = await client.update_expanded_data_set(request) + response = await client.set_automated_ga4_configuration_opt_out(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateExpandedDataSetRequest() + assert args[0] == analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest() # Establish that the response is the type that we expect. - assert isinstance(response, gaa_expanded_data_set.ExpandedDataSet) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.dimension_names == ["dimension_names_value"] - assert response.metric_names == ["metric_names_value"] + assert isinstance( + response, analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse + ) @pytest.mark.asyncio -async def test_update_expanded_data_set_async_from_dict(): - await test_update_expanded_data_set_async(request_type=dict) +async def test_set_automated_ga4_configuration_opt_out_async_from_dict(): + await test_set_automated_ga4_configuration_opt_out_async(request_type=dict) -def test_update_expanded_data_set_field_headers(): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, + dict, + ], +) +def test_fetch_automated_ga4_configuration_opt_out( + request_type, transport: str = "grpc" +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateExpandedDataSetRequest() - - request.expanded_data_set.name = "name_value" + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_expanded_data_set), "__call__" + type(client.transport.fetch_automated_ga4_configuration_opt_out), "__call__" ) as call: - call.return_value = gaa_expanded_data_set.ExpandedDataSet() - client.update_expanded_data_set(request) + # Designate an appropriate return value for the call. + call.return_value = ( + analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse( + opt_out=True, + ) + ) + response = client.fetch_automated_ga4_configuration_opt_out(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "expanded_data_set.name=name_value", - ) in kw["metadata"] - + assert args[0] == analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest() -@pytest.mark.asyncio -async def test_update_expanded_data_set_field_headers_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), + # Establish that the response is the type that we expect. + assert isinstance( + response, analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateExpandedDataSetRequest() - - request.expanded_data_set.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_expanded_data_set), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_expanded_data_set.ExpandedDataSet() - ) - await client.update_expanded_data_set(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "expanded_data_set.name=name_value", - ) in kw["metadata"] + assert response.opt_out is True -def test_update_expanded_data_set_flattened(): +def test_fetch_automated_ga4_configuration_opt_out_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_expanded_data_set), "__call__" + type(client.transport.fetch_automated_ga4_configuration_opt_out), "__call__" ) as call: - # Designate an appropriate return value for the call. - call.return_value = gaa_expanded_data_set.ExpandedDataSet() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_expanded_data_set( - expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 + client.fetch_automated_ga4_configuration_opt_out() + call.assert_called() _, args, _ = call.mock_calls[0] - arg = args[0].expanded_data_set - mock_val = gaa_expanded_data_set.ExpandedDataSet(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) - assert arg == mock_val - - -def test_update_expanded_data_set_flattened_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_expanded_data_set( - analytics_admin.UpdateExpandedDataSetRequest(), - expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) + assert args[0] == analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest() @pytest.mark.asyncio -async def test_update_expanded_data_set_flattened_async(): +async def test_fetch_automated_ga4_configuration_opt_out_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, +): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_expanded_data_set), "__call__" + type(client.transport.fetch_automated_ga4_configuration_opt_out), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_expanded_data_set.ExpandedDataSet() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_expanded_data_set.ExpandedDataSet() - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_expanded_data_set( - expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse( + opt_out=True, + ) ) + response = await client.fetch_automated_ga4_configuration_opt_out(request) - # Establish that the underlying call was made with the expected - # request object values. + # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].expanded_data_set - mock_val = gaa_expanded_data_set.ExpandedDataSet(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) - assert arg == mock_val - + assert args[0] == analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest() -@pytest.mark.asyncio -async def test_update_expanded_data_set_flattened_error_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), + # Establish that the response is the type that we expect. + assert isinstance( + response, analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse ) + assert response.opt_out is True - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_expanded_data_set( - analytics_admin.UpdateExpandedDataSetRequest(), - expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) + +@pytest.mark.asyncio +async def test_fetch_automated_ga4_configuration_opt_out_async_from_dict(): + await test_fetch_automated_ga4_configuration_opt_out_async(request_type=dict) @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteExpandedDataSetRequest, + analytics_admin.GetBigQueryLinkRequest, dict, ], ) -def test_delete_expanded_data_set(request_type, transport: str = "grpc"): +def test_get_big_query_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -29078,22 +28675,39 @@ def test_delete_expanded_data_set(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_expanded_data_set), "__call__" + type(client.transport.get_big_query_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_expanded_data_set(request) + call.return_value = resources.BigQueryLink( + name="name_value", + project="project_value", + daily_export_enabled=True, + streaming_export_enabled=True, + fresh_daily_export_enabled=True, + include_advertising_id=True, + export_streams=["export_streams_value"], + excluded_events=["excluded_events_value"], + ) + response = client.get_big_query_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteExpandedDataSetRequest() + assert args[0] == analytics_admin.GetBigQueryLinkRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.BigQueryLink) + assert response.name == "name_value" + assert response.project == "project_value" + assert response.daily_export_enabled is True + assert response.streaming_export_enabled is True + assert response.fresh_daily_export_enabled is True + assert response.include_advertising_id is True + assert response.export_streams == ["export_streams_value"] + assert response.excluded_events == ["excluded_events_value"] -def test_delete_expanded_data_set_empty_call(): +def test_get_big_query_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -29103,18 +28717,17 @@ def test_delete_expanded_data_set_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_expanded_data_set), "__call__" + type(client.transport.get_big_query_link), "__call__" ) as call: - client.delete_expanded_data_set() + client.get_big_query_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteExpandedDataSetRequest() + assert args[0] == analytics_admin.GetBigQueryLinkRequest() @pytest.mark.asyncio -async def test_delete_expanded_data_set_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteExpandedDataSetRequest, +async def test_get_big_query_link_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.GetBigQueryLinkRequest ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29127,43 +28740,62 @@ async def test_delete_expanded_data_set_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_expanded_data_set), "__call__" + type(client.transport.get_big_query_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_expanded_data_set(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.BigQueryLink( + name="name_value", + project="project_value", + daily_export_enabled=True, + streaming_export_enabled=True, + fresh_daily_export_enabled=True, + include_advertising_id=True, + export_streams=["export_streams_value"], + excluded_events=["excluded_events_value"], + ) + ) + response = await client.get_big_query_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteExpandedDataSetRequest() + assert args[0] == analytics_admin.GetBigQueryLinkRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.BigQueryLink) + assert response.name == "name_value" + assert response.project == "project_value" + assert response.daily_export_enabled is True + assert response.streaming_export_enabled is True + assert response.fresh_daily_export_enabled is True + assert response.include_advertising_id is True + assert response.export_streams == ["export_streams_value"] + assert response.excluded_events == ["excluded_events_value"] @pytest.mark.asyncio -async def test_delete_expanded_data_set_async_from_dict(): - await test_delete_expanded_data_set_async(request_type=dict) +async def test_get_big_query_link_async_from_dict(): + await test_get_big_query_link_async(request_type=dict) -def test_delete_expanded_data_set_field_headers(): +def test_get_big_query_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteExpandedDataSetRequest() + request = analytics_admin.GetBigQueryLinkRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_expanded_data_set), "__call__" + type(client.transport.get_big_query_link), "__call__" ) as call: - call.return_value = None - client.delete_expanded_data_set(request) + call.return_value = resources.BigQueryLink() + client.get_big_query_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -29179,23 +28811,25 @@ def test_delete_expanded_data_set_field_headers(): @pytest.mark.asyncio -async def test_delete_expanded_data_set_field_headers_async(): +async def test_get_big_query_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteExpandedDataSetRequest() + request = analytics_admin.GetBigQueryLinkRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_expanded_data_set), "__call__" + type(client.transport.get_big_query_link), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_expanded_data_set(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.BigQueryLink() + ) + await client.get_big_query_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -29210,20 +28844,20 @@ async def test_delete_expanded_data_set_field_headers_async(): ) in kw["metadata"] -def test_delete_expanded_data_set_flattened(): +def test_get_big_query_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_expanded_data_set), "__call__" + type(client.transport.get_big_query_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.BigQueryLink() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_expanded_data_set( + client.get_big_query_link( name="name_value", ) @@ -29236,7 +28870,7 @@ def test_delete_expanded_data_set_flattened(): assert arg == mock_val -def test_delete_expanded_data_set_flattened_error(): +def test_get_big_query_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -29244,29 +28878,31 @@ def test_delete_expanded_data_set_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_expanded_data_set( - analytics_admin.DeleteExpandedDataSetRequest(), + client.get_big_query_link( + analytics_admin.GetBigQueryLinkRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_delete_expanded_data_set_flattened_async(): +async def test_get_big_query_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_expanded_data_set), "__call__" + type(client.transport.get_big_query_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.BigQueryLink() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.BigQueryLink() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_expanded_data_set( + response = await client.get_big_query_link( name="name_value", ) @@ -29280,7 +28916,7 @@ async def test_delete_expanded_data_set_flattened_async(): @pytest.mark.asyncio -async def test_delete_expanded_data_set_flattened_error_async(): +async def test_get_big_query_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -29288,8 +28924,8 @@ async def test_delete_expanded_data_set_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.delete_expanded_data_set( - analytics_admin.DeleteExpandedDataSetRequest(), + await client.get_big_query_link( + analytics_admin.GetBigQueryLinkRequest(), name="name_value", ) @@ -29297,11 +28933,11 @@ async def test_delete_expanded_data_set_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetChannelGroupRequest, + analytics_admin.ListBigQueryLinksRequest, dict, ], ) -def test_get_channel_group(request_type, transport: str = "grpc"): +def test_list_big_query_links(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -29313,31 +28949,25 @@ def test_get_channel_group(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_channel_group), "__call__" + type(client.transport.list_big_query_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = channel_group.ChannelGroup( - name="name_value", - display_name="display_name_value", - description="description_value", - system_defined=True, + call.return_value = analytics_admin.ListBigQueryLinksResponse( + next_page_token="next_page_token_value", ) - response = client.get_channel_group(request) + response = client.list_big_query_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetChannelGroupRequest() + assert args[0] == analytics_admin.ListBigQueryLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, channel_group.ChannelGroup) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.system_defined is True + assert isinstance(response, pagers.ListBigQueryLinksPager) + assert response.next_page_token == "next_page_token_value" -def test_get_channel_group_empty_call(): +def test_list_big_query_links_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -29347,17 +28977,18 @@ def test_get_channel_group_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_channel_group), "__call__" + type(client.transport.list_big_query_links), "__call__" ) as call: - client.get_channel_group() + client.list_big_query_links() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetChannelGroupRequest() + assert args[0] == analytics_admin.ListBigQueryLinksRequest() @pytest.mark.asyncio -async def test_get_channel_group_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetChannelGroupRequest +async def test_list_big_query_links_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.ListBigQueryLinksRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -29370,54 +29001,48 @@ async def test_get_channel_group_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_channel_group), "__call__" + type(client.transport.list_big_query_links), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - channel_group.ChannelGroup( - name="name_value", - display_name="display_name_value", - description="description_value", - system_defined=True, + analytics_admin.ListBigQueryLinksResponse( + next_page_token="next_page_token_value", ) ) - response = await client.get_channel_group(request) + response = await client.list_big_query_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetChannelGroupRequest() + assert args[0] == analytics_admin.ListBigQueryLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, channel_group.ChannelGroup) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.system_defined is True + assert isinstance(response, pagers.ListBigQueryLinksAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_get_channel_group_async_from_dict(): - await test_get_channel_group_async(request_type=dict) +async def test_list_big_query_links_async_from_dict(): + await test_list_big_query_links_async(request_type=dict) -def test_get_channel_group_field_headers(): +def test_list_big_query_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetChannelGroupRequest() + request = analytics_admin.ListBigQueryLinksRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_channel_group), "__call__" + type(client.transport.list_big_query_links), "__call__" ) as call: - call.return_value = channel_group.ChannelGroup() - client.get_channel_group(request) + call.return_value = analytics_admin.ListBigQueryLinksResponse() + client.list_big_query_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -29428,30 +29053,30 @@ def test_get_channel_group_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_channel_group_field_headers_async(): +async def test_list_big_query_links_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetChannelGroupRequest() + request = analytics_admin.ListBigQueryLinksRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_channel_group), "__call__" + type(client.transport.list_big_query_links), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - channel_group.ChannelGroup() + analytics_admin.ListBigQueryLinksResponse() ) - await client.get_channel_group(request) + await client.list_big_query_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -29462,271 +29087,24 @@ async def test_get_channel_group_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_channel_group_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_group), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = channel_group.ChannelGroup() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.get_channel_group( - name="name_value", - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val - - -def test_get_channel_group_flattened_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_channel_group( - analytics_admin.GetChannelGroupRequest(), - name="name_value", - ) - - -@pytest.mark.asyncio -async def test_get_channel_group_flattened_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.get_channel_group), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = channel_group.ChannelGroup() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - channel_group.ChannelGroup() - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.get_channel_group( - name="name_value", - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val - - -@pytest.mark.asyncio -async def test_get_channel_group_flattened_error_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.get_channel_group( - analytics_admin.GetChannelGroupRequest(), - name="name_value", - ) - - -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.ListChannelGroupsRequest, - dict, - ], -) -def test_list_channel_groups(request_type, transport: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_groups), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListChannelGroupsResponse( - next_page_token="next_page_token_value", - ) - response = client.list_channel_groups(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListChannelGroupsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListChannelGroupsPager) - assert response.next_page_token == "next_page_token_value" - - -def test_list_channel_groups_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_groups), "__call__" - ) as call: - client.list_channel_groups() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListChannelGroupsRequest() - - -@pytest.mark.asyncio -async def test_list_channel_groups_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListChannelGroupsRequest, -): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_groups), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListChannelGroupsResponse( - next_page_token="next_page_token_value", - ) - ) - response = await client.list_channel_groups(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListChannelGroupsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListChannelGroupsAsyncPager) - assert response.next_page_token == "next_page_token_value" - - -@pytest.mark.asyncio -async def test_list_channel_groups_async_from_dict(): - await test_list_channel_groups_async(request_type=dict) - - -def test_list_channel_groups_field_headers(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.ListChannelGroupsRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_groups), "__call__" - ) as call: - call.return_value = analytics_admin.ListChannelGroupsResponse() - client.list_channel_groups(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_list_channel_groups_field_headers_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.ListChannelGroupsRequest() - - request.parent = "parent_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_channel_groups), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListChannelGroupsResponse() - ) - await client.list_channel_groups(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "parent=parent_value", - ) in kw["metadata"] - - -def test_list_channel_groups_flattened(): +def test_list_big_query_links_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_channel_groups), "__call__" + type(client.transport.list_big_query_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListChannelGroupsResponse() + call.return_value = analytics_admin.ListBigQueryLinksResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_channel_groups( + client.list_big_query_links( parent="parent_value", ) @@ -29739,7 +29117,7 @@ def test_list_channel_groups_flattened(): assert arg == mock_val -def test_list_channel_groups_flattened_error(): +def test_list_big_query_links_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -29747,31 +29125,31 @@ def test_list_channel_groups_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_channel_groups( - analytics_admin.ListChannelGroupsRequest(), + client.list_big_query_links( + analytics_admin.ListBigQueryLinksRequest(), parent="parent_value", ) @pytest.mark.asyncio -async def test_list_channel_groups_flattened_async(): +async def test_list_big_query_links_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_channel_groups), "__call__" + type(client.transport.list_big_query_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListChannelGroupsResponse() + call.return_value = analytics_admin.ListBigQueryLinksResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListChannelGroupsResponse() + analytics_admin.ListBigQueryLinksResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_channel_groups( + response = await client.list_big_query_links( parent="parent_value", ) @@ -29785,7 +29163,7 @@ async def test_list_channel_groups_flattened_async(): @pytest.mark.asyncio -async def test_list_channel_groups_flattened_error_async(): +async def test_list_big_query_links_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -29793,13 +29171,13 @@ async def test_list_channel_groups_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_channel_groups( - analytics_admin.ListChannelGroupsRequest(), + await client.list_big_query_links( + analytics_admin.ListBigQueryLinksRequest(), parent="parent_value", ) -def test_list_channel_groups_pager(transport_name: str = "grpc"): +def test_list_big_query_links_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials, transport=transport_name, @@ -29807,32 +29185,32 @@ def test_list_channel_groups_pager(transport_name: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_channel_groups), "__call__" + type(client.transport.list_big_query_links), "__call__" ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), + resources.BigQueryLink(), + resources.BigQueryLink(), ], next_page_token="abc", ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[], + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[], next_page_token="def", ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), ], next_page_token="ghi", ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), + resources.BigQueryLink(), ], ), RuntimeError, @@ -29842,16 +29220,16 @@ def test_list_channel_groups_pager(transport_name: str = "grpc"): metadata = tuple(metadata) + ( gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), ) - pager = client.list_channel_groups(request={}) + pager = client.list_big_query_links(request={}) assert pager._metadata == metadata results = list(pager) assert len(results) == 6 - assert all(isinstance(i, channel_group.ChannelGroup) for i in results) + assert all(isinstance(i, resources.BigQueryLink) for i in results) -def test_list_channel_groups_pages(transport_name: str = "grpc"): +def test_list_big_query_links_pages(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials, transport=transport_name, @@ -29859,82 +29237,82 @@ def test_list_channel_groups_pages(transport_name: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_channel_groups), "__call__" + type(client.transport.list_big_query_links), "__call__" ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), + resources.BigQueryLink(), + resources.BigQueryLink(), ], next_page_token="abc", ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[], + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[], next_page_token="def", ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), ], next_page_token="ghi", ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), + resources.BigQueryLink(), ], ), RuntimeError, ) - pages = list(client.list_channel_groups(request={}).pages) + pages = list(client.list_big_query_links(request={}).pages) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_list_channel_groups_async_pager(): +async def test_list_big_query_links_async_pager(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_channel_groups), + type(client.transport.list_big_query_links), "__call__", new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), + resources.BigQueryLink(), + resources.BigQueryLink(), ], next_page_token="abc", ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[], + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[], next_page_token="def", ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), ], next_page_token="ghi", ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), + resources.BigQueryLink(), ], ), RuntimeError, ) - async_pager = await client.list_channel_groups( + async_pager = await client.list_big_query_links( request={}, ) assert async_pager.next_page_token == "abc" @@ -29943,45 +29321,45 @@ async def test_list_channel_groups_async_pager(): responses.append(response) assert len(responses) == 6 - assert all(isinstance(i, channel_group.ChannelGroup) for i in responses) + assert all(isinstance(i, resources.BigQueryLink) for i in responses) @pytest.mark.asyncio -async def test_list_channel_groups_async_pages(): +async def test_list_big_query_links_async_pages(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_channel_groups), + type(client.transport.list_big_query_links), "__call__", new_callable=mock.AsyncMock, ) as call: # Set the response to a series of pages. call.side_effect = ( - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), + resources.BigQueryLink(), + resources.BigQueryLink(), ], next_page_token="abc", ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[], + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[], next_page_token="def", ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), ], next_page_token="ghi", ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), + resources.BigQueryLink(), ], ), RuntimeError, @@ -29990,7 +29368,7 @@ async def test_list_channel_groups_async_pages(): # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 async for page_ in ( # pragma: no branch - await client.list_channel_groups(request={}) + await client.list_big_query_links(request={}) ).pages: pages.append(page_) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): @@ -30000,11 +29378,11 @@ async def test_list_channel_groups_async_pages(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateChannelGroupRequest, + analytics_admin.GetEnhancedMeasurementSettingsRequest, dict, ], ) -def test_create_channel_group(request_type, transport: str = "grpc"): +def test_get_enhanced_measurement_settings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -30016,31 +29394,45 @@ def test_create_channel_group(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_channel_group), "__call__" + type(client.transport.get_enhanced_measurement_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_channel_group.ChannelGroup( + call.return_value = resources.EnhancedMeasurementSettings( name="name_value", - display_name="display_name_value", - description="description_value", - system_defined=True, + stream_enabled=True, + scrolls_enabled=True, + outbound_clicks_enabled=True, + site_search_enabled=True, + video_engagement_enabled=True, + file_downloads_enabled=True, + page_changes_enabled=True, + form_interactions_enabled=True, + search_query_parameter="search_query_parameter_value", + uri_query_parameter="uri_query_parameter_value", ) - response = client.create_channel_group(request) + response = client.get_enhanced_measurement_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateChannelGroupRequest() + assert args[0] == analytics_admin.GetEnhancedMeasurementSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, gaa_channel_group.ChannelGroup) + assert isinstance(response, resources.EnhancedMeasurementSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.system_defined is True + assert response.stream_enabled is True + assert response.scrolls_enabled is True + assert response.outbound_clicks_enabled is True + assert response.site_search_enabled is True + assert response.video_engagement_enabled is True + assert response.file_downloads_enabled is True + assert response.page_changes_enabled is True + assert response.form_interactions_enabled is True + assert response.search_query_parameter == "search_query_parameter_value" + assert response.uri_query_parameter == "uri_query_parameter_value" -def test_create_channel_group_empty_call(): +def test_get_enhanced_measurement_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -30050,18 +29442,18 @@ def test_create_channel_group_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_channel_group), "__call__" + type(client.transport.get_enhanced_measurement_settings), "__call__" ) as call: - client.create_channel_group() + client.get_enhanced_measurement_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateChannelGroupRequest() + assert args[0] == analytics_admin.GetEnhancedMeasurementSettingsRequest() @pytest.mark.asyncio -async def test_create_channel_group_async( +async def test_get_enhanced_measurement_settings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateChannelGroupRequest, + request_type=analytics_admin.GetEnhancedMeasurementSettingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -30074,54 +29466,68 @@ async def test_create_channel_group_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_channel_group), "__call__" + type(client.transport.get_enhanced_measurement_settings), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_channel_group.ChannelGroup( + resources.EnhancedMeasurementSettings( name="name_value", - display_name="display_name_value", - description="description_value", - system_defined=True, + stream_enabled=True, + scrolls_enabled=True, + outbound_clicks_enabled=True, + site_search_enabled=True, + video_engagement_enabled=True, + file_downloads_enabled=True, + page_changes_enabled=True, + form_interactions_enabled=True, + search_query_parameter="search_query_parameter_value", + uri_query_parameter="uri_query_parameter_value", ) ) - response = await client.create_channel_group(request) + response = await client.get_enhanced_measurement_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateChannelGroupRequest() + assert args[0] == analytics_admin.GetEnhancedMeasurementSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, gaa_channel_group.ChannelGroup) + assert isinstance(response, resources.EnhancedMeasurementSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.system_defined is True + assert response.stream_enabled is True + assert response.scrolls_enabled is True + assert response.outbound_clicks_enabled is True + assert response.site_search_enabled is True + assert response.video_engagement_enabled is True + assert response.file_downloads_enabled is True + assert response.page_changes_enabled is True + assert response.form_interactions_enabled is True + assert response.search_query_parameter == "search_query_parameter_value" + assert response.uri_query_parameter == "uri_query_parameter_value" @pytest.mark.asyncio -async def test_create_channel_group_async_from_dict(): - await test_create_channel_group_async(request_type=dict) +async def test_get_enhanced_measurement_settings_async_from_dict(): + await test_get_enhanced_measurement_settings_async(request_type=dict) -def test_create_channel_group_field_headers(): +def test_get_enhanced_measurement_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateChannelGroupRequest() + request = analytics_admin.GetEnhancedMeasurementSettingsRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_channel_group), "__call__" + type(client.transport.get_enhanced_measurement_settings), "__call__" ) as call: - call.return_value = gaa_channel_group.ChannelGroup() - client.create_channel_group(request) + call.return_value = resources.EnhancedMeasurementSettings() + client.get_enhanced_measurement_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -30132,30 +29538,30 @@ def test_create_channel_group_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_create_channel_group_field_headers_async(): +async def test_get_enhanced_measurement_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateChannelGroupRequest() + request = analytics_admin.GetEnhancedMeasurementSettingsRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_channel_group), "__call__" + type(client.transport.get_enhanced_measurement_settings), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_channel_group.ChannelGroup() + resources.EnhancedMeasurementSettings() ) - await client.create_channel_group(request) + await client.get_enhanced_measurement_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -30166,41 +29572,37 @@ async def test_create_channel_group_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_create_channel_group_flattened(): +def test_get_enhanced_measurement_settings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_channel_group), "__call__" + type(client.transport.get_enhanced_measurement_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_channel_group.ChannelGroup() + call.return_value = resources.EnhancedMeasurementSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_channel_group( - parent="parent_value", - channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + client.get_enhanced_measurement_settings( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].channel_group - mock_val = gaa_channel_group.ChannelGroup(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_create_channel_group_flattened_error(): +def test_get_enhanced_measurement_settings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -30208,50 +29610,45 @@ def test_create_channel_group_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_channel_group( - analytics_admin.CreateChannelGroupRequest(), - parent="parent_value", - channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + client.get_enhanced_measurement_settings( + analytics_admin.GetEnhancedMeasurementSettingsRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_create_channel_group_flattened_async(): +async def test_get_enhanced_measurement_settings_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_channel_group), "__call__" + type(client.transport.get_enhanced_measurement_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_channel_group.ChannelGroup() + call.return_value = resources.EnhancedMeasurementSettings() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_channel_group.ChannelGroup() + resources.EnhancedMeasurementSettings() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_channel_group( - parent="parent_value", - channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + response = await client.get_enhanced_measurement_settings( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].channel_group - mock_val = gaa_channel_group.ChannelGroup(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_create_channel_group_flattened_error_async(): +async def test_get_enhanced_measurement_settings_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -30259,21 +29656,20 @@ async def test_create_channel_group_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_channel_group( - analytics_admin.CreateChannelGroupRequest(), - parent="parent_value", - channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + await client.get_enhanced_measurement_settings( + analytics_admin.GetEnhancedMeasurementSettingsRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateChannelGroupRequest, + analytics_admin.UpdateEnhancedMeasurementSettingsRequest, dict, ], ) -def test_update_channel_group(request_type, transport: str = "grpc"): +def test_update_enhanced_measurement_settings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -30285,31 +29681,45 @@ def test_update_channel_group(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_channel_group), "__call__" + type(client.transport.update_enhanced_measurement_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_channel_group.ChannelGroup( + call.return_value = resources.EnhancedMeasurementSettings( name="name_value", - display_name="display_name_value", - description="description_value", - system_defined=True, + stream_enabled=True, + scrolls_enabled=True, + outbound_clicks_enabled=True, + site_search_enabled=True, + video_engagement_enabled=True, + file_downloads_enabled=True, + page_changes_enabled=True, + form_interactions_enabled=True, + search_query_parameter="search_query_parameter_value", + uri_query_parameter="uri_query_parameter_value", ) - response = client.update_channel_group(request) + response = client.update_enhanced_measurement_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateChannelGroupRequest() + assert args[0] == analytics_admin.UpdateEnhancedMeasurementSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, gaa_channel_group.ChannelGroup) + assert isinstance(response, resources.EnhancedMeasurementSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.system_defined is True + assert response.stream_enabled is True + assert response.scrolls_enabled is True + assert response.outbound_clicks_enabled is True + assert response.site_search_enabled is True + assert response.video_engagement_enabled is True + assert response.file_downloads_enabled is True + assert response.page_changes_enabled is True + assert response.form_interactions_enabled is True + assert response.search_query_parameter == "search_query_parameter_value" + assert response.uri_query_parameter == "uri_query_parameter_value" -def test_update_channel_group_empty_call(): +def test_update_enhanced_measurement_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -30319,18 +29729,18 @@ def test_update_channel_group_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_channel_group), "__call__" + type(client.transport.update_enhanced_measurement_settings), "__call__" ) as call: - client.update_channel_group() + client.update_enhanced_measurement_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateChannelGroupRequest() + assert args[0] == analytics_admin.UpdateEnhancedMeasurementSettingsRequest() @pytest.mark.asyncio -async def test_update_channel_group_async( +async def test_update_enhanced_measurement_settings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateChannelGroupRequest, + request_type=analytics_admin.UpdateEnhancedMeasurementSettingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -30343,54 +29753,68 @@ async def test_update_channel_group_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_channel_group), "__call__" + type(client.transport.update_enhanced_measurement_settings), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_channel_group.ChannelGroup( + resources.EnhancedMeasurementSettings( name="name_value", - display_name="display_name_value", - description="description_value", - system_defined=True, + stream_enabled=True, + scrolls_enabled=True, + outbound_clicks_enabled=True, + site_search_enabled=True, + video_engagement_enabled=True, + file_downloads_enabled=True, + page_changes_enabled=True, + form_interactions_enabled=True, + search_query_parameter="search_query_parameter_value", + uri_query_parameter="uri_query_parameter_value", ) ) - response = await client.update_channel_group(request) + response = await client.update_enhanced_measurement_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateChannelGroupRequest() + assert args[0] == analytics_admin.UpdateEnhancedMeasurementSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, gaa_channel_group.ChannelGroup) + assert isinstance(response, resources.EnhancedMeasurementSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.system_defined is True + assert response.stream_enabled is True + assert response.scrolls_enabled is True + assert response.outbound_clicks_enabled is True + assert response.site_search_enabled is True + assert response.video_engagement_enabled is True + assert response.file_downloads_enabled is True + assert response.page_changes_enabled is True + assert response.form_interactions_enabled is True + assert response.search_query_parameter == "search_query_parameter_value" + assert response.uri_query_parameter == "uri_query_parameter_value" @pytest.mark.asyncio -async def test_update_channel_group_async_from_dict(): - await test_update_channel_group_async(request_type=dict) +async def test_update_enhanced_measurement_settings_async_from_dict(): + await test_update_enhanced_measurement_settings_async(request_type=dict) -def test_update_channel_group_field_headers(): +def test_update_enhanced_measurement_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateChannelGroupRequest() + request = analytics_admin.UpdateEnhancedMeasurementSettingsRequest() - request.channel_group.name = "name_value" + request.enhanced_measurement_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_channel_group), "__call__" + type(client.transport.update_enhanced_measurement_settings), "__call__" ) as call: - call.return_value = gaa_channel_group.ChannelGroup() - client.update_channel_group(request) + call.return_value = resources.EnhancedMeasurementSettings() + client.update_enhanced_measurement_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -30401,30 +29825,30 @@ def test_update_channel_group_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "channel_group.name=name_value", + "enhanced_measurement_settings.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_channel_group_field_headers_async(): +async def test_update_enhanced_measurement_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateChannelGroupRequest() + request = analytics_admin.UpdateEnhancedMeasurementSettingsRequest() - request.channel_group.name = "name_value" + request.enhanced_measurement_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_channel_group), "__call__" + type(client.transport.update_enhanced_measurement_settings), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_channel_group.ChannelGroup() + resources.EnhancedMeasurementSettings() ) - await client.update_channel_group(request) + await client.update_enhanced_measurement_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -30435,25 +29859,27 @@ async def test_update_channel_group_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "channel_group.name=name_value", + "enhanced_measurement_settings.name=name_value", ) in kw["metadata"] -def test_update_channel_group_flattened(): +def test_update_enhanced_measurement_settings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_channel_group), "__call__" + type(client.transport.update_enhanced_measurement_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_channel_group.ChannelGroup() + call.return_value = resources.EnhancedMeasurementSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_channel_group( - channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + client.update_enhanced_measurement_settings( + enhanced_measurement_settings=resources.EnhancedMeasurementSettings( + name="name_value" + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -30461,15 +29887,15 @@ def test_update_channel_group_flattened(): # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].channel_group - mock_val = gaa_channel_group.ChannelGroup(name="name_value") + arg = args[0].enhanced_measurement_settings + mock_val = resources.EnhancedMeasurementSettings(name="name_value") assert arg == mock_val arg = args[0].update_mask mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_update_channel_group_flattened_error(): +def test_update_enhanced_measurement_settings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -30477,33 +29903,37 @@ def test_update_channel_group_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_channel_group( - analytics_admin.UpdateChannelGroupRequest(), - channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + client.update_enhanced_measurement_settings( + analytics_admin.UpdateEnhancedMeasurementSettingsRequest(), + enhanced_measurement_settings=resources.EnhancedMeasurementSettings( + name="name_value" + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_update_channel_group_flattened_async(): +async def test_update_enhanced_measurement_settings_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_channel_group), "__call__" + type(client.transport.update_enhanced_measurement_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = gaa_channel_group.ChannelGroup() + call.return_value = resources.EnhancedMeasurementSettings() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - gaa_channel_group.ChannelGroup() + resources.EnhancedMeasurementSettings() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_channel_group( - channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + response = await client.update_enhanced_measurement_settings( + enhanced_measurement_settings=resources.EnhancedMeasurementSettings( + name="name_value" + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -30511,8 +29941,8 @@ async def test_update_channel_group_flattened_async(): # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].channel_group - mock_val = gaa_channel_group.ChannelGroup(name="name_value") + arg = args[0].enhanced_measurement_settings + mock_val = resources.EnhancedMeasurementSettings(name="name_value") assert arg == mock_val arg = args[0].update_mask mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) @@ -30520,7 +29950,7 @@ async def test_update_channel_group_flattened_async(): @pytest.mark.asyncio -async def test_update_channel_group_flattened_error_async(): +async def test_update_enhanced_measurement_settings_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -30528,9 +29958,11 @@ async def test_update_channel_group_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_channel_group( - analytics_admin.UpdateChannelGroupRequest(), - channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + await client.update_enhanced_measurement_settings( + analytics_admin.UpdateEnhancedMeasurementSettingsRequest(), + enhanced_measurement_settings=resources.EnhancedMeasurementSettings( + name="name_value" + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -30538,11 +29970,11 @@ async def test_update_channel_group_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteChannelGroupRequest, + analytics_admin.CreateConnectedSiteTagRequest, dict, ], ) -def test_delete_channel_group(request_type, transport: str = "grpc"): +def test_create_connected_site_tag(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -30554,22 +29986,22 @@ def test_delete_channel_group(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_channel_group), "__call__" + type(client.transport.create_connected_site_tag), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_channel_group(request) + call.return_value = analytics_admin.CreateConnectedSiteTagResponse() + response = client.create_connected_site_tag(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteChannelGroupRequest() + assert args[0] == analytics_admin.CreateConnectedSiteTagRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, analytics_admin.CreateConnectedSiteTagResponse) -def test_delete_channel_group_empty_call(): +def test_create_connected_site_tag_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -30579,18 +30011,18 @@ def test_delete_channel_group_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_channel_group), "__call__" + type(client.transport.create_connected_site_tag), "__call__" ) as call: - client.delete_channel_group() + client.create_connected_site_tag() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteChannelGroupRequest() + assert args[0] == analytics_admin.CreateConnectedSiteTagRequest() @pytest.mark.asyncio -async def test_delete_channel_group_async( +async def test_create_connected_site_tag_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteChannelGroupRequest, + request_type=analytics_admin.CreateConnectedSiteTagRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -30603,181 +30035,124 @@ async def test_delete_channel_group_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_channel_group), "__call__" + type(client.transport.create_connected_site_tag), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_channel_group(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.CreateConnectedSiteTagResponse() + ) + response = await client.create_connected_site_tag(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteChannelGroupRequest() + assert args[0] == analytics_admin.CreateConnectedSiteTagRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, analytics_admin.CreateConnectedSiteTagResponse) @pytest.mark.asyncio -async def test_delete_channel_group_async_from_dict(): - await test_delete_channel_group_async(request_type=dict) +async def test_create_connected_site_tag_async_from_dict(): + await test_create_connected_site_tag_async(request_type=dict) -def test_delete_channel_group_field_headers(): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteConnectedSiteTagRequest, + dict, + ], +) +def test_delete_connected_site_tag(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteChannelGroupRequest() - - request.name = "name_value" + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_channel_group), "__call__" + type(client.transport.delete_connected_site_tag), "__call__" ) as call: + # Designate an appropriate return value for the call. call.return_value = None - client.delete_channel_group(request) + response = client.delete_connected_site_tag(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_delete_channel_group_field_headers_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteChannelGroupRequest() - - request.name = "name_value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_channel_group), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_channel_group(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request + assert args[0] == analytics_admin.DeleteConnectedSiteTagRequest() - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "name=name_value", - ) in kw["metadata"] + # Establish that the response is the type that we expect. + assert response is None -def test_delete_channel_group_flattened(): +def test_delete_connected_site_tag_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_channel_group), "__call__" + type(client.transport.delete_connected_site_tag), "__call__" ) as call: - # Designate an appropriate return value for the call. - call.return_value = None - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.delete_channel_group( - name="name_value", - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 + client.delete_connected_site_tag() + call.assert_called() _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val - - -def test_delete_channel_group_flattened_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_channel_group( - analytics_admin.DeleteChannelGroupRequest(), - name="name_value", - ) + assert args[0] == analytics_admin.DeleteConnectedSiteTagRequest() @pytest.mark.asyncio -async def test_delete_channel_group_flattened_async(): +async def test_delete_connected_site_tag_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.DeleteConnectedSiteTagRequest, +): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_channel_group), "__call__" + type(client.transport.delete_connected_site_tag), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.delete_channel_group( - name="name_value", - ) + response = await client.delete_connected_site_tag(request) - # Establish that the underlying call was made with the expected - # request object values. + # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" - assert arg == mock_val + assert args[0] == analytics_admin.DeleteConnectedSiteTagRequest() + # Establish that the response is the type that we expect. + assert response is None -@pytest.mark.asyncio -async def test_delete_channel_group_flattened_error_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.delete_channel_group( - analytics_admin.DeleteChannelGroupRequest(), - name="name_value", - ) +@pytest.mark.asyncio +async def test_delete_connected_site_tag_async_from_dict(): + await test_delete_connected_site_tag_async(request_type=dict) @pytest.mark.parametrize( "request_type", [ - analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, + analytics_admin.ListConnectedSiteTagsRequest, dict, ], ) -def test_set_automated_ga4_configuration_opt_out(request_type, transport: str = "grpc"): +def test_list_connected_site_tags(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -30789,24 +30164,22 @@ def test_set_automated_ga4_configuration_opt_out(request_type, transport: str = # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.set_automated_ga4_configuration_opt_out), "__call__" + type(client.transport.list_connected_site_tags), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse() - response = client.set_automated_ga4_configuration_opt_out(request) + call.return_value = analytics_admin.ListConnectedSiteTagsResponse() + response = client.list_connected_site_tags(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest() + assert args[0] == analytics_admin.ListConnectedSiteTagsRequest() # Establish that the response is the type that we expect. - assert isinstance( - response, analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse - ) + assert isinstance(response, analytics_admin.ListConnectedSiteTagsResponse) -def test_set_automated_ga4_configuration_opt_out_empty_call(): +def test_list_connected_site_tags_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -30816,18 +30189,18 @@ def test_set_automated_ga4_configuration_opt_out_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.set_automated_ga4_configuration_opt_out), "__call__" + type(client.transport.list_connected_site_tags), "__call__" ) as call: - client.set_automated_ga4_configuration_opt_out() + client.list_connected_site_tags() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest() + assert args[0] == analytics_admin.ListConnectedSiteTagsRequest() @pytest.mark.asyncio -async def test_set_automated_ga4_configuration_opt_out_async( +async def test_list_connected_site_tags_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, + request_type=analytics_admin.ListConnectedSiteTagsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -30840,40 +30213,36 @@ async def test_set_automated_ga4_configuration_opt_out_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.set_automated_ga4_configuration_opt_out), "__call__" + type(client.transport.list_connected_site_tags), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse() + analytics_admin.ListConnectedSiteTagsResponse() ) - response = await client.set_automated_ga4_configuration_opt_out(request) + response = await client.list_connected_site_tags(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest() + assert args[0] == analytics_admin.ListConnectedSiteTagsRequest() # Establish that the response is the type that we expect. - assert isinstance( - response, analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse - ) + assert isinstance(response, analytics_admin.ListConnectedSiteTagsResponse) @pytest.mark.asyncio -async def test_set_automated_ga4_configuration_opt_out_async_from_dict(): - await test_set_automated_ga4_configuration_opt_out_async(request_type=dict) +async def test_list_connected_site_tags_async_from_dict(): + await test_list_connected_site_tags_async(request_type=dict) @pytest.mark.parametrize( "request_type", [ - analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, + analytics_admin.FetchConnectedGa4PropertyRequest, dict, ], ) -def test_fetch_automated_ga4_configuration_opt_out( - request_type, transport: str = "grpc" -): +def test_fetch_connected_ga4_property(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -30885,29 +30254,25 @@ def test_fetch_automated_ga4_configuration_opt_out( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_automated_ga4_configuration_opt_out), "__call__" + type(client.transport.fetch_connected_ga4_property), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = ( - analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse( - opt_out=True, - ) + call.return_value = analytics_admin.FetchConnectedGa4PropertyResponse( + property="property_value", ) - response = client.fetch_automated_ga4_configuration_opt_out(request) + response = client.fetch_connected_ga4_property(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest() + assert args[0] == analytics_admin.FetchConnectedGa4PropertyRequest() # Establish that the response is the type that we expect. - assert isinstance( - response, analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse - ) - assert response.opt_out is True + assert isinstance(response, analytics_admin.FetchConnectedGa4PropertyResponse) + assert response.property == "property_value" -def test_fetch_automated_ga4_configuration_opt_out_empty_call(): +def test_fetch_connected_ga4_property_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -30917,18 +30282,18 @@ def test_fetch_automated_ga4_configuration_opt_out_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_automated_ga4_configuration_opt_out), "__call__" + type(client.transport.fetch_connected_ga4_property), "__call__" ) as call: - client.fetch_automated_ga4_configuration_opt_out() + client.fetch_connected_ga4_property() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest() + assert args[0] == analytics_admin.FetchConnectedGa4PropertyRequest() @pytest.mark.asyncio -async def test_fetch_automated_ga4_configuration_opt_out_async( +async def test_fetch_connected_ga4_property_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, + request_type=analytics_admin.FetchConnectedGa4PropertyRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -30941,41 +30306,39 @@ async def test_fetch_automated_ga4_configuration_opt_out_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.fetch_automated_ga4_configuration_opt_out), "__call__" + type(client.transport.fetch_connected_ga4_property), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse( - opt_out=True, + analytics_admin.FetchConnectedGa4PropertyResponse( + property="property_value", ) ) - response = await client.fetch_automated_ga4_configuration_opt_out(request) + response = await client.fetch_connected_ga4_property(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest() + assert args[0] == analytics_admin.FetchConnectedGa4PropertyRequest() # Establish that the response is the type that we expect. - assert isinstance( - response, analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse - ) - assert response.opt_out is True + assert isinstance(response, analytics_admin.FetchConnectedGa4PropertyResponse) + assert response.property == "property_value" @pytest.mark.asyncio -async def test_fetch_automated_ga4_configuration_opt_out_async_from_dict(): - await test_fetch_automated_ga4_configuration_opt_out_async(request_type=dict) +async def test_fetch_connected_ga4_property_async_from_dict(): + await test_fetch_connected_ga4_property_async(request_type=dict) @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetBigQueryLinkRequest, + analytics_admin.GetAdSenseLinkRequest, dict, ], ) -def test_get_big_query_link(request_type, transport: str = "grpc"): +def test_get_ad_sense_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -30987,39 +30350,27 @@ def test_get_big_query_link(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_big_query_link), "__call__" + type(client.transport.get_ad_sense_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.BigQueryLink( + call.return_value = resources.AdSenseLink( name="name_value", - project="project_value", - daily_export_enabled=True, - streaming_export_enabled=True, - fresh_daily_export_enabled=True, - include_advertising_id=True, - export_streams=["export_streams_value"], - excluded_events=["excluded_events_value"], + ad_client_code="ad_client_code_value", ) - response = client.get_big_query_link(request) + response = client.get_ad_sense_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetBigQueryLinkRequest() + assert args[0] == analytics_admin.GetAdSenseLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.BigQueryLink) + assert isinstance(response, resources.AdSenseLink) assert response.name == "name_value" - assert response.project == "project_value" - assert response.daily_export_enabled is True - assert response.streaming_export_enabled is True - assert response.fresh_daily_export_enabled is True - assert response.include_advertising_id is True - assert response.export_streams == ["export_streams_value"] - assert response.excluded_events == ["excluded_events_value"] + assert response.ad_client_code == "ad_client_code_value" -def test_get_big_query_link_empty_call(): +def test_get_ad_sense_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -31029,17 +30380,17 @@ def test_get_big_query_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_big_query_link), "__call__" + type(client.transport.get_ad_sense_link), "__call__" ) as call: - client.get_big_query_link() + client.get_ad_sense_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetBigQueryLinkRequest() + assert args[0] == analytics_admin.GetAdSenseLinkRequest() @pytest.mark.asyncio -async def test_get_big_query_link_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetBigQueryLinkRequest +async def test_get_ad_sense_link_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.GetAdSenseLinkRequest ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -31052,62 +30403,50 @@ async def test_get_big_query_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_big_query_link), "__call__" + type(client.transport.get_ad_sense_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.BigQueryLink( + resources.AdSenseLink( name="name_value", - project="project_value", - daily_export_enabled=True, - streaming_export_enabled=True, - fresh_daily_export_enabled=True, - include_advertising_id=True, - export_streams=["export_streams_value"], - excluded_events=["excluded_events_value"], + ad_client_code="ad_client_code_value", ) ) - response = await client.get_big_query_link(request) + response = await client.get_ad_sense_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetBigQueryLinkRequest() + assert args[0] == analytics_admin.GetAdSenseLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.BigQueryLink) + assert isinstance(response, resources.AdSenseLink) assert response.name == "name_value" - assert response.project == "project_value" - assert response.daily_export_enabled is True - assert response.streaming_export_enabled is True - assert response.fresh_daily_export_enabled is True - assert response.include_advertising_id is True - assert response.export_streams == ["export_streams_value"] - assert response.excluded_events == ["excluded_events_value"] + assert response.ad_client_code == "ad_client_code_value" @pytest.mark.asyncio -async def test_get_big_query_link_async_from_dict(): - await test_get_big_query_link_async(request_type=dict) +async def test_get_ad_sense_link_async_from_dict(): + await test_get_ad_sense_link_async(request_type=dict) -def test_get_big_query_link_field_headers(): +def test_get_ad_sense_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetBigQueryLinkRequest() + request = analytics_admin.GetAdSenseLinkRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_big_query_link), "__call__" + type(client.transport.get_ad_sense_link), "__call__" ) as call: - call.return_value = resources.BigQueryLink() - client.get_big_query_link(request) + call.return_value = resources.AdSenseLink() + client.get_ad_sense_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -31123,25 +30462,25 @@ def test_get_big_query_link_field_headers(): @pytest.mark.asyncio -async def test_get_big_query_link_field_headers_async(): +async def test_get_ad_sense_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetBigQueryLinkRequest() + request = analytics_admin.GetAdSenseLinkRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_big_query_link), "__call__" + type(client.transport.get_ad_sense_link), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.BigQueryLink() + resources.AdSenseLink() ) - await client.get_big_query_link(request) + await client.get_ad_sense_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -31156,20 +30495,20 @@ async def test_get_big_query_link_field_headers_async(): ) in kw["metadata"] -def test_get_big_query_link_flattened(): +def test_get_ad_sense_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_big_query_link), "__call__" + type(client.transport.get_ad_sense_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.BigQueryLink() + call.return_value = resources.AdSenseLink() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_big_query_link( + client.get_ad_sense_link( name="name_value", ) @@ -31182,7 +30521,7 @@ def test_get_big_query_link_flattened(): assert arg == mock_val -def test_get_big_query_link_flattened_error(): +def test_get_ad_sense_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -31190,31 +30529,31 @@ def test_get_big_query_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_big_query_link( - analytics_admin.GetBigQueryLinkRequest(), + client.get_ad_sense_link( + analytics_admin.GetAdSenseLinkRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_get_big_query_link_flattened_async(): +async def test_get_ad_sense_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_big_query_link), "__call__" + type(client.transport.get_ad_sense_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.BigQueryLink() + call.return_value = resources.AdSenseLink() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.BigQueryLink() + resources.AdSenseLink() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_big_query_link( + response = await client.get_ad_sense_link( name="name_value", ) @@ -31228,7 +30567,7 @@ async def test_get_big_query_link_flattened_async(): @pytest.mark.asyncio -async def test_get_big_query_link_flattened_error_async(): +async def test_get_ad_sense_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -31236,8 +30575,8 @@ async def test_get_big_query_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_big_query_link( - analytics_admin.GetBigQueryLinkRequest(), + await client.get_ad_sense_link( + analytics_admin.GetAdSenseLinkRequest(), name="name_value", ) @@ -31245,11 +30584,11 @@ async def test_get_big_query_link_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListBigQueryLinksRequest, + analytics_admin.CreateAdSenseLinkRequest, dict, ], ) -def test_list_big_query_links(request_type, transport: str = "grpc"): +def test_create_ad_sense_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -31261,25 +30600,27 @@ def test_list_big_query_links(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_big_query_links), "__call__" + type(client.transport.create_ad_sense_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListBigQueryLinksResponse( - next_page_token="next_page_token_value", + call.return_value = resources.AdSenseLink( + name="name_value", + ad_client_code="ad_client_code_value", ) - response = client.list_big_query_links(request) + response = client.create_ad_sense_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListBigQueryLinksRequest() + assert args[0] == analytics_admin.CreateAdSenseLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListBigQueryLinksPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.AdSenseLink) + assert response.name == "name_value" + assert response.ad_client_code == "ad_client_code_value" -def test_list_big_query_links_empty_call(): +def test_create_ad_sense_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -31289,18 +30630,18 @@ def test_list_big_query_links_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_big_query_links), "__call__" + type(client.transport.create_ad_sense_link), "__call__" ) as call: - client.list_big_query_links() + client.create_ad_sense_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListBigQueryLinksRequest() + assert args[0] == analytics_admin.CreateAdSenseLinkRequest() @pytest.mark.asyncio -async def test_list_big_query_links_async( +async def test_create_ad_sense_link_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListBigQueryLinksRequest, + request_type=analytics_admin.CreateAdSenseLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -31313,48 +30654,50 @@ async def test_list_big_query_links_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_big_query_links), "__call__" + type(client.transport.create_ad_sense_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListBigQueryLinksResponse( - next_page_token="next_page_token_value", + resources.AdSenseLink( + name="name_value", + ad_client_code="ad_client_code_value", ) ) - response = await client.list_big_query_links(request) + response = await client.create_ad_sense_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListBigQueryLinksRequest() + assert args[0] == analytics_admin.CreateAdSenseLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListBigQueryLinksAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.AdSenseLink) + assert response.name == "name_value" + assert response.ad_client_code == "ad_client_code_value" @pytest.mark.asyncio -async def test_list_big_query_links_async_from_dict(): - await test_list_big_query_links_async(request_type=dict) +async def test_create_ad_sense_link_async_from_dict(): + await test_create_ad_sense_link_async(request_type=dict) -def test_list_big_query_links_field_headers(): +def test_create_ad_sense_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListBigQueryLinksRequest() + request = analytics_admin.CreateAdSenseLinkRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_big_query_links), "__call__" + type(client.transport.create_ad_sense_link), "__call__" ) as call: - call.return_value = analytics_admin.ListBigQueryLinksResponse() - client.list_big_query_links(request) + call.return_value = resources.AdSenseLink() + client.create_ad_sense_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -31370,25 +30713,25 @@ def test_list_big_query_links_field_headers(): @pytest.mark.asyncio -async def test_list_big_query_links_field_headers_async(): +async def test_create_ad_sense_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListBigQueryLinksRequest() + request = analytics_admin.CreateAdSenseLinkRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_big_query_links), "__call__" + type(client.transport.create_ad_sense_link), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListBigQueryLinksResponse() + resources.AdSenseLink() ) - await client.list_big_query_links(request) + await client.create_ad_sense_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -31403,21 +30746,22 @@ async def test_list_big_query_links_field_headers_async(): ) in kw["metadata"] -def test_list_big_query_links_flattened(): +def test_create_ad_sense_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_big_query_links), "__call__" + type(client.transport.create_ad_sense_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListBigQueryLinksResponse() + call.return_value = resources.AdSenseLink() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_big_query_links( + client.create_ad_sense_link( parent="parent_value", + adsense_link=resources.AdSenseLink(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -31427,9 +30771,12 @@ def test_list_big_query_links_flattened(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val + arg = args[0].adsense_link + mock_val = resources.AdSenseLink(name="name_value") + assert arg == mock_val -def test_list_big_query_links_flattened_error(): +def test_create_ad_sense_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -31437,32 +30784,34 @@ def test_list_big_query_links_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_big_query_links( - analytics_admin.ListBigQueryLinksRequest(), + client.create_ad_sense_link( + analytics_admin.CreateAdSenseLinkRequest(), parent="parent_value", + adsense_link=resources.AdSenseLink(name="name_value"), ) @pytest.mark.asyncio -async def test_list_big_query_links_flattened_async(): +async def test_create_ad_sense_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_big_query_links), "__call__" + type(client.transport.create_ad_sense_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListBigQueryLinksResponse() + call.return_value = resources.AdSenseLink() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListBigQueryLinksResponse() + resources.AdSenseLink() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_big_query_links( + response = await client.create_ad_sense_link( parent="parent_value", + adsense_link=resources.AdSenseLink(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -31472,10 +30821,13 @@ async def test_list_big_query_links_flattened_async(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val + arg = args[0].adsense_link + mock_val = resources.AdSenseLink(name="name_value") + assert arg == mock_val @pytest.mark.asyncio -async def test_list_big_query_links_flattened_error_async(): +async def test_create_ad_sense_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -31483,218 +30835,21 @@ async def test_list_big_query_links_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_big_query_links( - analytics_admin.ListBigQueryLinksRequest(), + await client.create_ad_sense_link( + analytics_admin.CreateAdSenseLinkRequest(), parent="parent_value", + adsense_link=resources.AdSenseLink(name="name_value"), ) -def test_list_big_query_links_pager(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_big_query_links), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - resources.BigQueryLink(), - resources.BigQueryLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[], - next_page_token="def", - ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - resources.BigQueryLink(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_big_query_links(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.BigQueryLink) for i in results) - - -def test_list_big_query_links_pages(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_big_query_links), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - resources.BigQueryLink(), - resources.BigQueryLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[], - next_page_token="def", - ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - resources.BigQueryLink(), - ], - ), - RuntimeError, - ) - pages = list(client.list_big_query_links(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_big_query_links_async_pager(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_big_query_links), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - resources.BigQueryLink(), - resources.BigQueryLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[], - next_page_token="def", - ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - resources.BigQueryLink(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_big_query_links( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.BigQueryLink) for i in responses) - - -@pytest.mark.asyncio -async def test_list_big_query_links_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_big_query_links), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - resources.BigQueryLink(), - resources.BigQueryLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[], - next_page_token="def", - ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - resources.BigQueryLink(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_big_query_links(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetEnhancedMeasurementSettingsRequest, + analytics_admin.DeleteAdSenseLinkRequest, dict, ], ) -def test_get_enhanced_measurement_settings(request_type, transport: str = "grpc"): +def test_delete_ad_sense_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -31706,45 +30861,22 @@ def test_get_enhanced_measurement_settings(request_type, transport: str = "grpc" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_enhanced_measurement_settings), "__call__" + type(client.transport.delete_ad_sense_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.EnhancedMeasurementSettings( - name="name_value", - stream_enabled=True, - scrolls_enabled=True, - outbound_clicks_enabled=True, - site_search_enabled=True, - video_engagement_enabled=True, - file_downloads_enabled=True, - page_changes_enabled=True, - form_interactions_enabled=True, - search_query_parameter="search_query_parameter_value", - uri_query_parameter="uri_query_parameter_value", - ) - response = client.get_enhanced_measurement_settings(request) + call.return_value = None + response = client.delete_ad_sense_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetEnhancedMeasurementSettingsRequest() + assert args[0] == analytics_admin.DeleteAdSenseLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.EnhancedMeasurementSettings) - assert response.name == "name_value" - assert response.stream_enabled is True - assert response.scrolls_enabled is True - assert response.outbound_clicks_enabled is True - assert response.site_search_enabled is True - assert response.video_engagement_enabled is True - assert response.file_downloads_enabled is True - assert response.page_changes_enabled is True - assert response.form_interactions_enabled is True - assert response.search_query_parameter == "search_query_parameter_value" - assert response.uri_query_parameter == "uri_query_parameter_value" + assert response is None -def test_get_enhanced_measurement_settings_empty_call(): +def test_delete_ad_sense_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -31754,18 +30886,18 @@ def test_get_enhanced_measurement_settings_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_enhanced_measurement_settings), "__call__" + type(client.transport.delete_ad_sense_link), "__call__" ) as call: - client.get_enhanced_measurement_settings() + client.delete_ad_sense_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetEnhancedMeasurementSettingsRequest() + assert args[0] == analytics_admin.DeleteAdSenseLinkRequest() @pytest.mark.asyncio -async def test_get_enhanced_measurement_settings_async( +async def test_delete_ad_sense_link_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetEnhancedMeasurementSettingsRequest, + request_type=analytics_admin.DeleteAdSenseLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -31778,68 +30910,43 @@ async def test_get_enhanced_measurement_settings_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_enhanced_measurement_settings), "__call__" + type(client.transport.delete_ad_sense_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.EnhancedMeasurementSettings( - name="name_value", - stream_enabled=True, - scrolls_enabled=True, - outbound_clicks_enabled=True, - site_search_enabled=True, - video_engagement_enabled=True, - file_downloads_enabled=True, - page_changes_enabled=True, - form_interactions_enabled=True, - search_query_parameter="search_query_parameter_value", - uri_query_parameter="uri_query_parameter_value", - ) - ) - response = await client.get_enhanced_measurement_settings(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_ad_sense_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetEnhancedMeasurementSettingsRequest() + assert args[0] == analytics_admin.DeleteAdSenseLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.EnhancedMeasurementSettings) - assert response.name == "name_value" - assert response.stream_enabled is True - assert response.scrolls_enabled is True - assert response.outbound_clicks_enabled is True - assert response.site_search_enabled is True - assert response.video_engagement_enabled is True - assert response.file_downloads_enabled is True - assert response.page_changes_enabled is True - assert response.form_interactions_enabled is True - assert response.search_query_parameter == "search_query_parameter_value" - assert response.uri_query_parameter == "uri_query_parameter_value" + assert response is None @pytest.mark.asyncio -async def test_get_enhanced_measurement_settings_async_from_dict(): - await test_get_enhanced_measurement_settings_async(request_type=dict) +async def test_delete_ad_sense_link_async_from_dict(): + await test_delete_ad_sense_link_async(request_type=dict) -def test_get_enhanced_measurement_settings_field_headers(): +def test_delete_ad_sense_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetEnhancedMeasurementSettingsRequest() + request = analytics_admin.DeleteAdSenseLinkRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_enhanced_measurement_settings), "__call__" + type(client.transport.delete_ad_sense_link), "__call__" ) as call: - call.return_value = resources.EnhancedMeasurementSettings() - client.get_enhanced_measurement_settings(request) + call.return_value = None + client.delete_ad_sense_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -31855,25 +30962,23 @@ def test_get_enhanced_measurement_settings_field_headers(): @pytest.mark.asyncio -async def test_get_enhanced_measurement_settings_field_headers_async(): +async def test_delete_ad_sense_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetEnhancedMeasurementSettingsRequest() + request = analytics_admin.DeleteAdSenseLinkRequest() request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_enhanced_measurement_settings), "__call__" + type(client.transport.delete_ad_sense_link), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.EnhancedMeasurementSettings() - ) - await client.get_enhanced_measurement_settings(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_ad_sense_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -31888,20 +30993,20 @@ async def test_get_enhanced_measurement_settings_field_headers_async(): ) in kw["metadata"] -def test_get_enhanced_measurement_settings_flattened(): +def test_delete_ad_sense_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_enhanced_measurement_settings), "__call__" + type(client.transport.delete_ad_sense_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.EnhancedMeasurementSettings() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_enhanced_measurement_settings( + client.delete_ad_sense_link( name="name_value", ) @@ -31914,7 +31019,7 @@ def test_get_enhanced_measurement_settings_flattened(): assert arg == mock_val -def test_get_enhanced_measurement_settings_flattened_error(): +def test_delete_ad_sense_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -31922,31 +31027,29 @@ def test_get_enhanced_measurement_settings_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_enhanced_measurement_settings( - analytics_admin.GetEnhancedMeasurementSettingsRequest(), + client.delete_ad_sense_link( + analytics_admin.DeleteAdSenseLinkRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_get_enhanced_measurement_settings_flattened_async(): +async def test_delete_ad_sense_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_enhanced_measurement_settings), "__call__" + type(client.transport.delete_ad_sense_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.EnhancedMeasurementSettings() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.EnhancedMeasurementSettings() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_enhanced_measurement_settings( + response = await client.delete_ad_sense_link( name="name_value", ) @@ -31960,7 +31063,7 @@ async def test_get_enhanced_measurement_settings_flattened_async(): @pytest.mark.asyncio -async def test_get_enhanced_measurement_settings_flattened_error_async(): +async def test_delete_ad_sense_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -31968,8 +31071,8 @@ async def test_get_enhanced_measurement_settings_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_enhanced_measurement_settings( - analytics_admin.GetEnhancedMeasurementSettingsRequest(), + await client.delete_ad_sense_link( + analytics_admin.DeleteAdSenseLinkRequest(), name="name_value", ) @@ -31977,11 +31080,11 @@ async def test_get_enhanced_measurement_settings_flattened_error_async(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateEnhancedMeasurementSettingsRequest, + analytics_admin.ListAdSenseLinksRequest, dict, ], ) -def test_update_enhanced_measurement_settings(request_type, transport: str = "grpc"): +def test_list_ad_sense_links(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -31993,45 +31096,25 @@ def test_update_enhanced_measurement_settings(request_type, transport: str = "gr # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_enhanced_measurement_settings), "__call__" + type(client.transport.list_ad_sense_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.EnhancedMeasurementSettings( - name="name_value", - stream_enabled=True, - scrolls_enabled=True, - outbound_clicks_enabled=True, - site_search_enabled=True, - video_engagement_enabled=True, - file_downloads_enabled=True, - page_changes_enabled=True, - form_interactions_enabled=True, - search_query_parameter="search_query_parameter_value", - uri_query_parameter="uri_query_parameter_value", + call.return_value = analytics_admin.ListAdSenseLinksResponse( + next_page_token="next_page_token_value", ) - response = client.update_enhanced_measurement_settings(request) + response = client.list_ad_sense_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateEnhancedMeasurementSettingsRequest() + assert args[0] == analytics_admin.ListAdSenseLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.EnhancedMeasurementSettings) - assert response.name == "name_value" - assert response.stream_enabled is True - assert response.scrolls_enabled is True - assert response.outbound_clicks_enabled is True - assert response.site_search_enabled is True - assert response.video_engagement_enabled is True - assert response.file_downloads_enabled is True - assert response.page_changes_enabled is True - assert response.form_interactions_enabled is True - assert response.search_query_parameter == "search_query_parameter_value" - assert response.uri_query_parameter == "uri_query_parameter_value" + assert isinstance(response, pagers.ListAdSenseLinksPager) + assert response.next_page_token == "next_page_token_value" -def test_update_enhanced_measurement_settings_empty_call(): +def test_list_ad_sense_links_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -32041,18 +31124,18 @@ def test_update_enhanced_measurement_settings_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_enhanced_measurement_settings), "__call__" + type(client.transport.list_ad_sense_links), "__call__" ) as call: - client.update_enhanced_measurement_settings() + client.list_ad_sense_links() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateEnhancedMeasurementSettingsRequest() + assert args[0] == analytics_admin.ListAdSenseLinksRequest() @pytest.mark.asyncio -async def test_update_enhanced_measurement_settings_async( +async def test_list_ad_sense_links_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateEnhancedMeasurementSettingsRequest, + request_type=analytics_admin.ListAdSenseLinksRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -32065,68 +31148,48 @@ async def test_update_enhanced_measurement_settings_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_enhanced_measurement_settings), "__call__" + type(client.transport.list_ad_sense_links), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.EnhancedMeasurementSettings( - name="name_value", - stream_enabled=True, - scrolls_enabled=True, - outbound_clicks_enabled=True, - site_search_enabled=True, - video_engagement_enabled=True, - file_downloads_enabled=True, - page_changes_enabled=True, - form_interactions_enabled=True, - search_query_parameter="search_query_parameter_value", - uri_query_parameter="uri_query_parameter_value", + analytics_admin.ListAdSenseLinksResponse( + next_page_token="next_page_token_value", ) ) - response = await client.update_enhanced_measurement_settings(request) + response = await client.list_ad_sense_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateEnhancedMeasurementSettingsRequest() + assert args[0] == analytics_admin.ListAdSenseLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.EnhancedMeasurementSettings) - assert response.name == "name_value" - assert response.stream_enabled is True - assert response.scrolls_enabled is True - assert response.outbound_clicks_enabled is True - assert response.site_search_enabled is True - assert response.video_engagement_enabled is True - assert response.file_downloads_enabled is True - assert response.page_changes_enabled is True - assert response.form_interactions_enabled is True - assert response.search_query_parameter == "search_query_parameter_value" - assert response.uri_query_parameter == "uri_query_parameter_value" + assert isinstance(response, pagers.ListAdSenseLinksAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_update_enhanced_measurement_settings_async_from_dict(): - await test_update_enhanced_measurement_settings_async(request_type=dict) +async def test_list_ad_sense_links_async_from_dict(): + await test_list_ad_sense_links_async(request_type=dict) -def test_update_enhanced_measurement_settings_field_headers(): +def test_list_ad_sense_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateEnhancedMeasurementSettingsRequest() + request = analytics_admin.ListAdSenseLinksRequest() - request.enhanced_measurement_settings.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_enhanced_measurement_settings), "__call__" + type(client.transport.list_ad_sense_links), "__call__" ) as call: - call.return_value = resources.EnhancedMeasurementSettings() - client.update_enhanced_measurement_settings(request) + call.return_value = analytics_admin.ListAdSenseLinksResponse() + client.list_ad_sense_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -32137,30 +31200,30 @@ def test_update_enhanced_measurement_settings_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "enhanced_measurement_settings.name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_enhanced_measurement_settings_field_headers_async(): +async def test_list_ad_sense_links_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateEnhancedMeasurementSettingsRequest() + request = analytics_admin.ListAdSenseLinksRequest() - request.enhanced_measurement_settings.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_enhanced_measurement_settings), "__call__" + type(client.transport.list_ad_sense_links), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.EnhancedMeasurementSettings() + analytics_admin.ListAdSenseLinksResponse() ) - await client.update_enhanced_measurement_settings(request) + await client.list_ad_sense_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -32171,43 +31234,37 @@ async def test_update_enhanced_measurement_settings_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "enhanced_measurement_settings.name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_update_enhanced_measurement_settings_flattened(): +def test_list_ad_sense_links_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_enhanced_measurement_settings), "__call__" + type(client.transport.list_ad_sense_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.EnhancedMeasurementSettings() + call.return_value = analytics_admin.ListAdSenseLinksResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_enhanced_measurement_settings( - enhanced_measurement_settings=resources.EnhancedMeasurementSettings( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.list_ad_sense_links( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].enhanced_measurement_settings - mock_val = resources.EnhancedMeasurementSettings(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val -def test_update_enhanced_measurement_settings_flattened_error(): +def test_list_ad_sense_links_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -32215,54 +31272,45 @@ def test_update_enhanced_measurement_settings_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_enhanced_measurement_settings( - analytics_admin.UpdateEnhancedMeasurementSettingsRequest(), - enhanced_measurement_settings=resources.EnhancedMeasurementSettings( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.list_ad_sense_links( + analytics_admin.ListAdSenseLinksRequest(), + parent="parent_value", ) @pytest.mark.asyncio -async def test_update_enhanced_measurement_settings_flattened_async(): +async def test_list_ad_sense_links_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_enhanced_measurement_settings), "__call__" + type(client.transport.list_ad_sense_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.EnhancedMeasurementSettings() + call.return_value = analytics_admin.ListAdSenseLinksResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.EnhancedMeasurementSettings() + analytics_admin.ListAdSenseLinksResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_enhanced_measurement_settings( - enhanced_measurement_settings=resources.EnhancedMeasurementSettings( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + response = await client.list_ad_sense_links( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].enhanced_measurement_settings - mock_val = resources.EnhancedMeasurementSettings(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val @pytest.mark.asyncio -async def test_update_enhanced_measurement_settings_flattened_error_async(): +async def test_list_ad_sense_links_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -32270,23 +31318,218 @@ async def test_update_enhanced_measurement_settings_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_enhanced_measurement_settings( - analytics_admin.UpdateEnhancedMeasurementSettingsRequest(), - enhanced_measurement_settings=resources.EnhancedMeasurementSettings( - name="name_value" + await client.list_ad_sense_links( + analytics_admin.ListAdSenseLinksRequest(), + parent="parent_value", + ) + + +def test_list_ad_sense_links_pager(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_ad_sense_links), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + resources.AdSenseLink(), + resources.AdSenseLink(), + ], + next_page_token="abc", ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[], + next_page_token="def", + ), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + resources.AdSenseLink(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_ad_sense_links(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.AdSenseLink) for i in results) + + +def test_list_ad_sense_links_pages(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_ad_sense_links), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + resources.AdSenseLink(), + resources.AdSenseLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[], + next_page_token="def", + ), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + resources.AdSenseLink(), + ], + ), + RuntimeError, + ) + pages = list(client.list_ad_sense_links(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_ad_sense_links_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_ad_sense_links), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + resources.AdSenseLink(), + resources.AdSenseLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[], + next_page_token="def", + ), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + resources.AdSenseLink(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_ad_sense_links( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.AdSenseLink) for i in responses) + + +@pytest.mark.asyncio +async def test_list_ad_sense_links_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_ad_sense_links), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + resources.AdSenseLink(), + resources.AdSenseLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[], + next_page_token="def", + ), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + resources.AdSenseLink(), + ], + ), + RuntimeError, ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_ad_sense_links(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateConnectedSiteTagRequest, + analytics_admin.GetEventCreateRuleRequest, dict, ], ) -def test_create_connected_site_tag(request_type, transport: str = "grpc"): +def test_get_event_create_rule(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -32298,22 +31541,29 @@ def test_create_connected_site_tag(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_connected_site_tag), "__call__" + type(client.transport.get_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.CreateConnectedSiteTagResponse() - response = client.create_connected_site_tag(request) + call.return_value = event_create_and_edit.EventCreateRule( + name="name_value", + destination_event="destination_event_value", + source_copy_parameters=True, + ) + response = client.get_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateConnectedSiteTagRequest() + assert args[0] == analytics_admin.GetEventCreateRuleRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.CreateConnectedSiteTagResponse) + assert isinstance(response, event_create_and_edit.EventCreateRule) + assert response.name == "name_value" + assert response.destination_event == "destination_event_value" + assert response.source_copy_parameters is True -def test_create_connected_site_tag_empty_call(): +def test_get_event_create_rule_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -32323,18 +31573,18 @@ def test_create_connected_site_tag_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_connected_site_tag), "__call__" + type(client.transport.get_event_create_rule), "__call__" ) as call: - client.create_connected_site_tag() + client.get_event_create_rule() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateConnectedSiteTagRequest() + assert args[0] == analytics_admin.GetEventCreateRuleRequest() @pytest.mark.asyncio -async def test_create_connected_site_tag_async( +async def test_get_event_create_rule_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateConnectedSiteTagRequest, + request_type=analytics_admin.GetEventCreateRuleRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -32347,310 +31597,194 @@ async def test_create_connected_site_tag_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_connected_site_tag), "__call__" + type(client.transport.get_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.CreateConnectedSiteTagResponse() + event_create_and_edit.EventCreateRule( + name="name_value", + destination_event="destination_event_value", + source_copy_parameters=True, + ) ) - response = await client.create_connected_site_tag(request) + response = await client.get_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateConnectedSiteTagRequest() + assert args[0] == analytics_admin.GetEventCreateRuleRequest() # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.CreateConnectedSiteTagResponse) + assert isinstance(response, event_create_and_edit.EventCreateRule) + assert response.name == "name_value" + assert response.destination_event == "destination_event_value" + assert response.source_copy_parameters is True @pytest.mark.asyncio -async def test_create_connected_site_tag_async_from_dict(): - await test_create_connected_site_tag_async(request_type=dict) +async def test_get_event_create_rule_async_from_dict(): + await test_get_event_create_rule_async(request_type=dict) -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.DeleteConnectedSiteTagRequest, - dict, - ], -) -def test_delete_connected_site_tag(request_type, transport: str = "grpc"): +def test_get_event_create_rule_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.GetEventCreateRuleRequest() + + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_connected_site_tag), "__call__" + type(client.transport.get_event_create_rule), "__call__" ) as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_connected_site_tag(request) + call.return_value = event_create_and_edit.EventCreateRule() + client.get_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteConnectedSiteTagRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -def test_delete_connected_site_tag_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) + assert args[0] == request - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.delete_connected_site_tag), "__call__" - ) as call: - client.delete_connected_site_tag() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteConnectedSiteTagRequest() + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] @pytest.mark.asyncio -async def test_delete_connected_site_tag_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteConnectedSiteTagRequest, -): +async def test_get_event_create_rule_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.GetEventCreateRuleRequest() + + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_connected_site_tag), "__call__" + type(client.transport.get_event_create_rule), "__call__" ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_connected_site_tag(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + event_create_and_edit.EventCreateRule() + ) + await client.get_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteConnectedSiteTagRequest() - - # Establish that the response is the type that we expect. - assert response is None - + assert args[0] == request -@pytest.mark.asyncio -async def test_delete_connected_site_tag_async_from_dict(): - await test_delete_connected_site_tag_async(request_type=dict) + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.ListConnectedSiteTagsRequest, - dict, - ], -) -def test_list_connected_site_tags(request_type, transport: str = "grpc"): +def test_get_event_create_rule_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_connected_site_tags), "__call__" + type(client.transport.get_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListConnectedSiteTagsResponse() - response = client.list_connected_site_tags(request) + call.return_value = event_create_and_edit.EventCreateRule() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_event_create_rule( + name="name_value", + ) - # Establish that the underlying gRPC stub method was called. + # Establish that the underlying call was made with the expected + # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListConnectedSiteTagsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.ListConnectedSiteTagsResponse) + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val -def test_list_connected_site_tags_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. +def test_get_event_create_rule_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_connected_site_tags), "__call__" - ) as call: - client.list_connected_site_tags() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListConnectedSiteTagsRequest() + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_event_create_rule( + analytics_admin.GetEventCreateRuleRequest(), + name="name_value", + ) @pytest.mark.asyncio -async def test_list_connected_site_tags_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListConnectedSiteTagsRequest, -): +async def test_get_event_create_rule_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_connected_site_tags), "__call__" + type(client.transport.get_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. + call.return_value = event_create_and_edit.EventCreateRule() + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListConnectedSiteTagsResponse() + event_create_and_edit.EventCreateRule() ) - response = await client.list_connected_site_tags(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListConnectedSiteTagsRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.ListConnectedSiteTagsResponse) - - -@pytest.mark.asyncio -async def test_list_connected_site_tags_async_from_dict(): - await test_list_connected_site_tags_async(request_type=dict) - - -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.FetchConnectedGa4PropertyRequest, - dict, - ], -) -def test_fetch_connected_ga4_property(request_type, transport: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_connected_ga4_property), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = analytics_admin.FetchConnectedGa4PropertyResponse( - property="property_value", + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_event_create_rule( + name="name_value", ) - response = client.fetch_connected_ga4_property(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.FetchConnectedGa4PropertyRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.FetchConnectedGa4PropertyResponse) - assert response.property == "property_value" - - -def test_fetch_connected_ga4_property_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_connected_ga4_property), "__call__" - ) as call: - client.fetch_connected_ga4_property() - call.assert_called() + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.FetchConnectedGa4PropertyRequest() + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val @pytest.mark.asyncio -async def test_fetch_connected_ga4_property_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.FetchConnectedGa4PropertyRequest, -): +async def test_get_event_create_rule_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.fetch_connected_ga4_property), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.FetchConnectedGa4PropertyResponse( - property="property_value", - ) + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_event_create_rule( + analytics_admin.GetEventCreateRuleRequest(), + name="name_value", ) - response = await client.fetch_connected_ga4_property(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.FetchConnectedGa4PropertyRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.FetchConnectedGa4PropertyResponse) - assert response.property == "property_value" - - -@pytest.mark.asyncio -async def test_fetch_connected_ga4_property_async_from_dict(): - await test_fetch_connected_ga4_property_async(request_type=dict) @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAdSenseLinkRequest, + analytics_admin.ListEventCreateRulesRequest, dict, ], ) -def test_get_ad_sense_link(request_type, transport: str = "grpc"): +def test_list_event_create_rules(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -32662,27 +31796,25 @@ def test_get_ad_sense_link(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_ad_sense_link), "__call__" + type(client.transport.list_event_create_rules), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AdSenseLink( - name="name_value", - ad_client_code="ad_client_code_value", + call.return_value = analytics_admin.ListEventCreateRulesResponse( + next_page_token="next_page_token_value", ) - response = client.get_ad_sense_link(request) + response = client.list_event_create_rules(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAdSenseLinkRequest() + assert args[0] == analytics_admin.ListEventCreateRulesRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.AdSenseLink) - assert response.name == "name_value" - assert response.ad_client_code == "ad_client_code_value" + assert isinstance(response, pagers.ListEventCreateRulesPager) + assert response.next_page_token == "next_page_token_value" -def test_get_ad_sense_link_empty_call(): +def test_list_event_create_rules_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -32692,17 +31824,18 @@ def test_get_ad_sense_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_ad_sense_link), "__call__" + type(client.transport.list_event_create_rules), "__call__" ) as call: - client.get_ad_sense_link() + client.list_event_create_rules() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAdSenseLinkRequest() + assert args[0] == analytics_admin.ListEventCreateRulesRequest() @pytest.mark.asyncio -async def test_get_ad_sense_link_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetAdSenseLinkRequest +async def test_list_event_create_rules_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.ListEventCreateRulesRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -32715,50 +31848,48 @@ async def test_get_ad_sense_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_ad_sense_link), "__call__" + type(client.transport.list_event_create_rules), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AdSenseLink( - name="name_value", - ad_client_code="ad_client_code_value", + analytics_admin.ListEventCreateRulesResponse( + next_page_token="next_page_token_value", ) ) - response = await client.get_ad_sense_link(request) + response = await client.list_event_create_rules(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetAdSenseLinkRequest() + assert args[0] == analytics_admin.ListEventCreateRulesRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.AdSenseLink) - assert response.name == "name_value" - assert response.ad_client_code == "ad_client_code_value" + assert isinstance(response, pagers.ListEventCreateRulesAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_get_ad_sense_link_async_from_dict(): - await test_get_ad_sense_link_async(request_type=dict) +async def test_list_event_create_rules_async_from_dict(): + await test_list_event_create_rules_async(request_type=dict) -def test_get_ad_sense_link_field_headers(): +def test_list_event_create_rules_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetAdSenseLinkRequest() + request = analytics_admin.ListEventCreateRulesRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_ad_sense_link), "__call__" + type(client.transport.list_event_create_rules), "__call__" ) as call: - call.return_value = resources.AdSenseLink() - client.get_ad_sense_link(request) + call.return_value = analytics_admin.ListEventCreateRulesResponse() + client.list_event_create_rules(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -32769,30 +31900,30 @@ def test_get_ad_sense_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_ad_sense_link_field_headers_async(): +async def test_list_event_create_rules_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetAdSenseLinkRequest() + request = analytics_admin.ListEventCreateRulesRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_ad_sense_link), "__call__" + type(client.transport.list_event_create_rules), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AdSenseLink() + analytics_admin.ListEventCreateRulesResponse() ) - await client.get_ad_sense_link(request) + await client.list_event_create_rules(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -32803,37 +31934,37 @@ async def test_get_ad_sense_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_get_ad_sense_link_flattened(): +def test_list_event_create_rules_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_ad_sense_link), "__call__" + type(client.transport.list_event_create_rules), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AdSenseLink() + call.return_value = analytics_admin.ListEventCreateRulesResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_ad_sense_link( - name="name_value", + client.list_event_create_rules( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val -def test_get_ad_sense_link_flattened_error(): +def test_list_event_create_rules_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -32841,45 +31972,45 @@ def test_get_ad_sense_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_ad_sense_link( - analytics_admin.GetAdSenseLinkRequest(), - name="name_value", + client.list_event_create_rules( + analytics_admin.ListEventCreateRulesRequest(), + parent="parent_value", ) @pytest.mark.asyncio -async def test_get_ad_sense_link_flattened_async(): +async def test_list_event_create_rules_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_ad_sense_link), "__call__" + type(client.transport.list_event_create_rules), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AdSenseLink() + call.return_value = analytics_admin.ListEventCreateRulesResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AdSenseLink() + analytics_admin.ListEventCreateRulesResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_ad_sense_link( - name="name_value", + response = await client.list_event_create_rules( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val @pytest.mark.asyncio -async def test_get_ad_sense_link_flattened_error_async(): +async def test_list_event_create_rules_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -32887,129 +32018,335 @@ async def test_get_ad_sense_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_ad_sense_link( - analytics_admin.GetAdSenseLinkRequest(), - name="name_value", + await client.list_event_create_rules( + analytics_admin.ListEventCreateRulesRequest(), + parent="parent_value", ) -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.CreateAdSenseLinkRequest, - dict, - ], -) -def test_create_ad_sense_link(request_type, transport: str = "grpc"): +def test_list_event_create_rules_pager(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_ad_sense_link), "__call__" + type(client.transport.list_event_create_rules), "__call__" ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.AdSenseLink( - name="name_value", - ad_client_code="ad_client_code_value", + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + ], + next_page_token="abc", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[], + next_page_token="def", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + ], + next_page_token="ghi", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + ], + ), + RuntimeError, ) - response = client.create_ad_sense_link(request) - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateAdSenseLinkRequest() + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_event_create_rules(request={}) - # Establish that the response is the type that we expect. - assert isinstance(response, resources.AdSenseLink) - assert response.name == "name_value" - assert response.ad_client_code == "ad_client_code_value" + assert pager._metadata == metadata + results = list(pager) + assert len(results) == 6 + assert all( + isinstance(i, event_create_and_edit.EventCreateRule) for i in results + ) -def test_create_ad_sense_link_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. + +def test_list_event_create_rules_pages(transport_name: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="grpc", + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_ad_sense_link), "__call__" + type(client.transport.list_event_create_rules), "__call__" ) as call: - client.create_ad_sense_link() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateAdSenseLinkRequest() - - -@pytest.mark.asyncio -async def test_create_ad_sense_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateAdSenseLinkRequest, -): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + ], + next_page_token="abc", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[], + next_page_token="def", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + ], + next_page_token="ghi", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + ], + ), + RuntimeError, + ) + pages = list(client.list_event_create_rules(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_event_create_rules_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_event_create_rules), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + ], + next_page_token="abc", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[], + next_page_token="def", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + ], + next_page_token="ghi", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_event_create_rules( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all( + isinstance(i, event_create_and_edit.EventCreateRule) for i in responses + ) + + +@pytest.mark.asyncio +async def test_list_event_create_rules_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_event_create_rules), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + ], + next_page_token="abc", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[], + next_page_token="def", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + ], + next_page_token="ghi", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + ], + ), + RuntimeError, + ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_event_create_rules(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateEventCreateRuleRequest, + dict, + ], +) +def test_create_event_create_rule(request_type, transport: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + # Everything is optional in proto3 as far as the runtime is concerned, # and we are mocking out the actual API, so just send an empty request. request = request_type() # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_ad_sense_link), "__call__" + type(client.transport.create_event_create_rule), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = event_create_and_edit.EventCreateRule( + name="name_value", + destination_event="destination_event_value", + source_copy_parameters=True, + ) + response = client.create_event_create_rule(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateEventCreateRuleRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, event_create_and_edit.EventCreateRule) + assert response.name == "name_value" + assert response.destination_event == "destination_event_value" + assert response.source_copy_parameters is True + + +def test_create_event_create_rule_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_event_create_rule), "__call__" + ) as call: + client.create_event_create_rule() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateEventCreateRuleRequest() + + +@pytest.mark.asyncio +async def test_create_event_create_rule_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.CreateEventCreateRuleRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AdSenseLink( + event_create_and_edit.EventCreateRule( name="name_value", - ad_client_code="ad_client_code_value", + destination_event="destination_event_value", + source_copy_parameters=True, ) ) - response = await client.create_ad_sense_link(request) + response = await client.create_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateAdSenseLinkRequest() + assert args[0] == analytics_admin.CreateEventCreateRuleRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.AdSenseLink) + assert isinstance(response, event_create_and_edit.EventCreateRule) assert response.name == "name_value" - assert response.ad_client_code == "ad_client_code_value" + assert response.destination_event == "destination_event_value" + assert response.source_copy_parameters is True @pytest.mark.asyncio -async def test_create_ad_sense_link_async_from_dict(): - await test_create_ad_sense_link_async(request_type=dict) +async def test_create_event_create_rule_async_from_dict(): + await test_create_event_create_rule_async(request_type=dict) -def test_create_ad_sense_link_field_headers(): +def test_create_event_create_rule_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateAdSenseLinkRequest() + request = analytics_admin.CreateEventCreateRuleRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_ad_sense_link), "__call__" + type(client.transport.create_event_create_rule), "__call__" ) as call: - call.return_value = resources.AdSenseLink() - client.create_ad_sense_link(request) + call.return_value = event_create_and_edit.EventCreateRule() + client.create_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -33025,25 +32362,25 @@ def test_create_ad_sense_link_field_headers(): @pytest.mark.asyncio -async def test_create_ad_sense_link_field_headers_async(): +async def test_create_event_create_rule_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateAdSenseLinkRequest() + request = analytics_admin.CreateEventCreateRuleRequest() request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_ad_sense_link), "__call__" + type(client.transport.create_event_create_rule), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AdSenseLink() + event_create_and_edit.EventCreateRule() ) - await client.create_ad_sense_link(request) + await client.create_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -33058,22 +32395,22 @@ async def test_create_ad_sense_link_field_headers_async(): ) in kw["metadata"] -def test_create_ad_sense_link_flattened(): +def test_create_event_create_rule_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_ad_sense_link), "__call__" + type(client.transport.create_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AdSenseLink() + call.return_value = event_create_and_edit.EventCreateRule() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_ad_sense_link( + client.create_event_create_rule( parent="parent_value", - adsense_link=resources.AdSenseLink(name="name_value"), + event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -33083,12 +32420,12 @@ def test_create_ad_sense_link_flattened(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].adsense_link - mock_val = resources.AdSenseLink(name="name_value") + arg = args[0].event_create_rule + mock_val = event_create_and_edit.EventCreateRule(name="name_value") assert arg == mock_val -def test_create_ad_sense_link_flattened_error(): +def test_create_event_create_rule_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -33096,34 +32433,34 @@ def test_create_ad_sense_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_ad_sense_link( - analytics_admin.CreateAdSenseLinkRequest(), + client.create_event_create_rule( + analytics_admin.CreateEventCreateRuleRequest(), parent="parent_value", - adsense_link=resources.AdSenseLink(name="name_value"), + event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), ) @pytest.mark.asyncio -async def test_create_ad_sense_link_flattened_async(): +async def test_create_event_create_rule_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_ad_sense_link), "__call__" + type(client.transport.create_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.AdSenseLink() + call.return_value = event_create_and_edit.EventCreateRule() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.AdSenseLink() + event_create_and_edit.EventCreateRule() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_ad_sense_link( + response = await client.create_event_create_rule( parent="parent_value", - adsense_link=resources.AdSenseLink(name="name_value"), + event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), ) # Establish that the underlying call was made with the expected @@ -33133,13 +32470,13 @@ async def test_create_ad_sense_link_flattened_async(): arg = args[0].parent mock_val = "parent_value" assert arg == mock_val - arg = args[0].adsense_link - mock_val = resources.AdSenseLink(name="name_value") + arg = args[0].event_create_rule + mock_val = event_create_and_edit.EventCreateRule(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_create_ad_sense_link_flattened_error_async(): +async def test_create_event_create_rule_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -33147,21 +32484,21 @@ async def test_create_ad_sense_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_ad_sense_link( - analytics_admin.CreateAdSenseLinkRequest(), + await client.create_event_create_rule( + analytics_admin.CreateEventCreateRuleRequest(), parent="parent_value", - adsense_link=resources.AdSenseLink(name="name_value"), + event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteAdSenseLinkRequest, + analytics_admin.UpdateEventCreateRuleRequest, dict, ], ) -def test_delete_ad_sense_link(request_type, transport: str = "grpc"): +def test_update_event_create_rule(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -33173,22 +32510,29 @@ def test_delete_ad_sense_link(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_ad_sense_link), "__call__" + type(client.transport.update_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_ad_sense_link(request) + call.return_value = event_create_and_edit.EventCreateRule( + name="name_value", + destination_event="destination_event_value", + source_copy_parameters=True, + ) + response = client.update_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteAdSenseLinkRequest() + assert args[0] == analytics_admin.UpdateEventCreateRuleRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, event_create_and_edit.EventCreateRule) + assert response.name == "name_value" + assert response.destination_event == "destination_event_value" + assert response.source_copy_parameters is True -def test_delete_ad_sense_link_empty_call(): +def test_update_event_create_rule_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -33198,18 +32542,18 @@ def test_delete_ad_sense_link_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_ad_sense_link), "__call__" + type(client.transport.update_event_create_rule), "__call__" ) as call: - client.delete_ad_sense_link() + client.update_event_create_rule() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteAdSenseLinkRequest() + assert args[0] == analytics_admin.UpdateEventCreateRuleRequest() @pytest.mark.asyncio -async def test_delete_ad_sense_link_async( +async def test_update_event_create_rule_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteAdSenseLinkRequest, + request_type=analytics_admin.UpdateEventCreateRuleRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -33222,43 +32566,52 @@ async def test_delete_ad_sense_link_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_ad_sense_link), "__call__" + type(client.transport.update_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_ad_sense_link(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + event_create_and_edit.EventCreateRule( + name="name_value", + destination_event="destination_event_value", + source_copy_parameters=True, + ) + ) + response = await client.update_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteAdSenseLinkRequest() + assert args[0] == analytics_admin.UpdateEventCreateRuleRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, event_create_and_edit.EventCreateRule) + assert response.name == "name_value" + assert response.destination_event == "destination_event_value" + assert response.source_copy_parameters is True @pytest.mark.asyncio -async def test_delete_ad_sense_link_async_from_dict(): - await test_delete_ad_sense_link_async(request_type=dict) +async def test_update_event_create_rule_async_from_dict(): + await test_update_event_create_rule_async(request_type=dict) -def test_delete_ad_sense_link_field_headers(): +def test_update_event_create_rule_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteAdSenseLinkRequest() + request = analytics_admin.UpdateEventCreateRuleRequest() - request.name = "name_value" + request.event_create_rule.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_ad_sense_link), "__call__" + type(client.transport.update_event_create_rule), "__call__" ) as call: - call.return_value = None - client.delete_ad_sense_link(request) + call.return_value = event_create_and_edit.EventCreateRule() + client.update_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -33269,28 +32622,30 @@ def test_delete_ad_sense_link_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "event_create_rule.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_delete_ad_sense_link_field_headers_async(): +async def test_update_event_create_rule_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteAdSenseLinkRequest() + request = analytics_admin.UpdateEventCreateRuleRequest() - request.name = "name_value" + request.event_create_rule.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_ad_sense_link), "__call__" + type(client.transport.update_event_create_rule), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_ad_sense_link(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + event_create_and_edit.EventCreateRule() + ) + await client.update_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -33301,37 +32656,41 @@ async def test_delete_ad_sense_link_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "event_create_rule.name=name_value", ) in kw["metadata"] -def test_delete_ad_sense_link_flattened(): +def test_update_event_create_rule_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_ad_sense_link), "__call__" + type(client.transport.update_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = event_create_and_edit.EventCreateRule() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_ad_sense_link( - name="name_value", + client.update_event_create_rule( + event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].event_create_rule + mock_val = event_create_and_edit.EventCreateRule(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_delete_ad_sense_link_flattened_error(): +def test_update_event_create_rule_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -33339,43 +32698,50 @@ def test_delete_ad_sense_link_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_ad_sense_link( - analytics_admin.DeleteAdSenseLinkRequest(), - name="name_value", + client.update_event_create_rule( + analytics_admin.UpdateEventCreateRuleRequest(), + event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_delete_ad_sense_link_flattened_async(): +async def test_update_event_create_rule_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_ad_sense_link), "__call__" + type(client.transport.update_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = event_create_and_edit.EventCreateRule() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + event_create_and_edit.EventCreateRule() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_ad_sense_link( - name="name_value", + response = await client.update_event_create_rule( + event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].event_create_rule + mock_val = event_create_and_edit.EventCreateRule(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val @pytest.mark.asyncio -async def test_delete_ad_sense_link_flattened_error_async(): +async def test_update_event_create_rule_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -33383,20 +32749,21 @@ async def test_delete_ad_sense_link_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.delete_ad_sense_link( - analytics_admin.DeleteAdSenseLinkRequest(), - name="name_value", + await client.update_event_create_rule( + analytics_admin.UpdateEventCreateRuleRequest(), + event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAdSenseLinksRequest, + analytics_admin.DeleteEventCreateRuleRequest, dict, ], ) -def test_list_ad_sense_links(request_type, transport: str = "grpc"): +def test_delete_event_create_rule(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -33408,25 +32775,22 @@ def test_list_ad_sense_links(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_ad_sense_links), "__call__" + type(client.transport.delete_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListAdSenseLinksResponse( - next_page_token="next_page_token_value", - ) - response = client.list_ad_sense_links(request) + call.return_value = None + response = client.delete_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAdSenseLinksRequest() + assert args[0] == analytics_admin.DeleteEventCreateRuleRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAdSenseLinksPager) - assert response.next_page_token == "next_page_token_value" + assert response is None -def test_list_ad_sense_links_empty_call(): +def test_delete_event_create_rule_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -33436,18 +32800,18 @@ def test_list_ad_sense_links_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_ad_sense_links), "__call__" + type(client.transport.delete_event_create_rule), "__call__" ) as call: - client.list_ad_sense_links() + client.delete_event_create_rule() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAdSenseLinksRequest() + assert args[0] == analytics_admin.DeleteEventCreateRuleRequest() @pytest.mark.asyncio -async def test_list_ad_sense_links_async( +async def test_delete_event_create_rule_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListAdSenseLinksRequest, + request_type=analytics_admin.DeleteEventCreateRuleRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -33460,48 +32824,43 @@ async def test_list_ad_sense_links_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_ad_sense_links), "__call__" + type(client.transport.delete_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListAdSenseLinksResponse( - next_page_token="next_page_token_value", - ) - ) - response = await client.list_ad_sense_links(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListAdSenseLinksRequest() + assert args[0] == analytics_admin.DeleteEventCreateRuleRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAdSenseLinksAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert response is None @pytest.mark.asyncio -async def test_list_ad_sense_links_async_from_dict(): - await test_list_ad_sense_links_async(request_type=dict) +async def test_delete_event_create_rule_async_from_dict(): + await test_delete_event_create_rule_async(request_type=dict) -def test_list_ad_sense_links_field_headers(): +def test_delete_event_create_rule_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListAdSenseLinksRequest() + request = analytics_admin.DeleteEventCreateRuleRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_ad_sense_links), "__call__" + type(client.transport.delete_event_create_rule), "__call__" ) as call: - call.return_value = analytics_admin.ListAdSenseLinksResponse() - client.list_ad_sense_links(request) + call.return_value = None + client.delete_event_create_rule(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -33512,31 +32871,29 @@ def test_list_ad_sense_links_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_ad_sense_links_field_headers_async(): +async def test_delete_event_create_rule_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListAdSenseLinksRequest() + request = analytics_admin.DeleteEventCreateRuleRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_ad_sense_links), "__call__" + type(client.transport.delete_event_create_rule), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListAdSenseLinksResponse() - ) - await client.list_ad_sense_links(request) - + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_event_create_rule(request) + # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] @@ -33546,37 +32903,37 @@ async def test_list_ad_sense_links_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_list_ad_sense_links_flattened(): +def test_delete_event_create_rule_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_ad_sense_links), "__call__" + type(client.transport.delete_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListAdSenseLinksResponse() + call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_ad_sense_links( - parent="parent_value", + client.delete_event_create_rule( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_list_ad_sense_links_flattened_error(): +def test_delete_event_create_rule_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -33584,45 +32941,43 @@ def test_list_ad_sense_links_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_ad_sense_links( - analytics_admin.ListAdSenseLinksRequest(), - parent="parent_value", + client.delete_event_create_rule( + analytics_admin.DeleteEventCreateRuleRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_list_ad_sense_links_flattened_async(): +async def test_delete_event_create_rule_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_ad_sense_links), "__call__" + type(client.transport.delete_event_create_rule), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListAdSenseLinksResponse() + call.return_value = None - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListAdSenseLinksResponse() - ) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_ad_sense_links( - parent="parent_value", + response = await client.delete_event_create_rule( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_list_ad_sense_links_flattened_error_async(): +async def test_delete_event_create_rule_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -33630,218 +32985,20 @@ async def test_list_ad_sense_links_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_ad_sense_links( - analytics_admin.ListAdSenseLinksRequest(), - parent="parent_value", - ) - - -def test_list_ad_sense_links_pager(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ad_sense_links), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - resources.AdSenseLink(), - resources.AdSenseLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[], - next_page_token="def", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - resources.AdSenseLink(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_ad_sense_links(request={}) - - assert pager._metadata == metadata - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.AdSenseLink) for i in results) - - -def test_list_ad_sense_links_pages(transport_name: str = "grpc"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ad_sense_links), "__call__" - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - resources.AdSenseLink(), - resources.AdSenseLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[], - next_page_token="def", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - resources.AdSenseLink(), - ], - ), - RuntimeError, - ) - pages = list(client.list_ad_sense_links(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.asyncio -async def test_list_ad_sense_links_async_pager(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ad_sense_links), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - resources.AdSenseLink(), - resources.AdSenseLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[], - next_page_token="def", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - resources.AdSenseLink(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_ad_sense_links( - request={}, - ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.AdSenseLink) for i in responses) - - -@pytest.mark.asyncio -async def test_list_ad_sense_links_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_ad_sense_links), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - resources.AdSenseLink(), - resources.AdSenseLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[], - next_page_token="def", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - resources.AdSenseLink(), - ], - ), - RuntimeError, + await client.delete_event_create_rule( + analytics_admin.DeleteEventCreateRuleRequest(), + name="name_value", ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_ad_sense_links(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetEventCreateRuleRequest, + analytics_admin.UpdateDataRedactionSettingsRequest, dict, ], ) -def test_get_event_create_rule(request_type, transport: str = "grpc"): +def test_update_data_redaction_settings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -33853,29 +33010,31 @@ def test_get_event_create_rule(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_event_create_rule), "__call__" + type(client.transport.update_data_redaction_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = event_create_and_edit.EventCreateRule( + call.return_value = resources.DataRedactionSettings( name="name_value", - destination_event="destination_event_value", - source_copy_parameters=True, + email_redaction_enabled=True, + query_parameter_redaction_enabled=True, + query_parameter_keys=["query_parameter_keys_value"], ) - response = client.get_event_create_rule(request) + response = client.update_data_redaction_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetEventCreateRuleRequest() + assert args[0] == analytics_admin.UpdateDataRedactionSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, event_create_and_edit.EventCreateRule) + assert isinstance(response, resources.DataRedactionSettings) assert response.name == "name_value" - assert response.destination_event == "destination_event_value" - assert response.source_copy_parameters is True + assert response.email_redaction_enabled is True + assert response.query_parameter_redaction_enabled is True + assert response.query_parameter_keys == ["query_parameter_keys_value"] -def test_get_event_create_rule_empty_call(): +def test_update_data_redaction_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -33885,18 +33044,18 @@ def test_get_event_create_rule_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_event_create_rule), "__call__" + type(client.transport.update_data_redaction_settings), "__call__" ) as call: - client.get_event_create_rule() + client.update_data_redaction_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetEventCreateRuleRequest() + assert args[0] == analytics_admin.UpdateDataRedactionSettingsRequest() @pytest.mark.asyncio -async def test_get_event_create_rule_async( +async def test_update_data_redaction_settings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetEventCreateRuleRequest, + request_type=analytics_admin.UpdateDataRedactionSettingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -33909,52 +33068,54 @@ async def test_get_event_create_rule_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_event_create_rule), "__call__" + type(client.transport.update_data_redaction_settings), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - event_create_and_edit.EventCreateRule( + resources.DataRedactionSettings( name="name_value", - destination_event="destination_event_value", - source_copy_parameters=True, + email_redaction_enabled=True, + query_parameter_redaction_enabled=True, + query_parameter_keys=["query_parameter_keys_value"], ) ) - response = await client.get_event_create_rule(request) + response = await client.update_data_redaction_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetEventCreateRuleRequest() + assert args[0] == analytics_admin.UpdateDataRedactionSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, event_create_and_edit.EventCreateRule) + assert isinstance(response, resources.DataRedactionSettings) assert response.name == "name_value" - assert response.destination_event == "destination_event_value" - assert response.source_copy_parameters is True + assert response.email_redaction_enabled is True + assert response.query_parameter_redaction_enabled is True + assert response.query_parameter_keys == ["query_parameter_keys_value"] @pytest.mark.asyncio -async def test_get_event_create_rule_async_from_dict(): - await test_get_event_create_rule_async(request_type=dict) +async def test_update_data_redaction_settings_async_from_dict(): + await test_update_data_redaction_settings_async(request_type=dict) -def test_get_event_create_rule_field_headers(): +def test_update_data_redaction_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetEventCreateRuleRequest() + request = analytics_admin.UpdateDataRedactionSettingsRequest() - request.name = "name_value" + request.data_redaction_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_event_create_rule), "__call__" + type(client.transport.update_data_redaction_settings), "__call__" ) as call: - call.return_value = event_create_and_edit.EventCreateRule() - client.get_event_create_rule(request) + call.return_value = resources.DataRedactionSettings() + client.update_data_redaction_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -33965,30 +33126,30 @@ def test_get_event_create_rule_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "data_redaction_settings.name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_event_create_rule_field_headers_async(): +async def test_update_data_redaction_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetEventCreateRuleRequest() + request = analytics_admin.UpdateDataRedactionSettingsRequest() - request.name = "name_value" + request.data_redaction_settings.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_event_create_rule), "__call__" + type(client.transport.update_data_redaction_settings), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - event_create_and_edit.EventCreateRule() + resources.DataRedactionSettings() ) - await client.get_event_create_rule(request) + await client.update_data_redaction_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -33999,37 +33160,41 @@ async def test_get_event_create_rule_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "data_redaction_settings.name=name_value", ) in kw["metadata"] -def test_get_event_create_rule_flattened(): +def test_update_data_redaction_settings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_event_create_rule), "__call__" + type(client.transport.update_data_redaction_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = event_create_and_edit.EventCreateRule() + call.return_value = resources.DataRedactionSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_event_create_rule( - name="name_value", + client.update_data_redaction_settings( + data_redaction_settings=resources.DataRedactionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].data_redaction_settings + mock_val = resources.DataRedactionSettings(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val -def test_get_event_create_rule_flattened_error(): +def test_update_data_redaction_settings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -34037,45 +33202,50 @@ def test_get_event_create_rule_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_event_create_rule( - analytics_admin.GetEventCreateRuleRequest(), - name="name_value", + client.update_data_redaction_settings( + analytics_admin.UpdateDataRedactionSettingsRequest(), + data_redaction_settings=resources.DataRedactionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_get_event_create_rule_flattened_async(): +async def test_update_data_redaction_settings_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_event_create_rule), "__call__" + type(client.transport.update_data_redaction_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = event_create_and_edit.EventCreateRule() + call.return_value = resources.DataRedactionSettings() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - event_create_and_edit.EventCreateRule() + resources.DataRedactionSettings() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_event_create_rule( - name="name_value", + response = await client.update_data_redaction_settings( + data_redaction_settings=resources.DataRedactionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].data_redaction_settings + mock_val = resources.DataRedactionSettings(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) assert arg == mock_val @pytest.mark.asyncio -async def test_get_event_create_rule_flattened_error_async(): +async def test_update_data_redaction_settings_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -34083,20 +33253,21 @@ async def test_get_event_create_rule_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_event_create_rule( - analytics_admin.GetEventCreateRuleRequest(), - name="name_value", + await client.update_data_redaction_settings( + analytics_admin.UpdateDataRedactionSettingsRequest(), + data_redaction_settings=resources.DataRedactionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListEventCreateRulesRequest, + analytics_admin.GetDataRedactionSettingsRequest, dict, ], ) -def test_list_event_create_rules(request_type, transport: str = "grpc"): +def test_get_data_redaction_settings(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -34108,25 +33279,31 @@ def test_list_event_create_rules(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_event_create_rules), "__call__" + type(client.transport.get_data_redaction_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListEventCreateRulesResponse( - next_page_token="next_page_token_value", + call.return_value = resources.DataRedactionSettings( + name="name_value", + email_redaction_enabled=True, + query_parameter_redaction_enabled=True, + query_parameter_keys=["query_parameter_keys_value"], ) - response = client.list_event_create_rules(request) + response = client.get_data_redaction_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListEventCreateRulesRequest() + assert args[0] == analytics_admin.GetDataRedactionSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListEventCreateRulesPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.DataRedactionSettings) + assert response.name == "name_value" + assert response.email_redaction_enabled is True + assert response.query_parameter_redaction_enabled is True + assert response.query_parameter_keys == ["query_parameter_keys_value"] -def test_list_event_create_rules_empty_call(): +def test_get_data_redaction_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -34136,18 +33313,18 @@ def test_list_event_create_rules_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_event_create_rules), "__call__" + type(client.transport.get_data_redaction_settings), "__call__" ) as call: - client.list_event_create_rules() + client.get_data_redaction_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListEventCreateRulesRequest() + assert args[0] == analytics_admin.GetDataRedactionSettingsRequest() @pytest.mark.asyncio -async def test_list_event_create_rules_async( +async def test_get_data_redaction_settings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListEventCreateRulesRequest, + request_type=analytics_admin.GetDataRedactionSettingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -34160,48 +33337,54 @@ async def test_list_event_create_rules_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_event_create_rules), "__call__" + type(client.transport.get_data_redaction_settings), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListEventCreateRulesResponse( - next_page_token="next_page_token_value", + resources.DataRedactionSettings( + name="name_value", + email_redaction_enabled=True, + query_parameter_redaction_enabled=True, + query_parameter_keys=["query_parameter_keys_value"], ) ) - response = await client.list_event_create_rules(request) + response = await client.get_data_redaction_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListEventCreateRulesRequest() + assert args[0] == analytics_admin.GetDataRedactionSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListEventCreateRulesAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.DataRedactionSettings) + assert response.name == "name_value" + assert response.email_redaction_enabled is True + assert response.query_parameter_redaction_enabled is True + assert response.query_parameter_keys == ["query_parameter_keys_value"] @pytest.mark.asyncio -async def test_list_event_create_rules_async_from_dict(): - await test_list_event_create_rules_async(request_type=dict) +async def test_get_data_redaction_settings_async_from_dict(): + await test_get_data_redaction_settings_async(request_type=dict) -def test_list_event_create_rules_field_headers(): +def test_get_data_redaction_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListEventCreateRulesRequest() + request = analytics_admin.GetDataRedactionSettingsRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_event_create_rules), "__call__" + type(client.transport.get_data_redaction_settings), "__call__" ) as call: - call.return_value = analytics_admin.ListEventCreateRulesResponse() - client.list_event_create_rules(request) + call.return_value = resources.DataRedactionSettings() + client.get_data_redaction_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -34212,30 +33395,30 @@ def test_list_event_create_rules_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_list_event_create_rules_field_headers_async(): +async def test_get_data_redaction_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListEventCreateRulesRequest() + request = analytics_admin.GetDataRedactionSettingsRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_event_create_rules), "__call__" + type(client.transport.get_data_redaction_settings), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListEventCreateRulesResponse() + resources.DataRedactionSettings() ) - await client.list_event_create_rules(request) + await client.get_data_redaction_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -34246,37 +33429,37 @@ async def test_list_event_create_rules_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_list_event_create_rules_flattened(): +def test_get_data_redaction_settings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_event_create_rules), "__call__" + type(client.transport.get_data_redaction_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListEventCreateRulesResponse() + call.return_value = resources.DataRedactionSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_event_create_rules( - parent="parent_value", + client.get_data_redaction_settings( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_list_event_create_rules_flattened_error(): +def test_get_data_redaction_settings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -34284,45 +33467,45 @@ def test_list_event_create_rules_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_event_create_rules( - analytics_admin.ListEventCreateRulesRequest(), - parent="parent_value", + client.get_data_redaction_settings( + analytics_admin.GetDataRedactionSettingsRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_list_event_create_rules_flattened_async(): +async def test_get_data_redaction_settings_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_event_create_rules), "__call__" + type(client.transport.get_data_redaction_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListEventCreateRulesResponse() + call.return_value = resources.DataRedactionSettings() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListEventCreateRulesResponse() + resources.DataRedactionSettings() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_event_create_rules( - parent="parent_value", + response = await client.get_data_redaction_settings( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_list_event_create_rules_flattened_error_async(): +async def test_get_data_redaction_settings_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -34330,222 +33513,110 @@ async def test_list_event_create_rules_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_event_create_rules( - analytics_admin.ListEventCreateRulesRequest(), - parent="parent_value", + await client.get_data_redaction_settings( + analytics_admin.GetDataRedactionSettingsRequest(), + name="name_value", ) -def test_list_event_create_rules_pager(transport_name: str = "grpc"): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateRollupPropertyRequest, + dict, + ], +) +def test_create_rollup_property(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_event_create_rules), "__call__" + type(client.transport.create_rollup_property), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - ], - next_page_token="abc", - ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[], - next_page_token="def", - ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - ], - next_page_token="ghi", - ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - ], - ), - RuntimeError, - ) - - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_event_create_rules(request={}) + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.CreateRollupPropertyResponse() + response = client.create_rollup_property(request) - assert pager._metadata == metadata + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateRollupPropertyRequest() - results = list(pager) - assert len(results) == 6 - assert all( - isinstance(i, event_create_and_edit.EventCreateRule) for i in results - ) + # Establish that the response is the type that we expect. + assert isinstance(response, analytics_admin.CreateRollupPropertyResponse) -def test_list_event_create_rules_pages(transport_name: str = "grpc"): +def test_create_rollup_property_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, - transport=transport_name, + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_event_create_rules), "__call__" + type(client.transport.create_rollup_property), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - ], - next_page_token="abc", - ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[], - next_page_token="def", - ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - ], - next_page_token="ghi", - ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - ], - ), - RuntimeError, - ) - pages = list(client.list_event_create_rules(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token + client.create_rollup_property() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateRollupPropertyRequest() @pytest.mark.asyncio -async def test_list_event_create_rules_async_pager(): +async def test_create_rollup_property_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.CreateRollupPropertyRequest, +): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) - # Mock the actual call within the gRPC stub, and fake the request. + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_event_create_rules), - "__call__", - new_callable=mock.AsyncMock, + type(client.transport.create_rollup_property), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - ], - next_page_token="abc", - ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[], - next_page_token="def", - ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - ], - next_page_token="ghi", - ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_event_create_rules( - request={}, + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.CreateRollupPropertyResponse() ) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: # pragma: no branch - responses.append(response) + response = await client.create_rollup_property(request) - assert len(responses) == 6 - assert all( - isinstance(i, event_create_and_edit.EventCreateRule) for i in responses - ) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateRollupPropertyRequest() + # Establish that the response is the type that we expect. + assert isinstance(response, analytics_admin.CreateRollupPropertyResponse) -@pytest.mark.asyncio -async def test_list_event_create_rules_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_event_create_rules), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - ], - next_page_token="abc", - ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[], - next_page_token="def", - ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - ], - next_page_token="ghi", - ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - ], - ), - RuntimeError, - ) - pages = [] - # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` - # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 - async for page_ in ( # pragma: no branch - await client.list_event_create_rules(request={}) - ).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token +@pytest.mark.asyncio +async def test_create_rollup_property_async_from_dict(): + await test_create_rollup_property_async(request_type=dict) @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateEventCreateRuleRequest, + analytics_admin.GetRollupPropertySourceLinkRequest, dict, ], ) -def test_create_event_create_rule(request_type, transport: str = "grpc"): +def test_get_rollup_property_source_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -34557,29 +33628,27 @@ def test_create_event_create_rule(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_event_create_rule), "__call__" + type(client.transport.get_rollup_property_source_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = event_create_and_edit.EventCreateRule( + call.return_value = resources.RollupPropertySourceLink( name="name_value", - destination_event="destination_event_value", - source_copy_parameters=True, + source_property="source_property_value", ) - response = client.create_event_create_rule(request) + response = client.get_rollup_property_source_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateEventCreateRuleRequest() + assert args[0] == analytics_admin.GetRollupPropertySourceLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, event_create_and_edit.EventCreateRule) + assert isinstance(response, resources.RollupPropertySourceLink) assert response.name == "name_value" - assert response.destination_event == "destination_event_value" - assert response.source_copy_parameters is True + assert response.source_property == "source_property_value" -def test_create_event_create_rule_empty_call(): +def test_get_rollup_property_source_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -34589,18 +33658,18 @@ def test_create_event_create_rule_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_event_create_rule), "__call__" + type(client.transport.get_rollup_property_source_link), "__call__" ) as call: - client.create_event_create_rule() + client.get_rollup_property_source_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateEventCreateRuleRequest() + assert args[0] == analytics_admin.GetRollupPropertySourceLinkRequest() @pytest.mark.asyncio -async def test_create_event_create_rule_async( +async def test_get_rollup_property_source_link_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateEventCreateRuleRequest, + request_type=analytics_admin.GetRollupPropertySourceLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -34613,52 +33682,50 @@ async def test_create_event_create_rule_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_event_create_rule), "__call__" + type(client.transport.get_rollup_property_source_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - event_create_and_edit.EventCreateRule( + resources.RollupPropertySourceLink( name="name_value", - destination_event="destination_event_value", - source_copy_parameters=True, + source_property="source_property_value", ) ) - response = await client.create_event_create_rule(request) + response = await client.get_rollup_property_source_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateEventCreateRuleRequest() + assert args[0] == analytics_admin.GetRollupPropertySourceLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, event_create_and_edit.EventCreateRule) + assert isinstance(response, resources.RollupPropertySourceLink) assert response.name == "name_value" - assert response.destination_event == "destination_event_value" - assert response.source_copy_parameters is True + assert response.source_property == "source_property_value" @pytest.mark.asyncio -async def test_create_event_create_rule_async_from_dict(): - await test_create_event_create_rule_async(request_type=dict) +async def test_get_rollup_property_source_link_async_from_dict(): + await test_get_rollup_property_source_link_async(request_type=dict) -def test_create_event_create_rule_field_headers(): +def test_get_rollup_property_source_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateEventCreateRuleRequest() + request = analytics_admin.GetRollupPropertySourceLinkRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_event_create_rule), "__call__" + type(client.transport.get_rollup_property_source_link), "__call__" ) as call: - call.return_value = event_create_and_edit.EventCreateRule() - client.create_event_create_rule(request) + call.return_value = resources.RollupPropertySourceLink() + client.get_rollup_property_source_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -34669,30 +33736,30 @@ def test_create_event_create_rule_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_create_event_create_rule_field_headers_async(): +async def test_get_rollup_property_source_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateEventCreateRuleRequest() + request = analytics_admin.GetRollupPropertySourceLinkRequest() - request.parent = "parent_value" + request.name = "name_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_event_create_rule), "__call__" + type(client.transport.get_rollup_property_source_link), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - event_create_and_edit.EventCreateRule() + resources.RollupPropertySourceLink() ) - await client.create_event_create_rule(request) + await client.get_rollup_property_source_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -34703,41 +33770,37 @@ async def test_create_event_create_rule_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "parent=parent_value", + "name=name_value", ) in kw["metadata"] -def test_create_event_create_rule_flattened(): +def test_get_rollup_property_source_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_event_create_rule), "__call__" + type(client.transport.get_rollup_property_source_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = event_create_and_edit.EventCreateRule() + call.return_value = resources.RollupPropertySourceLink() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_event_create_rule( - parent="parent_value", - event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + client.get_rollup_property_source_link( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].event_create_rule - mock_val = event_create_and_edit.EventCreateRule(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val -def test_create_event_create_rule_flattened_error(): +def test_get_rollup_property_source_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -34745,50 +33808,45 @@ def test_create_event_create_rule_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_event_create_rule( - analytics_admin.CreateEventCreateRuleRequest(), - parent="parent_value", - event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + client.get_rollup_property_source_link( + analytics_admin.GetRollupPropertySourceLinkRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_create_event_create_rule_flattened_async(): +async def test_get_rollup_property_source_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_event_create_rule), "__call__" + type(client.transport.get_rollup_property_source_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = event_create_and_edit.EventCreateRule() + call.return_value = resources.RollupPropertySourceLink() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - event_create_and_edit.EventCreateRule() + resources.RollupPropertySourceLink() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_event_create_rule( - parent="parent_value", - event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + response = await client.get_rollup_property_source_link( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].parent - mock_val = "parent_value" - assert arg == mock_val - arg = args[0].event_create_rule - mock_val = event_create_and_edit.EventCreateRule(name="name_value") + arg = args[0].name + mock_val = "name_value" assert arg == mock_val @pytest.mark.asyncio -async def test_create_event_create_rule_flattened_error_async(): +async def test_get_rollup_property_source_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -34796,21 +33854,20 @@ async def test_create_event_create_rule_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_event_create_rule( - analytics_admin.CreateEventCreateRuleRequest(), - parent="parent_value", - event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + await client.get_rollup_property_source_link( + analytics_admin.GetRollupPropertySourceLinkRequest(), + name="name_value", ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateEventCreateRuleRequest, + analytics_admin.ListRollupPropertySourceLinksRequest, dict, ], ) -def test_update_event_create_rule(request_type, transport: str = "grpc"): +def test_list_rollup_property_source_links(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -34822,29 +33879,25 @@ def test_update_event_create_rule(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_event_create_rule), "__call__" + type(client.transport.list_rollup_property_source_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = event_create_and_edit.EventCreateRule( - name="name_value", - destination_event="destination_event_value", - source_copy_parameters=True, + call.return_value = analytics_admin.ListRollupPropertySourceLinksResponse( + next_page_token="next_page_token_value", ) - response = client.update_event_create_rule(request) + response = client.list_rollup_property_source_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateEventCreateRuleRequest() + assert args[0] == analytics_admin.ListRollupPropertySourceLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, event_create_and_edit.EventCreateRule) - assert response.name == "name_value" - assert response.destination_event == "destination_event_value" - assert response.source_copy_parameters is True + assert isinstance(response, pagers.ListRollupPropertySourceLinksPager) + assert response.next_page_token == "next_page_token_value" -def test_update_event_create_rule_empty_call(): +def test_list_rollup_property_source_links_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -34854,18 +33907,18 @@ def test_update_event_create_rule_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_event_create_rule), "__call__" + type(client.transport.list_rollup_property_source_links), "__call__" ) as call: - client.update_event_create_rule() + client.list_rollup_property_source_links() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateEventCreateRuleRequest() + assert args[0] == analytics_admin.ListRollupPropertySourceLinksRequest() @pytest.mark.asyncio -async def test_update_event_create_rule_async( +async def test_list_rollup_property_source_links_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateEventCreateRuleRequest, + request_type=analytics_admin.ListRollupPropertySourceLinksRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -34878,52 +33931,48 @@ async def test_update_event_create_rule_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_event_create_rule), "__call__" + type(client.transport.list_rollup_property_source_links), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - event_create_and_edit.EventCreateRule( - name="name_value", - destination_event="destination_event_value", - source_copy_parameters=True, + analytics_admin.ListRollupPropertySourceLinksResponse( + next_page_token="next_page_token_value", ) ) - response = await client.update_event_create_rule(request) + response = await client.list_rollup_property_source_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateEventCreateRuleRequest() + assert args[0] == analytics_admin.ListRollupPropertySourceLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, event_create_and_edit.EventCreateRule) - assert response.name == "name_value" - assert response.destination_event == "destination_event_value" - assert response.source_copy_parameters is True + assert isinstance(response, pagers.ListRollupPropertySourceLinksAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_update_event_create_rule_async_from_dict(): - await test_update_event_create_rule_async(request_type=dict) +async def test_list_rollup_property_source_links_async_from_dict(): + await test_list_rollup_property_source_links_async(request_type=dict) -def test_update_event_create_rule_field_headers(): +def test_list_rollup_property_source_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateEventCreateRuleRequest() + request = analytics_admin.ListRollupPropertySourceLinksRequest() - request.event_create_rule.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_event_create_rule), "__call__" + type(client.transport.list_rollup_property_source_links), "__call__" ) as call: - call.return_value = event_create_and_edit.EventCreateRule() - client.update_event_create_rule(request) + call.return_value = analytics_admin.ListRollupPropertySourceLinksResponse() + client.list_rollup_property_source_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -34934,30 +33983,30 @@ def test_update_event_create_rule_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "event_create_rule.name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_update_event_create_rule_field_headers_async(): +async def test_list_rollup_property_source_links_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateEventCreateRuleRequest() + request = analytics_admin.ListRollupPropertySourceLinksRequest() - request.event_create_rule.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_event_create_rule), "__call__" + type(client.transport.list_rollup_property_source_links), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - event_create_and_edit.EventCreateRule() + analytics_admin.ListRollupPropertySourceLinksResponse() ) - await client.update_event_create_rule(request) + await client.list_rollup_property_source_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -34968,41 +34017,37 @@ async def test_update_event_create_rule_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "event_create_rule.name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_update_event_create_rule_flattened(): +def test_list_rollup_property_source_links_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_event_create_rule), "__call__" + type(client.transport.list_rollup_property_source_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = event_create_and_edit.EventCreateRule() + call.return_value = analytics_admin.ListRollupPropertySourceLinksResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_event_create_rule( - event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.list_rollup_property_source_links( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].event_create_rule - mock_val = event_create_and_edit.EventCreateRule(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val -def test_update_event_create_rule_flattened_error(): +def test_list_rollup_property_source_links_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -35010,50 +34055,45 @@ def test_update_event_create_rule_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_event_create_rule( - analytics_admin.UpdateEventCreateRuleRequest(), - event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.list_rollup_property_source_links( + analytics_admin.ListRollupPropertySourceLinksRequest(), + parent="parent_value", ) @pytest.mark.asyncio -async def test_update_event_create_rule_flattened_async(): +async def test_list_rollup_property_source_links_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_event_create_rule), "__call__" + type(client.transport.list_rollup_property_source_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = event_create_and_edit.EventCreateRule() + call.return_value = analytics_admin.ListRollupPropertySourceLinksResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - event_create_and_edit.EventCreateRule() + analytics_admin.ListRollupPropertySourceLinksResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_event_create_rule( - event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + response = await client.list_rollup_property_source_links( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].event_create_rule - mock_val = event_create_and_edit.EventCreateRule(name="name_value") - assert arg == mock_val - arg = args[0].update_mask - mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + arg = args[0].parent + mock_val = "parent_value" assert arg == mock_val @pytest.mark.asyncio -async def test_update_event_create_rule_flattened_error_async(): +async def test_list_rollup_property_source_links_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -35061,21 +34101,218 @@ async def test_update_event_create_rule_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_event_create_rule( - analytics_admin.UpdateEventCreateRuleRequest(), - event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + await client.list_rollup_property_source_links( + analytics_admin.ListRollupPropertySourceLinksRequest(), + parent="parent_value", + ) + + +def test_list_rollup_property_source_links_pager(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollup_property_source_links), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[], + next_page_token="def", + ), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_rollup_property_source_links(request={}) + + assert pager._metadata == metadata + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.RollupPropertySourceLink) for i in results) + + +def test_list_rollup_property_source_links_pages(transport_name: str = "grpc"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + transport=transport_name, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollup_property_source_links), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[], + next_page_token="def", + ), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + ], + ), + RuntimeError, + ) + pages = list(client.list_rollup_property_source_links(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_rollup_property_source_links_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollup_property_source_links), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[], + next_page_token="def", + ), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_rollup_property_source_links( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: # pragma: no branch + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.RollupPropertySourceLink) for i in responses) + + +@pytest.mark.asyncio +async def test_list_rollup_property_source_links_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_rollup_property_source_links), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[], + next_page_token="def", + ), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + ], + ), + RuntimeError, ) + pages = [] + # Workaround issue in python 3.9 related to code coverage by adding `# pragma: no branch` + # See https://github.com/googleapis/gapic-generator-python/pull/1174#issuecomment-1025132372 + async for page_ in ( # pragma: no branch + await client.list_rollup_property_source_links(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteEventCreateRuleRequest, + analytics_admin.CreateRollupPropertySourceLinkRequest, dict, ], ) -def test_delete_event_create_rule(request_type, transport: str = "grpc"): +def test_create_rollup_property_source_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -35087,22 +34324,27 @@ def test_delete_event_create_rule(request_type, transport: str = "grpc"): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_event_create_rule), "__call__" + type(client.transport.create_rollup_property_source_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.delete_event_create_rule(request) + call.return_value = resources.RollupPropertySourceLink( + name="name_value", + source_property="source_property_value", + ) + response = client.create_rollup_property_source_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteEventCreateRuleRequest() + assert args[0] == analytics_admin.CreateRollupPropertySourceLinkRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.RollupPropertySourceLink) + assert response.name == "name_value" + assert response.source_property == "source_property_value" -def test_delete_event_create_rule_empty_call(): +def test_create_rollup_property_source_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -35112,18 +34354,18 @@ def test_delete_event_create_rule_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_event_create_rule), "__call__" + type(client.transport.create_rollup_property_source_link), "__call__" ) as call: - client.delete_event_create_rule() + client.create_rollup_property_source_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteEventCreateRuleRequest() + assert args[0] == analytics_admin.CreateRollupPropertySourceLinkRequest() @pytest.mark.asyncio -async def test_delete_event_create_rule_async( +async def test_create_rollup_property_source_link_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.DeleteEventCreateRuleRequest, + request_type=analytics_admin.CreateRollupPropertySourceLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), @@ -35136,43 +34378,50 @@ async def test_delete_event_create_rule_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_event_create_rule), "__call__" + type(client.transport.create_rollup_property_source_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.delete_event_create_rule(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.RollupPropertySourceLink( + name="name_value", + source_property="source_property_value", + ) + ) + response = await client.create_rollup_property_source_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.DeleteEventCreateRuleRequest() + assert args[0] == analytics_admin.CreateRollupPropertySourceLinkRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.RollupPropertySourceLink) + assert response.name == "name_value" + assert response.source_property == "source_property_value" @pytest.mark.asyncio -async def test_delete_event_create_rule_async_from_dict(): - await test_delete_event_create_rule_async(request_type=dict) +async def test_create_rollup_property_source_link_async_from_dict(): + await test_create_rollup_property_source_link_async(request_type=dict) -def test_delete_event_create_rule_field_headers(): +def test_create_rollup_property_source_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteEventCreateRuleRequest() + request = analytics_admin.CreateRollupPropertySourceLinkRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_event_create_rule), "__call__" + type(client.transport.create_rollup_property_source_link), "__call__" ) as call: - call.return_value = None - client.delete_event_create_rule(request) + call.return_value = resources.RollupPropertySourceLink() + client.create_rollup_property_source_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -35183,28 +34432,30 @@ def test_delete_event_create_rule_field_headers(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] @pytest.mark.asyncio -async def test_delete_event_create_rule_field_headers_async(): +async def test_create_rollup_property_source_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.DeleteEventCreateRuleRequest() + request = analytics_admin.CreateRollupPropertySourceLinkRequest() - request.name = "name_value" + request.parent = "parent_value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_event_create_rule), "__call__" + type(client.transport.create_rollup_property_source_link), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.delete_event_create_rule(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.RollupPropertySourceLink() + ) + await client.create_rollup_property_source_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -35215,37 +34466,43 @@ async def test_delete_event_create_rule_field_headers_async(): _, _, kw = call.mock_calls[0] assert ( "x-goog-request-params", - "name=name_value", + "parent=parent_value", ) in kw["metadata"] -def test_delete_event_create_rule_flattened(): +def test_create_rollup_property_source_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_event_create_rule), "__call__" + type(client.transport.create_rollup_property_source_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.RollupPropertySourceLink() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.delete_event_create_rule( - name="name_value", + client.create_rollup_property_source_link( + parent="parent_value", + rollup_property_source_link=resources.RollupPropertySourceLink( + name="name_value" + ), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].rollup_property_source_link + mock_val = resources.RollupPropertySourceLink(name="name_value") assert arg == mock_val -def test_delete_event_create_rule_flattened_error(): +def test_create_rollup_property_source_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -35253,43 +34510,54 @@ def test_delete_event_create_rule_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_event_create_rule( - analytics_admin.DeleteEventCreateRuleRequest(), - name="name_value", + client.create_rollup_property_source_link( + analytics_admin.CreateRollupPropertySourceLinkRequest(), + parent="parent_value", + rollup_property_source_link=resources.RollupPropertySourceLink( + name="name_value" + ), ) @pytest.mark.asyncio -async def test_delete_event_create_rule_flattened_async(): +async def test_create_rollup_property_source_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.delete_event_create_rule), "__call__" + type(client.transport.create_rollup_property_source_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.RollupPropertySourceLink() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.RollupPropertySourceLink() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.delete_event_create_rule( - name="name_value", + response = await client.create_rollup_property_source_link( + parent="parent_value", + rollup_property_source_link=resources.RollupPropertySourceLink( + name="name_value" + ), ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - arg = args[0].name - mock_val = "name_value" + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].rollup_property_source_link + mock_val = resources.RollupPropertySourceLink(name="name_value") assert arg == mock_val @pytest.mark.asyncio -async def test_delete_event_create_rule_flattened_error_async(): +async def test_create_rollup_property_source_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -35297,739 +34565,863 @@ async def test_delete_event_create_rule_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.delete_event_create_rule( - analytics_admin.DeleteEventCreateRuleRequest(), - name="name_value", + await client.create_rollup_property_source_link( + analytics_admin.CreateRollupPropertySourceLinkRequest(), + parent="parent_value", + rollup_property_source_link=resources.RollupPropertySourceLink( + name="name_value" + ), ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAccountRequest, + analytics_admin.DeleteRollupPropertySourceLinkRequest, dict, ], ) -def test_get_account_rest(request_type): +def test_delete_rollup_property_source_link(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="rest", + transport=transport, ) - # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1"} - request = request_type(**request_init) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = resources.Account( - name="name_value", - display_name="display_name_value", - region_code="region_code_value", - deleted=True, - ) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = resources.Account.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_rollup_property_source_link), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_rollup_property_source_link(request) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.get_account(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.DeleteRollupPropertySourceLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.Account) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.region_code == "region_code_value" - assert response.deleted is True + assert response is None -def test_get_account_rest_required_fields( - request_type=analytics_admin.GetAccountRequest, -): - transport_class = transports.AnalyticsAdminServiceRestTransport +def test_delete_rollup_property_source_link_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) - request_init = {} - request_init["name"] = "" - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads( - json_format.MessageToJson( - pb_request, - including_default_value_fields=False, - use_integers_for_enums=False, - ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_rollup_property_source_link), "__call__" + ) as call: + client.delete_rollup_property_source_link() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.DeleteRollupPropertySourceLinkRequest() + + +@pytest.mark.asyncio +async def test_delete_rollup_property_source_link_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.DeleteRollupPropertySourceLinkRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) - # verify fields with default values are dropped + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() - unset_fields = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ).get_account._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_rollup_property_source_link), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_rollup_property_source_link(request) - # verify required fields with default values are now present + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.DeleteRollupPropertySourceLinkRequest() - jsonified_request["name"] = "name_value" + # Establish that the response is the type that we expect. + assert response is None - unset_fields = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ).get_account._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" +@pytest.mark.asyncio +async def test_delete_rollup_property_source_link_async_from_dict(): + await test_delete_rollup_property_source_link_async(request_type=dict) + +def test_delete_rollup_property_source_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="rest", ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = resources.Account() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, "transcode") as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - "uri": "v1/sample_method", - "method": "get", - "query_params": pb_request, - } - transcode.return_value = transcode_result - response_value = Response() - response_value.status_code = 200 + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.DeleteRollupPropertySourceLinkRequest() - pb_return_value = resources.Account.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + request.name = "name_value" - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_rollup_property_source_link), "__call__" + ) as call: + call.return_value = None + client.delete_rollup_property_source_link(request) - response = client.get_account(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request - expected_params = [("$alt", "json;enum-encoding=int")] - actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -def test_get_account_rest_unset_required_fields(): - transport = transports.AnalyticsAdminServiceRestTransport( - credentials=ga_credentials.AnonymousCredentials +@pytest.mark.asyncio +async def test_delete_rollup_property_source_link_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), ) - unset_fields = transport.get_account._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.DeleteRollupPropertySourceLinkRequest() + request.name = "name_value" -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_account_rest_interceptors(null_interceptor): - transport = transports.AnalyticsAdminServiceRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.AnalyticsAdminServiceRestInterceptor(), - ) - client = AnalyticsAdminServiceClient(transport=transport) + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_account" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_account" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.GetAccountRequest.pb( - analytics_admin.GetAccountRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = resources.Account.to_json(resources.Account()) - - request = analytics_admin.GetAccountRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = resources.Account() + type(client.transport.delete_rollup_property_source_link), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_rollup_property_source_link(request) - client.get_account( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request - pre.assert_called_once() - post.assert_called_once() + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] -def test_get_account_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetAccountRequest -): +def test_delete_rollup_property_source_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1"} - request = request_type(**request_init) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_rollup_property_source_link), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_rollup_property_source_link( + name="name_value", + ) - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.get_account(request) + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val -def test_get_account_rest_flattened(): +def test_delete_rollup_property_source_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="rest", ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = resources.Account() - - # get arguments that satisfy an http rule for this method - sample_request = {"name": "accounts/sample1"} - - # get truthy value for each flattened field - mock_args = dict( + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_rollup_property_source_link( + analytics_admin.DeleteRollupPropertySourceLinkRequest(), name="name_value", ) - mock_args.update(sample_request) - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = resources.Account.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - client.get_account(**mock_args) +@pytest.mark.asyncio +async def test_delete_rollup_property_source_link_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_rollup_property_source_link), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_rollup_property_source_link( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{name=accounts/*}" % client.transport._host, args[1] - ) + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val -def test_get_account_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( +@pytest.mark.asyncio +async def test_delete_rollup_property_source_link_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_account( - analytics_admin.GetAccountRequest(), + await client.delete_rollup_property_source_link( + analytics_admin.DeleteRollupPropertySourceLinkRequest(), name="name_value", ) -def test_get_account_rest_error(): +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateSubpropertyRequest, + dict, + ], +) +def test_create_subproperty(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_subproperty), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.CreateSubpropertyResponse() + response = client.create_subproperty(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateSubpropertyRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, analytics_admin.CreateSubpropertyResponse) + + +def test_create_subproperty_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_subproperty), "__call__" + ) as call: + client.create_subproperty() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateSubpropertyRequest() + + +@pytest.mark.asyncio +async def test_create_subproperty_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.CreateSubpropertyRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_subproperty), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.CreateSubpropertyResponse() + ) + response = await client.create_subproperty(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateSubpropertyRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, analytics_admin.CreateSubpropertyResponse) + + +@pytest.mark.asyncio +async def test_create_subproperty_async_from_dict(): + await test_create_subproperty_async(request_type=dict) + @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAccountsRequest, + analytics_admin.DeleteSubpropertyEventFilterRequest, dict, ], ) -def test_list_accounts_rest(request_type): +def test_delete_subproperty_event_filter(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="rest", + transport=transport, ) - # send a request that will satisfy transcoding - request_init = {} - request = request_type(**request_init) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListAccountsResponse( - next_page_token="next_page_token_value", - ) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_subproperty_event_filter), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_subproperty_event_filter(request) - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = analytics_admin.ListAccountsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.DeleteSubpropertyEventFilterRequest() - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.list_accounts(request) + # Establish that the response is the type that we expect. + assert response is None + + +def test_delete_subproperty_event_filter_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_subproperty_event_filter), "__call__" + ) as call: + client.delete_subproperty_event_filter() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.DeleteSubpropertyEventFilterRequest() + + +@pytest.mark.asyncio +async def test_delete_subproperty_event_filter_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.DeleteSubpropertyEventFilterRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_subproperty_event_filter), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_subproperty_event_filter(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.DeleteSubpropertyEventFilterRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAccountsPager) - assert response.next_page_token == "next_page_token_value" + assert response is None -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_accounts_rest_interceptors(null_interceptor): - transport = transports.AnalyticsAdminServiceRestTransport( +@pytest.mark.asyncio +async def test_delete_subproperty_event_filter_async_from_dict(): + await test_delete_subproperty_event_filter_async(request_type=dict) + + +def test_delete_subproperty_event_filter_field_headers(): + client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.AnalyticsAdminServiceRestInterceptor(), ) - client = AnalyticsAdminServiceClient(transport=transport) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.DeleteSubpropertyEventFilterRequest() + + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_accounts" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_accounts" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.ListAccountsRequest.pb( - analytics_admin.ListAccountsRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } + type(client.transport.delete_subproperty_event_filter), "__call__" + ) as call: + call.return_value = None + client.delete_subproperty_event_filter(request) - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ListAccountsResponse.to_json( - analytics_admin.ListAccountsResponse() - ) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request - request = analytics_admin.ListAccountsRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = analytics_admin.ListAccountsResponse() + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] - client.list_accounts( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - pre.assert_called_once() - post.assert_called_once() +@pytest.mark.asyncio +async def test_delete_subproperty_event_filter_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.DeleteSubpropertyEventFilterRequest() -def test_list_accounts_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListAccountsRequest -): + request.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_subproperty_event_filter), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_subproperty_event_filter(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "name=name_value", + ) in kw["metadata"] + + +def test_delete_subproperty_event_filter_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # send a request that will satisfy transcoding - request_init = {} - request = request_type(**request_init) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_subproperty_event_filter), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_subproperty_event_filter( + name="name_value", + ) - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.list_accounts(request) + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val -def test_list_accounts_rest_pager(transport: str = "rest"): +def test_delete_subproperty_event_filter_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListAccountsResponse( - accounts=[ - resources.Account(), - resources.Account(), - resources.Account(), - ], - next_page_token="abc", - ), - analytics_admin.ListAccountsResponse( - accounts=[], - next_page_token="def", - ), - analytics_admin.ListAccountsResponse( - accounts=[ - resources.Account(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAccountsResponse( - accounts=[ - resources.Account(), - resources.Account(), - ], - ), + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_subproperty_event_filter( + analytics_admin.DeleteSubpropertyEventFilterRequest(), + name="name_value", ) - # Two responses for two calls - response = response + response - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListAccountsResponse.to_json(x) for x in response + +@pytest.mark.asyncio +async def test_delete_subproperty_event_filter_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_subproperty_event_filter), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_subproperty_event_filter( + name="name_value", ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - sample_request = {} + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].name + mock_val = "name_value" + assert arg == mock_val - pager = client.list_accounts(request=sample_request) - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.Account) for i in results) +@pytest.mark.asyncio +async def test_delete_subproperty_event_filter_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) - pages = list(client.list_accounts(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_subproperty_event_filter( + analytics_admin.DeleteSubpropertyEventFilterRequest(), + name="name_value", + ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteAccountRequest, + analytics_admin.CreateSubpropertyEventFilterRequest, dict, ], ) -def test_delete_account_rest(request_type): +def test_create_subproperty_event_filter(request_type, transport: str = "grpc"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="rest", + transport=transport, ) - # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = None + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = "" + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_subproperty_event_filter), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gaa_subproperty_event_filter.SubpropertyEventFilter( + name="name_value", + apply_to_property="apply_to_property_value", + ) + response = client.create_subproperty_event_filter(request) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.delete_account(request) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateSubpropertyEventFilterRequest() # Establish that the response is the type that we expect. - assert response is None - + assert isinstance(response, gaa_subproperty_event_filter.SubpropertyEventFilter) + assert response.name == "name_value" + assert response.apply_to_property == "apply_to_property_value" -def test_delete_account_rest_required_fields( - request_type=analytics_admin.DeleteAccountRequest, -): - transport_class = transports.AnalyticsAdminServiceRestTransport - request_init = {} - request_init["name"] = "" - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads( - json_format.MessageToJson( - pb_request, - including_default_value_fields=False, - use_integers_for_enums=False, - ) +def test_create_subproperty_event_filter_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="grpc", ) - # verify fields with default values are dropped - - unset_fields = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ).delete_account._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - jsonified_request["name"] = "name_value" + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_subproperty_event_filter), "__call__" + ) as call: + client.create_subproperty_event_filter() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateSubpropertyEventFilterRequest() - unset_fields = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ).delete_account._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" - - client = AnalyticsAdminServiceClient( +@pytest.mark.asyncio +async def test_create_subproperty_event_filter_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.CreateSubpropertyEventFilterRequest, +): + client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), - transport="rest", + transport=transport, ) - request = request_type(**request_init) - # Designate an appropriate value for the returned response. - return_value = None - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, "transcode") as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - "uri": "v1/sample_method", - "method": "delete", - "query_params": pb_request, - } - transcode.return_value = transcode_result + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() - response_value = Response() - response_value.status_code = 200 - json_return_value = "" + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_subproperty_event_filter), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gaa_subproperty_event_filter.SubpropertyEventFilter( + name="name_value", + apply_to_property="apply_to_property_value", + ) + ) + response = await client.create_subproperty_event_filter(request) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateSubpropertyEventFilterRequest() - response = client.delete_account(request) + # Establish that the response is the type that we expect. + assert isinstance(response, gaa_subproperty_event_filter.SubpropertyEventFilter) + assert response.name == "name_value" + assert response.apply_to_property == "apply_to_property_value" - expected_params = [("$alt", "json;enum-encoding=int")] - actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params +@pytest.mark.asyncio +async def test_create_subproperty_event_filter_async_from_dict(): + await test_create_subproperty_event_filter_async(request_type=dict) -def test_delete_account_rest_unset_required_fields(): - transport = transports.AnalyticsAdminServiceRestTransport( - credentials=ga_credentials.AnonymousCredentials + +def test_create_subproperty_event_filter_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), ) - unset_fields = transport.delete_account._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.CreateSubpropertyEventFilterRequest() + request.parent = "parent_value" -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_account_rest_interceptors(null_interceptor): - transport = transports.AnalyticsAdminServiceRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.AnalyticsAdminServiceRestInterceptor(), - ) - client = AnalyticsAdminServiceClient(transport=transport) + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_account" - ) as pre: - pre.assert_not_called() - pb_message = analytics_admin.DeleteAccountRequest.pb( - analytics_admin.DeleteAccountRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } + type(client.transport.create_subproperty_event_filter), "__call__" + ) as call: + call.return_value = gaa_subproperty_event_filter.SubpropertyEventFilter() + client.create_subproperty_event_filter(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - request = analytics_admin.DeleteAccountRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata +@pytest.mark.asyncio +async def test_create_subproperty_event_filter_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) - client.delete_account( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.CreateSubpropertyEventFilterRequest() + + request.parent = "parent_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_subproperty_event_filter), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gaa_subproperty_event_filter.SubpropertyEventFilter() ) + await client.create_subproperty_event_filter(request) - pre.assert_called_once() + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "parent=parent_value", + ) in kw["metadata"] -def test_delete_account_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteAccountRequest -): +def test_create_subproperty_event_filter_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) - # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1"} - request = request_type(**request_init) + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_subproperty_event_filter), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gaa_subproperty_event_filter.SubpropertyEventFilter() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_subproperty_event_filter( + parent="parent_value", + subproperty_event_filter=gaa_subproperty_event_filter.SubpropertyEventFilter( + name="name_value" + ), + ) - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.delete_account(request) + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].subproperty_event_filter + mock_val = gaa_subproperty_event_filter.SubpropertyEventFilter( + name="name_value" + ) + assert arg == mock_val -def test_delete_account_rest_flattened(): +def test_create_subproperty_event_filter_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="rest", ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = None + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_subproperty_event_filter( + analytics_admin.CreateSubpropertyEventFilterRequest(), + parent="parent_value", + subproperty_event_filter=gaa_subproperty_event_filter.SubpropertyEventFilter( + name="name_value" + ), + ) - # get arguments that satisfy an http rule for this method - sample_request = {"name": "accounts/sample1"} - # get truthy value for each flattened field - mock_args = dict( - name="name_value", - ) - mock_args.update(sample_request) +@pytest.mark.asyncio +async def test_create_subproperty_event_filter_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = "" - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_subproperty_event_filter), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = gaa_subproperty_event_filter.SubpropertyEventFilter() - client.delete_account(**mock_args) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + gaa_subproperty_event_filter.SubpropertyEventFilter() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_subproperty_event_filter( + parent="parent_value", + subproperty_event_filter=gaa_subproperty_event_filter.SubpropertyEventFilter( + name="name_value" + ), + ) # Establish that the underlying call was made with the expected # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{name=accounts/*}" % client.transport._host, args[1] + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + arg = args[0].parent + mock_val = "parent_value" + assert arg == mock_val + arg = args[0].subproperty_event_filter + mock_val = gaa_subproperty_event_filter.SubpropertyEventFilter( + name="name_value" ) + assert arg == mock_val -def test_delete_account_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( +@pytest.mark.asyncio +async def test_create_subproperty_event_filter_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, ) # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_account( - analytics_admin.DeleteAccountRequest(), - name="name_value", + await client.create_subproperty_event_filter( + analytics_admin.CreateSubpropertyEventFilterRequest(), + parent="parent_value", + subproperty_event_filter=gaa_subproperty_event_filter.SubpropertyEventFilter( + name="name_value" + ), ) -def test_delete_account_rest_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateAccountRequest, + analytics_admin.GetAccountRequest, dict, ], ) -def test_update_account_rest(request_type): +def test_get_account_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"account": {"name": "accounts/sample1"}} - request_init["account"] = { - "name": "accounts/sample1", - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "display_name": "display_name_value", - "region_code": "region_code_value", - "deleted": True, - } + request_init = {"name": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -36045,12 +35437,13 @@ def test_update_account_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Account.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Account.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_account(request) + response = client.get_account(request) # Establish that the response is the type that we expect. assert isinstance(response, resources.Account) @@ -36060,12 +35453,13 @@ def test_update_account_rest(request_type): assert response.deleted is True -def test_update_account_rest_required_fields( - request_type=analytics_admin.UpdateAccountRequest, +def test_get_account_rest_required_fields( + request_type=analytics_admin.GetAccountRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -36080,19 +35474,21 @@ def test_update_account_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_account._get_unset_required_fields(jsonified_request) + ).get_account._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["name"] = "name_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_account._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + ).get_account._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36113,47 +35509,39 @@ def test_update_account_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Account.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Account.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_account(request) + response = client.get_account(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_account_rest_unset_required_fields(): +def test_get_account_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_account._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(("updateMask",)) - & set( - ( - "account", - "updateMask", - ) - ) - ) + unset_fields = transport.get_account._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_account_rest_interceptors(null_interceptor): +def test_get_account_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -36166,14 +35554,14 @@ def test_update_account_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_account" + transports.AnalyticsAdminServiceRestInterceptor, "post_get_account" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_account" + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_account" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateAccountRequest.pb( - analytics_admin.UpdateAccountRequest() + pb_message = analytics_admin.GetAccountRequest.pb( + analytics_admin.GetAccountRequest() ) transcode.return_value = { "method": "post", @@ -36187,7 +35575,7 @@ def test_update_account_rest_interceptors(null_interceptor): req.return_value.request = PreparedRequest() req.return_value._content = resources.Account.to_json(resources.Account()) - request = analytics_admin.UpdateAccountRequest() + request = analytics_admin.GetAccountRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), @@ -36195,7 +35583,7 @@ def test_update_account_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = resources.Account() - client.update_account( + client.get_account( request, metadata=[ ("key", "val"), @@ -36207,8 +35595,8 @@ def test_update_account_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_account_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateAccountRequest +def test_get_account_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetAccountRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36216,15 +35604,7 @@ def test_update_account_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"account": {"name": "accounts/sample1"}} - request_init["account"] = { - "name": "accounts/sample1", - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "display_name": "display_name_value", - "region_code": "region_code_value", - "deleted": True, - } + request_init = {"name": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -36236,10 +35616,10 @@ def test_update_account_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_account(request) + client.get_account(request) -def test_update_account_rest_flattened(): +def test_get_account_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -36251,35 +35631,35 @@ def test_update_account_rest_flattened(): return_value = resources.Account() # get arguments that satisfy an http rule for this method - sample_request = {"account": {"name": "accounts/sample1"}} + sample_request = {"name": "accounts/sample1"} # get truthy value for each flattened field mock_args = dict( - account=resources.Account(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Account.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Account.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_account(**mock_args) + client.get_account(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{account.name=accounts/*}" % client.transport._host, args[1] + "%s/v1alpha/{name=accounts/*}" % client.transport._host, args[1] ) -def test_update_account_rest_flattened_error(transport: str = "rest"): +def test_get_account_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -36288,14 +35668,13 @@ def test_update_account_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_account( - analytics_admin.UpdateAccountRequest(), - account=resources.Account(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.get_account( + analytics_admin.GetAccountRequest(), + name="name_value", ) -def test_update_account_rest_error(): +def test_get_account_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -36304,11 +35683,11 @@ def test_update_account_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ProvisionAccountTicketRequest, + analytics_admin.ListAccountsRequest, dict, ], ) -def test_provision_account_ticket_rest(request_type): +def test_list_accounts_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -36321,29 +35700,28 @@ def test_provision_account_ticket_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ProvisionAccountTicketResponse( - account_ticket_id="account_ticket_id_value", + return_value = analytics_admin.ListAccountsResponse( + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ProvisionAccountTicketResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListAccountsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.provision_account_ticket(request) + response = client.list_accounts(request) # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.ProvisionAccountTicketResponse) - assert response.account_ticket_id == "account_ticket_id_value" + assert isinstance(response, pagers.ListAccountsPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_provision_account_ticket_rest_interceptors(null_interceptor): +def test_list_accounts_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -36356,14 +35734,14 @@ def test_provision_account_ticket_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_provision_account_ticket" + transports.AnalyticsAdminServiceRestInterceptor, "post_list_accounts" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_provision_account_ticket" + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_accounts" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ProvisionAccountTicketRequest.pb( - analytics_admin.ProvisionAccountTicketRequest() + pb_message = analytics_admin.ListAccountsRequest.pb( + analytics_admin.ListAccountsRequest() ) transcode.return_value = { "method": "post", @@ -36375,21 +35753,19 @@ def test_provision_account_ticket_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.ProvisionAccountTicketResponse.to_json( - analytics_admin.ProvisionAccountTicketResponse() - ) + req.return_value._content = analytics_admin.ListAccountsResponse.to_json( + analytics_admin.ListAccountsResponse() ) - request = analytics_admin.ProvisionAccountTicketRequest() + request = analytics_admin.ListAccountsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ProvisionAccountTicketResponse() + post.return_value = analytics_admin.ListAccountsResponse() - client.provision_account_ticket( + client.list_accounts( request, metadata=[ ("key", "val"), @@ -36401,8 +35777,8 @@ def test_provision_account_ticket_rest_interceptors(null_interceptor): post.assert_called_once() -def test_provision_account_ticket_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ProvisionAccountTicketRequest +def test_list_accounts_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListAccountsRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36422,56 +35798,193 @@ def test_provision_account_ticket_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.provision_account_ticket(request) + client.list_accounts(request) -def test_provision_account_ticket_rest_error(): +def test_list_accounts_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListAccountsResponse( + accounts=[ + resources.Account(), + resources.Account(), + resources.Account(), + ], + next_page_token="abc", + ), + analytics_admin.ListAccountsResponse( + accounts=[], + next_page_token="def", + ), + analytics_admin.ListAccountsResponse( + accounts=[ + resources.Account(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAccountsResponse( + accounts=[ + resources.Account(), + resources.Account(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListAccountsResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {} + + pager = client.list_accounts(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.Account) for i in results) + + pages = list(client.list_accounts(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAccountSummariesRequest, + analytics_admin.DeleteAccountRequest, dict, ], ) -def test_list_account_summaries_rest(request_type): +def test_delete_account_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {} + request_init = {"name": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListAccountSummariesResponse( - next_page_token="next_page_token_value", - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListAccountSummariesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_account_summaries(request) + response = client.delete_account(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAccountSummariesPager) - assert response.next_page_token == "next_page_token_value" + assert response is None + + +def test_delete_account_rest_required_fields( + request_type=analytics_admin.DeleteAccountRequest, +): + transport_class = transports.AnalyticsAdminServiceRestTransport + + request_init = {} + request_init["name"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson( + pb_request, + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).delete_account._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["name"] = "name_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).delete_account._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" + + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = None + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "delete", + "query_params": pb_request, + } + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + json_return_value = "" + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.delete_account(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_delete_account_rest_unset_required_fields(): + transport = transports.AnalyticsAdminServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.delete_account._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_account_summaries_rest_interceptors(null_interceptor): +def test_delete_account_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -36484,14 +35997,11 @@ def test_list_account_summaries_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_account_summaries" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_account_summaries" + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_account" ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.ListAccountSummariesRequest.pb( - analytics_admin.ListAccountSummariesRequest() + pb_message = analytics_admin.DeleteAccountRequest.pb( + analytics_admin.DeleteAccountRequest() ) transcode.return_value = { "method": "post", @@ -36503,21 +36013,15 @@ def test_list_account_summaries_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.ListAccountSummariesResponse.to_json( - analytics_admin.ListAccountSummariesResponse() - ) - ) - request = analytics_admin.ListAccountSummariesRequest() + request = analytics_admin.DeleteAccountRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListAccountSummariesResponse() - client.list_account_summaries( + client.delete_account( request, metadata=[ ("key", "val"), @@ -36526,11 +36030,10 @@ def test_list_account_summaries_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_list_account_summaries_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListAccountSummariesRequest +def test_delete_account_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeleteAccountRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36538,146 +36041,207 @@ def test_list_account_summaries_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {} + request_init = {"name": "accounts/sample1"} request = request_type(**request_init) - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.delete_account(request) + + +def test_delete_account_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = None + + # get arguments that satisfy an http rule for this method + sample_request = {"name": "accounts/sample1"} + + # get truthy value for each flattened field + mock_args = dict( + name="name_value", + ) + mock_args.update(sample_request) + # Wrap the value into a proper Response obj response_value = Response() - response_value.status_code = 400 - response_value.request = Request() + response_value.status_code = 200 + json_return_value = "" + response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_account_summaries(request) + client.delete_account(**mock_args) -def test_list_account_summaries_rest_pager(transport: str = "rest"): + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{name=accounts/*}" % client.transport._host, args[1] + ) + + +def test_delete_account_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListAccountSummariesResponse( - account_summaries=[ - resources.AccountSummary(), - resources.AccountSummary(), - resources.AccountSummary(), - ], - next_page_token="abc", - ), - analytics_admin.ListAccountSummariesResponse( - account_summaries=[], - next_page_token="def", - ), - analytics_admin.ListAccountSummariesResponse( - account_summaries=[ - resources.AccountSummary(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAccountSummariesResponse( - account_summaries=[ - resources.AccountSummary(), - resources.AccountSummary(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListAccountSummariesResponse.to_json(x) for x in response + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_account( + analytics_admin.DeleteAccountRequest(), + name="name_value", ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - sample_request = {} - - pager = client.list_account_summaries(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.AccountSummary) for i in results) - pages = list(client.list_account_summaries(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token +def test_delete_account_rest_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetPropertyRequest, + analytics_admin.UpdateAccountRequest, dict, ], ) -def test_get_property_rest(request_type): +def test_update_account_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1"} + request_init = {"account": {"name": "accounts/sample1"}} + request_init["account"] = { + "name": "accounts/sample1", + "create_time": {"seconds": 751, "nanos": 543}, + "update_time": {}, + "display_name": "display_name_value", + "region_code": "region_code_value", + "deleted": True, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateAccountRequest.meta.fields["account"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["account"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["account"][field])): + del request_init["account"][field][i][subfield] + else: + del request_init["account"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.Property( + return_value = resources.Account( name="name_value", - property_type=resources.PropertyType.PROPERTY_TYPE_ORDINARY, - parent="parent_value", display_name="display_name_value", - industry_category=resources.IndustryCategory.AUTOMOTIVE, - time_zone="time_zone_value", - currency_code="currency_code_value", - service_level=resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD, - account="account_value", + region_code="region_code_value", + deleted=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Account.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_property(request) + response = client.update_account(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.Property) + assert isinstance(response, resources.Account) assert response.name == "name_value" - assert response.property_type == resources.PropertyType.PROPERTY_TYPE_ORDINARY - assert response.parent == "parent_value" assert response.display_name == "display_name_value" - assert response.industry_category == resources.IndustryCategory.AUTOMOTIVE - assert response.time_zone == "time_zone_value" - assert response.currency_code == "currency_code_value" - assert response.service_level == resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD - assert response.account == "account_value" + assert response.region_code == "region_code_value" + assert response.deleted is True -def test_get_property_rest_required_fields( - request_type=analytics_admin.GetPropertyRequest, +def test_update_account_rest_required_fields( + request_type=analytics_admin.UpdateAccountRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -36692,21 +36256,19 @@ def test_get_property_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_property._get_unset_required_fields(jsonified_request) + ).update_account._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_property._get_unset_required_fields(jsonified_request) + ).update_account._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36715,7 +36277,7 @@ def test_get_property_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.Property() + return_value = resources.Account() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -36727,38 +36289,48 @@ def test_get_property_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "patch", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Account.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_property(request) + response = client.update_account(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_property_rest_unset_required_fields(): +def test_update_account_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_property._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.update_account._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("updateMask",)) + & set( + ( + "account", + "updateMask", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_property_rest_interceptors(null_interceptor): +def test_update_account_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -36771,14 +36343,14 @@ def test_get_property_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_property" + transports.AnalyticsAdminServiceRestInterceptor, "post_update_account" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_property" + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_account" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetPropertyRequest.pb( - analytics_admin.GetPropertyRequest() + pb_message = analytics_admin.UpdateAccountRequest.pb( + analytics_admin.UpdateAccountRequest() ) transcode.return_value = { "method": "post", @@ -36790,17 +36362,17 @@ def test_get_property_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.Property.to_json(resources.Property()) + req.return_value._content = resources.Account.to_json(resources.Account()) - request = analytics_admin.GetPropertyRequest() + request = analytics_admin.UpdateAccountRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.Property() + post.return_value = resources.Account() - client.get_property( + client.update_account( request, metadata=[ ("key", "val"), @@ -36812,8 +36384,8 @@ def test_get_property_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_property_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetPropertyRequest +def test_update_account_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateAccountRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -36821,7 +36393,7 @@ def test_get_property_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1"} + request_init = {"account": {"name": "accounts/sample1"}} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -36833,10 +36405,10 @@ def test_get_property_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_property(request) + client.update_account(request) -def test_get_property_rest_flattened(): +def test_update_account_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -36845,37 +36417,39 @@ def test_get_property_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.Property() + return_value = resources.Account() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1"} + sample_request = {"account": {"name": "accounts/sample1"}} # get truthy value for each flattened field mock_args = dict( - name="name_value", + account=resources.Account(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Account.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_property(**mock_args) + client.update_account(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*}" % client.transport._host, args[1] + "%s/v1alpha/{account.name=accounts/*}" % client.transport._host, args[1] ) -def test_get_property_rest_flattened_error(transport: str = "rest"): +def test_update_account_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -36884,13 +36458,14 @@ def test_get_property_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_property( - analytics_admin.GetPropertyRequest(), - name="name_value", + client.update_account( + analytics_admin.UpdateAccountRequest(), + account=resources.Account(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_get_property_rest_error(): +def test_update_account_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -36899,11 +36474,11 @@ def test_get_property_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListPropertiesRequest, + analytics_admin.ProvisionAccountTicketRequest, dict, ], ) -def test_list_properties_rest(request_type): +def test_provision_account_ticket_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -36916,141 +36491,157 @@ def test_list_properties_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListPropertiesResponse( - next_page_token="next_page_token_value", + return_value = analytics_admin.ProvisionAccountTicketResponse( + account_ticket_id="account_ticket_id_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListPropertiesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ProvisionAccountTicketResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_properties(request) + response = client.provision_account_ticket(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListPropertiesPager) - assert response.next_page_token == "next_page_token_value" - + assert isinstance(response, analytics_admin.ProvisionAccountTicketResponse) + assert response.account_ticket_id == "account_ticket_id_value" -def test_list_properties_rest_required_fields( - request_type=analytics_admin.ListPropertiesRequest, -): - transport_class = transports.AnalyticsAdminServiceRestTransport - request_init = {} - request_init["filter"] = "" - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads( - json_format.MessageToJson( - pb_request, - including_default_value_fields=False, - use_integers_for_enums=False, - ) +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_provision_account_ticket_rest_interceptors(null_interceptor): + transport = transports.AnalyticsAdminServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.AnalyticsAdminServiceRestInterceptor(), ) + client = AnalyticsAdminServiceClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "post_provision_account_ticket" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_provision_account_ticket" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = analytics_admin.ProvisionAccountTicketRequest.pb( + analytics_admin.ProvisionAccountTicketRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } - # verify fields with default values are dropped - assert "filter" not in jsonified_request - - unset_fields = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ).list_properties._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - assert "filter" in jsonified_request - assert jsonified_request["filter"] == request_init["filter"] + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = ( + analytics_admin.ProvisionAccountTicketResponse.to_json( + analytics_admin.ProvisionAccountTicketResponse() + ) + ) - jsonified_request["filter"] = "filter_value" + request = analytics_admin.ProvisionAccountTicketRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = analytics_admin.ProvisionAccountTicketResponse() - unset_fields = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ).list_properties._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "filter", - "page_size", - "page_token", - "show_deleted", + client.provision_account_ticket( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) - ) - jsonified_request.update(unset_fields) - # verify required fields with non-default values are left alone - assert "filter" in jsonified_request - assert jsonified_request["filter"] == "filter_value" + pre.assert_called_once() + post.assert_called_once() + +def test_provision_account_ticket_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ProvisionAccountTicketRequest +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="rest", + transport=transport, ) + + # send a request that will satisfy transcoding + request_init = {} request = request_type(**request_init) - # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListPropertiesResponse() - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, "transcode") as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - "uri": "v1/sample_method", - "method": "get", - "query_params": pb_request, - } - transcode.return_value = transcode_result + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.provision_account_ticket(request) - response_value = Response() - response_value.status_code = 200 - pb_return_value = analytics_admin.ListPropertiesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) +def test_provision_account_ticket_rest_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.list_properties(request) +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListAccountSummariesRequest, + dict, + ], +) +def test_list_account_summaries_rest(request_type): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) - expected_params = [ - ( - "filter", - "", - ), - ("$alt", "json;enum-encoding=int"), - ] - actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + # send a request that will satisfy transcoding + request_init = {} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = analytics_admin.ListAccountSummariesResponse( + next_page_token="next_page_token_value", + ) -def test_list_properties_rest_unset_required_fields(): - transport = transports.AnalyticsAdminServiceRestTransport( - credentials=ga_credentials.AnonymousCredentials - ) + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = analytics_admin.ListAccountSummariesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) - unset_fields = transport.list_properties._get_unset_required_fields({}) - assert set(unset_fields) == ( - set( - ( - "filter", - "pageSize", - "pageToken", - "showDeleted", - ) - ) - & set(("filter",)) - ) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.list_account_summaries(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListAccountSummariesPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_properties_rest_interceptors(null_interceptor): +def test_list_account_summaries_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -37063,14 +36654,14 @@ def test_list_properties_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_properties" + transports.AnalyticsAdminServiceRestInterceptor, "post_list_account_summaries" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_properties" + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_account_summaries" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListPropertiesRequest.pb( - analytics_admin.ListPropertiesRequest() + pb_message = analytics_admin.ListAccountSummariesRequest.pb( + analytics_admin.ListAccountSummariesRequest() ) transcode.return_value = { "method": "post", @@ -37082,19 +36673,21 @@ def test_list_properties_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ListPropertiesResponse.to_json( - analytics_admin.ListPropertiesResponse() + req.return_value._content = ( + analytics_admin.ListAccountSummariesResponse.to_json( + analytics_admin.ListAccountSummariesResponse() + ) ) - request = analytics_admin.ListPropertiesRequest() + request = analytics_admin.ListAccountSummariesRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListPropertiesResponse() + post.return_value = analytics_admin.ListAccountSummariesResponse() - client.list_properties( + client.list_account_summaries( request, metadata=[ ("key", "val"), @@ -37106,8 +36699,8 @@ def test_list_properties_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_properties_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListPropertiesRequest +def test_list_account_summaries_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListAccountSummariesRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37127,10 +36720,10 @@ def test_list_properties_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_properties(request) + client.list_account_summaries(request) -def test_list_properties_rest_pager(transport: str = "rest"): +def test_list_account_summaries_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -37142,28 +36735,28 @@ def test_list_properties_rest_pager(transport: str = "rest"): # with mock.patch.object(path_template, 'transcode') as transcode: # Set the response as a series of pages response = ( - analytics_admin.ListPropertiesResponse( - properties=[ - resources.Property(), - resources.Property(), - resources.Property(), + analytics_admin.ListAccountSummariesResponse( + account_summaries=[ + resources.AccountSummary(), + resources.AccountSummary(), + resources.AccountSummary(), ], next_page_token="abc", ), - analytics_admin.ListPropertiesResponse( - properties=[], + analytics_admin.ListAccountSummariesResponse( + account_summaries=[], next_page_token="def", ), - analytics_admin.ListPropertiesResponse( - properties=[ - resources.Property(), + analytics_admin.ListAccountSummariesResponse( + account_summaries=[ + resources.AccountSummary(), ], next_page_token="ghi", ), - analytics_admin.ListPropertiesResponse( - properties=[ - resources.Property(), - resources.Property(), + analytics_admin.ListAccountSummariesResponse( + account_summaries=[ + resources.AccountSummary(), + resources.AccountSummary(), ], ), ) @@ -37172,7 +36765,7 @@ def test_list_properties_rest_pager(transport: str = "rest"): # Wrap the values into proper Response objs response = tuple( - analytics_admin.ListPropertiesResponse.to_json(x) for x in response + analytics_admin.ListAccountSummariesResponse.to_json(x) for x in response ) return_values = tuple(Response() for i in response) for return_val, response_val in zip(return_values, response): @@ -37182,13 +36775,13 @@ def test_list_properties_rest_pager(transport: str = "rest"): sample_request = {} - pager = client.list_properties(request=sample_request) + pager = client.list_account_summaries(request=sample_request) results = list(pager) assert len(results) == 6 - assert all(isinstance(i, resources.Property) for i in results) + assert all(isinstance(i, resources.AccountSummary) for i in results) - pages = list(client.list_properties(request=sample_request).pages) + pages = list(client.list_account_summaries(request=sample_request).pages) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -37196,33 +36789,18 @@ def test_list_properties_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreatePropertyRequest, + analytics_admin.GetPropertyRequest, dict, ], ) -def test_create_property_rest(request_type): +def test_get_property_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {} - request_init["property"] = { - "name": "name_value", - "property_type": 1, - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "parent": "parent_value", - "display_name": "display_name_value", - "industry_category": 1, - "time_zone": "time_zone_value", - "currency_code": "currency_code_value", - "service_level": 1, - "delete_time": {}, - "expire_time": {}, - "account": "account_value", - } + request_init = {"name": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -37243,12 +36821,13 @@ def test_create_property_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_property(request) + response = client.get_property(request) # Establish that the response is the type that we expect. assert isinstance(response, resources.Property) @@ -37263,12 +36842,13 @@ def test_create_property_rest(request_type): assert response.account == "account_value" -def test_create_property_rest_required_fields( - request_type=analytics_admin.CreatePropertyRequest, +def test_get_property_rest_required_fields( + request_type=analytics_admin.GetPropertyRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -37283,17 +36863,21 @@ def test_create_property_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_property._get_unset_required_fields(jsonified_request) + ).get_property._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["name"] = "name_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_property._get_unset_required_fields(jsonified_request) + ).get_property._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37314,39 +36898,39 @@ def test_create_property_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_property(request) + response = client.get_property(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_property_rest_unset_required_fields(): +def test_get_property_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_property._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("property",))) + unset_fields = transport.get_property._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_property_rest_interceptors(null_interceptor): +def test_get_property_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -37359,14 +36943,14 @@ def test_create_property_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_property" + transports.AnalyticsAdminServiceRestInterceptor, "post_get_property" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_property" + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_property" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreatePropertyRequest.pb( - analytics_admin.CreatePropertyRequest() + pb_message = analytics_admin.GetPropertyRequest.pb( + analytics_admin.GetPropertyRequest() ) transcode.return_value = { "method": "post", @@ -37380,7 +36964,7 @@ def test_create_property_rest_interceptors(null_interceptor): req.return_value.request = PreparedRequest() req.return_value._content = resources.Property.to_json(resources.Property()) - request = analytics_admin.CreatePropertyRequest() + request = analytics_admin.GetPropertyRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), @@ -37388,7 +36972,7 @@ def test_create_property_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = resources.Property() - client.create_property( + client.get_property( request, metadata=[ ("key", "val"), @@ -37400,8 +36984,8 @@ def test_create_property_rest_interceptors(null_interceptor): post.assert_called_once() -def test_create_property_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreatePropertyRequest +def test_get_property_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetPropertyRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37409,22 +36993,7 @@ def test_create_property_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {} - request_init["property"] = { - "name": "name_value", - "property_type": 1, - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "parent": "parent_value", - "display_name": "display_name_value", - "industry_category": 1, - "time_zone": "time_zone_value", - "currency_code": "currency_code_value", - "service_level": 1, - "delete_time": {}, - "expire_time": {}, - "account": "account_value", - } + request_init = {"name": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -37436,10 +37005,10 @@ def test_create_property_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_property(request) + client.get_property(request) -def test_create_property_rest_flattened(): +def test_get_property_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -37451,34 +37020,35 @@ def test_create_property_rest_flattened(): return_value = resources.Property() # get arguments that satisfy an http rule for this method - sample_request = {} + sample_request = {"name": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - property=resources.Property(name="name_value"), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_property(**mock_args) + client.get_property(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/properties" % client.transport._host, args[1] + "%s/v1alpha/{name=properties/*}" % client.transport._host, args[1] ) -def test_create_property_rest_flattened_error(transport: str = "rest"): +def test_get_property_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -37487,13 +37057,13 @@ def test_create_property_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_property( - analytics_admin.CreatePropertyRequest(), - property=resources.Property(name="name_value"), + client.get_property( + analytics_admin.GetPropertyRequest(), + name="name_value", ) -def test_create_property_rest_error(): +def test_get_property_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -37502,65 +37072,50 @@ def test_create_property_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeletePropertyRequest, + analytics_admin.ListPropertiesRequest, dict, ], ) -def test_delete_property_rest(request_type): +def test_list_properties_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1"} + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.Property( - name="name_value", - property_type=resources.PropertyType.PROPERTY_TYPE_ORDINARY, - parent="parent_value", - display_name="display_name_value", - industry_category=resources.IndustryCategory.AUTOMOTIVE, - time_zone="time_zone_value", - currency_code="currency_code_value", - service_level=resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD, - account="account_value", + return_value = analytics_admin.ListPropertiesResponse( + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListPropertiesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_property(request) + response = client.list_properties(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.Property) - assert response.name == "name_value" - assert response.property_type == resources.PropertyType.PROPERTY_TYPE_ORDINARY - assert response.parent == "parent_value" - assert response.display_name == "display_name_value" - assert response.industry_category == resources.IndustryCategory.AUTOMOTIVE - assert response.time_zone == "time_zone_value" - assert response.currency_code == "currency_code_value" - assert response.service_level == resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD - assert response.account == "account_value" + assert isinstance(response, pagers.ListPropertiesPager) + assert response.next_page_token == "next_page_token_value" -def test_delete_property_rest_required_fields( - request_type=analytics_admin.DeletePropertyRequest, +def test_list_properties_rest_required_fields( + request_type=analytics_admin.ListPropertiesRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["filter"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -37572,24 +37127,36 @@ def test_delete_property_rest_required_fields( ) # verify fields with default values are dropped + assert "filter" not in jsonified_request unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_property._get_unset_required_fields(jsonified_request) + ).list_properties._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + assert "filter" in jsonified_request + assert jsonified_request["filter"] == request_init["filter"] - jsonified_request["name"] = "name_value" + jsonified_request["filter"] = "filter_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_property._get_unset_required_fields(jsonified_request) + ).list_properties._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "filter", + "page_size", + "page_token", + "show_deleted", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "filter" in jsonified_request + assert jsonified_request["filter"] == "filter_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37598,7 +37165,7 @@ def test_delete_property_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.Property() + return_value = analytics_admin.ListPropertiesResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -37610,7 +37177,7 @@ def test_delete_property_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "get", "query_params": pb_request, } transcode.return_value = transcode_result @@ -37618,30 +37185,47 @@ def test_delete_property_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListPropertiesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_property(request) + response = client.list_properties(request) - expected_params = [("$alt", "json;enum-encoding=int")] + expected_params = [ + ( + "filter", + "", + ), + ("$alt", "json;enum-encoding=int"), + ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_property_rest_unset_required_fields(): +def test_list_properties_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_property._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.list_properties._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "filter", + "pageSize", + "pageToken", + "showDeleted", + ) + ) + & set(("filter",)) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_property_rest_interceptors(null_interceptor): +def test_list_properties_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -37654,14 +37238,14 @@ def test_delete_property_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_delete_property" + transports.AnalyticsAdminServiceRestInterceptor, "post_list_properties" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_property" + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_properties" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.DeletePropertyRequest.pb( - analytics_admin.DeletePropertyRequest() + pb_message = analytics_admin.ListPropertiesRequest.pb( + analytics_admin.ListPropertiesRequest() ) transcode.return_value = { "method": "post", @@ -37673,17 +37257,19 @@ def test_delete_property_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.Property.to_json(resources.Property()) + req.return_value._content = analytics_admin.ListPropertiesResponse.to_json( + analytics_admin.ListPropertiesResponse() + ) - request = analytics_admin.DeletePropertyRequest() + request = analytics_admin.ListPropertiesRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.Property() + post.return_value = analytics_admin.ListPropertiesResponse() - client.delete_property( + client.list_properties( request, metadata=[ ("key", "val"), @@ -37695,8 +37281,8 @@ def test_delete_property_rest_interceptors(null_interceptor): post.assert_called_once() -def test_delete_property_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeletePropertyRequest +def test_list_properties_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListPropertiesRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -37704,7 +37290,7 @@ def test_delete_property_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1"} + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -37716,86 +37302,89 @@ def test_delete_property_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_property(request) + client.list_properties(request) -def test_delete_property_rest_flattened(): +def test_list_properties_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="rest", + transport=transport, ) # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = resources.Property() - - # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1"} - - # get truthy value for each flattened field - mock_args = dict( - name="name_value", + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListPropertiesResponse( + properties=[ + resources.Property(), + resources.Property(), + resources.Property(), + ], + next_page_token="abc", + ), + analytics_admin.ListPropertiesResponse( + properties=[], + next_page_token="def", + ), + analytics_admin.ListPropertiesResponse( + properties=[ + resources.Property(), + ], + next_page_token="ghi", + ), + analytics_admin.ListPropertiesResponse( + properties=[ + resources.Property(), + resources.Property(), + ], + ), ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.delete_property(**mock_args) + # Two responses for two calls + response = response + response - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{name=properties/*}" % client.transport._host, args[1] + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListPropertiesResponse.to_json(x) for x in response ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + sample_request = {} -def test_delete_property_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_property( - analytics_admin.DeletePropertyRequest(), - name="name_value", - ) + pager = client.list_properties(request=sample_request) + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.Property) for i in results) -def test_delete_property_rest_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) + pages = list(client.list_properties(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdatePropertyRequest, + analytics_admin.CreatePropertyRequest, dict, ], ) -def test_update_property_rest(request_type): +def test_create_property_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"property": {"name": "properties/sample1"}} + request_init = {} request_init["property"] = { - "name": "properties/sample1", + "name": "name_value", "property_type": 1, "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, @@ -37809,6 +37398,73 @@ def test_update_property_rest(request_type): "expire_time": {}, "account": "account_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreatePropertyRequest.meta.fields["property"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["property"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["property"][field])): + del request_init["property"][field][i][subfield] + else: + del request_init["property"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -37829,12 +37485,13 @@ def test_update_property_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_property(request) + response = client.create_property(request) # Establish that the response is the type that we expect. assert isinstance(response, resources.Property) @@ -37849,8 +37506,8 @@ def test_update_property_rest(request_type): assert response.account == "account_value" -def test_update_property_rest_required_fields( - request_type=analytics_admin.UpdatePropertyRequest, +def test_create_property_rest_required_fields( + request_type=analytics_admin.CreatePropertyRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -37869,16 +37526,14 @@ def test_update_property_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_property._get_unset_required_fields(jsonified_request) + ).create_property._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_property._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + ).create_property._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -37902,7 +37557,7 @@ def test_update_property_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "post", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -37911,38 +37566,31 @@ def test_update_property_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_property(request) + response = client.create_property(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_property_rest_unset_required_fields(): +def test_create_property_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_property._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(("updateMask",)) - & set( - ( - "property", - "updateMask", - ) - ) - ) + unset_fields = transport.create_property._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("property",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_property_rest_interceptors(null_interceptor): +def test_create_property_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -37955,14 +37603,14 @@ def test_update_property_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_property" + transports.AnalyticsAdminServiceRestInterceptor, "post_create_property" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_property" + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_property" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdatePropertyRequest.pb( - analytics_admin.UpdatePropertyRequest() + pb_message = analytics_admin.CreatePropertyRequest.pb( + analytics_admin.CreatePropertyRequest() ) transcode.return_value = { "method": "post", @@ -37976,7 +37624,7 @@ def test_update_property_rest_interceptors(null_interceptor): req.return_value.request = PreparedRequest() req.return_value._content = resources.Property.to_json(resources.Property()) - request = analytics_admin.UpdatePropertyRequest() + request = analytics_admin.CreatePropertyRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), @@ -37984,7 +37632,7 @@ def test_update_property_rest_interceptors(null_interceptor): pre.return_value = request, metadata post.return_value = resources.Property() - client.update_property( + client.create_property( request, metadata=[ ("key", "val"), @@ -37996,8 +37644,8 @@ def test_update_property_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_property_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdatePropertyRequest +def test_create_property_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreatePropertyRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -38005,22 +37653,7 @@ def test_update_property_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"property": {"name": "properties/sample1"}} - request_init["property"] = { - "name": "properties/sample1", - "property_type": 1, - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "parent": "parent_value", - "display_name": "display_name_value", - "industry_category": 1, - "time_zone": "time_zone_value", - "currency_code": "currency_code_value", - "service_level": 1, - "delete_time": {}, - "expire_time": {}, - "account": "account_value", - } + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -38032,10 +37665,10 @@ def test_update_property_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_property(request) + client.create_property(request) -def test_update_property_rest_flattened(): +def test_create_property_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -38047,35 +37680,35 @@ def test_update_property_rest_flattened(): return_value = resources.Property() # get arguments that satisfy an http rule for this method - sample_request = {"property": {"name": "properties/sample1"}} + sample_request = {} # get truthy value for each flattened field mock_args = dict( property=resources.Property(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_property(**mock_args) + client.create_property(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{property.name=properties/*}" % client.transport._host, args[1] + "%s/v1alpha/properties" % client.transport._host, args[1] ) -def test_update_property_rest_flattened_error(transport: str = "rest"): +def test_create_property_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -38084,14 +37717,13 @@ def test_update_property_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_property( - analytics_admin.UpdatePropertyRequest(), + client.create_property( + analytics_admin.CreatePropertyRequest(), property=resources.Property(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_update_property_rest_error(): +def test_create_property_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -38100,48 +37732,61 @@ def test_update_property_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetUserLinkRequest, + analytics_admin.DeletePropertyRequest, dict, ], ) -def test_get_user_link_rest(request_type): +def test_delete_property_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1/userLinks/sample2"} + request_init = {"name": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.UserLink( + return_value = resources.Property( name="name_value", - email_address="email_address_value", - direct_roles=["direct_roles_value"], + property_type=resources.PropertyType.PROPERTY_TYPE_ORDINARY, + parent="parent_value", + display_name="display_name_value", + industry_category=resources.IndustryCategory.AUTOMOTIVE, + time_zone="time_zone_value", + currency_code="currency_code_value", + service_level=resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD, + account="account_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.UserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_user_link(request) + response = client.delete_property(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.UserLink) + assert isinstance(response, resources.Property) assert response.name == "name_value" - assert response.email_address == "email_address_value" - assert response.direct_roles == ["direct_roles_value"] + assert response.property_type == resources.PropertyType.PROPERTY_TYPE_ORDINARY + assert response.parent == "parent_value" + assert response.display_name == "display_name_value" + assert response.industry_category == resources.IndustryCategory.AUTOMOTIVE + assert response.time_zone == "time_zone_value" + assert response.currency_code == "currency_code_value" + assert response.service_level == resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD + assert response.account == "account_value" -def test_get_user_link_rest_required_fields( - request_type=analytics_admin.GetUserLinkRequest, +def test_delete_property_rest_required_fields( + request_type=analytics_admin.DeletePropertyRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -38161,7 +37806,7 @@ def test_get_user_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_user_link._get_unset_required_fields(jsonified_request) + ).delete_property._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -38170,7 +37815,7 @@ def test_get_user_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_user_link._get_unset_required_fields(jsonified_request) + ).delete_property._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -38184,7 +37829,7 @@ def test_get_user_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.UserLink() + return_value = resources.Property() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -38196,7 +37841,7 @@ def test_get_user_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "delete", "query_params": pb_request, } transcode.return_value = transcode_result @@ -38204,30 +37849,31 @@ def test_get_user_link_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.UserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_user_link(request) + response = client.delete_property(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_user_link_rest_unset_required_fields(): +def test_delete_property_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_user_link._get_unset_required_fields({}) + unset_fields = transport.delete_property._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_user_link_rest_interceptors(null_interceptor): +def test_delete_property_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -38240,14 +37886,14 @@ def test_get_user_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_user_link" + transports.AnalyticsAdminServiceRestInterceptor, "post_delete_property" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_user_link" + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_property" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetUserLinkRequest.pb( - analytics_admin.GetUserLinkRequest() + pb_message = analytics_admin.DeletePropertyRequest.pb( + analytics_admin.DeletePropertyRequest() ) transcode.return_value = { "method": "post", @@ -38259,17 +37905,17 @@ def test_get_user_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.UserLink.to_json(resources.UserLink()) + req.return_value._content = resources.Property.to_json(resources.Property()) - request = analytics_admin.GetUserLinkRequest() + request = analytics_admin.DeletePropertyRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.UserLink() + post.return_value = resources.Property() - client.get_user_link( + client.delete_property( request, metadata=[ ("key", "val"), @@ -38281,8 +37927,8 @@ def test_get_user_link_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_user_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetUserLinkRequest +def test_delete_property_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeletePropertyRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -38290,7 +37936,7 @@ def test_get_user_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1/userLinks/sample2"} + request_init = {"name": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -38302,10 +37948,10 @@ def test_get_user_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_user_link(request) + client.delete_property(request) -def test_get_user_link_rest_flattened(): +def test_delete_property_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -38314,10 +37960,10 @@ def test_get_user_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.UserLink() + return_value = resources.Property() # get arguments that satisfy an http rule for this method - sample_request = {"name": "accounts/sample1/userLinks/sample2"} + sample_request = {"name": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( @@ -38328,23 +37974,24 @@ def test_get_user_link_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.UserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_user_link(**mock_args) + client.delete_property(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=accounts/*/userLinks/*}" % client.transport._host, args[1] + "%s/v1alpha/{name=properties/*}" % client.transport._host, args[1] ) -def test_get_user_link_rest_flattened_error(transport: str = "rest"): +def test_delete_property_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -38353,13 +38000,13 @@ def test_get_user_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_user_link( - analytics_admin.GetUserLinkRequest(), + client.delete_property( + analytics_admin.DeletePropertyRequest(), name="name_value", ) -def test_get_user_link_rest_error(): +def test_delete_property_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -38368,47 +38015,147 @@ def test_get_user_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchGetUserLinksRequest, + analytics_admin.UpdatePropertyRequest, dict, ], ) -def test_batch_get_user_links_rest(request_type): +def test_update_property_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) - # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + # send a request that will satisfy transcoding + request_init = {"property": {"name": "properties/sample1"}} + request_init["property"] = { + "name": "properties/sample1", + "property_type": 1, + "create_time": {"seconds": 751, "nanos": 543}, + "update_time": {}, + "parent": "parent_value", + "display_name": "display_name_value", + "industry_category": 1, + "time_zone": "time_zone_value", + "currency_code": "currency_code_value", + "service_level": 1, + "delete_time": {}, + "expire_time": {}, + "account": "account_value", + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdatePropertyRequest.meta.fields["property"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["property"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["property"][field])): + del request_init["property"][field][i][subfield] + else: + del request_init["property"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.BatchGetUserLinksResponse() + return_value = resources.Property( + name="name_value", + property_type=resources.PropertyType.PROPERTY_TYPE_ORDINARY, + parent="parent_value", + display_name="display_name_value", + industry_category=resources.IndustryCategory.AUTOMOTIVE, + time_zone="time_zone_value", + currency_code="currency_code_value", + service_level=resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD, + account="account_value", + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.BatchGetUserLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_get_user_links(request) + response = client.update_property(request) # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchGetUserLinksResponse) + assert isinstance(response, resources.Property) + assert response.name == "name_value" + assert response.property_type == resources.PropertyType.PROPERTY_TYPE_ORDINARY + assert response.parent == "parent_value" + assert response.display_name == "display_name_value" + assert response.industry_category == resources.IndustryCategory.AUTOMOTIVE + assert response.time_zone == "time_zone_value" + assert response.currency_code == "currency_code_value" + assert response.service_level == resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD + assert response.account == "account_value" -def test_batch_get_user_links_rest_required_fields( - request_type=analytics_admin.BatchGetUserLinksRequest, +def test_update_property_rest_required_fields( + request_type=analytics_admin.UpdatePropertyRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" - request_init["names"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -38420,32 +38167,22 @@ def test_batch_get_user_links_rest_required_fields( ) # verify fields with default values are dropped - assert "names" not in jsonified_request unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_get_user_links._get_unset_required_fields(jsonified_request) + ).update_property._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - assert "names" in jsonified_request - assert jsonified_request["names"] == request_init["names"] - - jsonified_request["parent"] = "parent_value" - jsonified_request["names"] = "names_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_get_user_links._get_unset_required_fields(jsonified_request) + ).update_property._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("names",)) + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" - assert "names" in jsonified_request - assert jsonified_request["names"] == "names_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -38454,7 +38191,7 @@ def test_batch_get_user_links_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.BatchGetUserLinksResponse() + return_value = resources.Property() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -38466,52 +38203,48 @@ def test_batch_get_user_links_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "patch", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.BatchGetUserLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_get_user_links(request) + response = client.update_property(request) - expected_params = [ - ( - "names", - "", - ), - ("$alt", "json;enum-encoding=int"), - ] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_batch_get_user_links_rest_unset_required_fields(): +def test_update_property_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.batch_get_user_links._get_unset_required_fields({}) + unset_fields = transport.update_property._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("names",)) + set(("updateMask",)) & set( ( - "parent", - "names", + "property", + "updateMask", ) ) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_batch_get_user_links_rest_interceptors(null_interceptor): +def test_update_property_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -38524,14 +38257,14 @@ def test_batch_get_user_links_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_batch_get_user_links" + transports.AnalyticsAdminServiceRestInterceptor, "post_update_property" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_batch_get_user_links" + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_property" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.BatchGetUserLinksRequest.pb( - analytics_admin.BatchGetUserLinksRequest() + pb_message = analytics_admin.UpdatePropertyRequest.pb( + analytics_admin.UpdatePropertyRequest() ) transcode.return_value = { "method": "post", @@ -38543,19 +38276,17 @@ def test_batch_get_user_links_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.BatchGetUserLinksResponse.to_json( - analytics_admin.BatchGetUserLinksResponse() - ) + req.return_value._content = resources.Property.to_json(resources.Property()) - request = analytics_admin.BatchGetUserLinksRequest() + request = analytics_admin.UpdatePropertyRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.BatchGetUserLinksResponse() + post.return_value = resources.Property() - client.batch_get_user_links( + client.update_property( request, metadata=[ ("key", "val"), @@ -38567,8 +38298,8 @@ def test_batch_get_user_links_rest_interceptors(null_interceptor): post.assert_called_once() -def test_batch_get_user_links_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.BatchGetUserLinksRequest +def test_update_property_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdatePropertyRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -38576,7 +38307,7 @@ def test_batch_get_user_links_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"property": {"name": "properties/sample1"}} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -38588,10 +38319,67 @@ def test_batch_get_user_links_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.batch_get_user_links(request) + client.update_property(request) + + +def test_update_property_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resources.Property() + + # get arguments that satisfy an http rule for this method + sample_request = {"property": {"name": "properties/sample1"}} + + # get truthy value for each flattened field + mock_args = dict( + property=resources.Property(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.update_property(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{property.name=properties/*}" % client.transport._host, args[1] + ) + +def test_update_property_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_property( + analytics_admin.UpdatePropertyRequest(), + property=resources.Property(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) -def test_batch_get_user_links_rest_error(): + +def test_update_property_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -38600,44 +38388,119 @@ def test_batch_get_user_links_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListUserLinksRequest, + analytics_admin.CreateFirebaseLinkRequest, dict, ], ) -def test_list_user_links_rest(request_type): +def test_create_firebase_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"parent": "properties/sample1"} + request_init["firebase_link"] = { + "name": "name_value", + "project": "project_value", + "create_time": {"seconds": 751, "nanos": 543}, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateFirebaseLinkRequest.meta.fields["firebase_link"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["firebase_link"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["firebase_link"][field])): + del request_init["firebase_link"][field][i][subfield] + else: + del request_init["firebase_link"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListUserLinksResponse( - next_page_token="next_page_token_value", + return_value = resources.FirebaseLink( + name="name_value", + project="project_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListUserLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.FirebaseLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_user_links(request) + response = client.create_firebase_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListUserLinksPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.FirebaseLink) + assert response.name == "name_value" + assert response.project == "project_value" -def test_list_user_links_rest_required_fields( - request_type=analytics_admin.ListUserLinksRequest, +def test_create_firebase_link_rest_required_fields( + request_type=analytics_admin.CreateFirebaseLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -38657,7 +38520,7 @@ def test_list_user_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_user_links._get_unset_required_fields(jsonified_request) + ).create_firebase_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -38666,14 +38529,7 @@ def test_list_user_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_user_links._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) - ) + ).create_firebase_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -38687,7 +38543,7 @@ def test_list_user_links_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListUserLinksResponse() + return_value = resources.FirebaseLink() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -38699,46 +38555,48 @@ def test_list_user_links_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListUserLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.FirebaseLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_user_links(request) + response = client.create_firebase_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_user_links_rest_unset_required_fields(): +def test_create_firebase_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_user_links._get_unset_required_fields({}) + unset_fields = transport.create_firebase_link._get_unset_required_fields({}) assert set(unset_fields) == ( - set( + set(()) + & set( ( - "pageSize", - "pageToken", + "parent", + "firebaseLink", ) ) - & set(("parent",)) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_user_links_rest_interceptors(null_interceptor): +def test_create_firebase_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -38751,14 +38609,14 @@ def test_list_user_links_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_user_links" + transports.AnalyticsAdminServiceRestInterceptor, "post_create_firebase_link" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_user_links" + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_firebase_link" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListUserLinksRequest.pb( - analytics_admin.ListUserLinksRequest() + pb_message = analytics_admin.CreateFirebaseLinkRequest.pb( + analytics_admin.CreateFirebaseLinkRequest() ) transcode.return_value = { "method": "post", @@ -38770,19 +38628,19 @@ def test_list_user_links_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ListUserLinksResponse.to_json( - analytics_admin.ListUserLinksResponse() + req.return_value._content = resources.FirebaseLink.to_json( + resources.FirebaseLink() ) - request = analytics_admin.ListUserLinksRequest() + request = analytics_admin.CreateFirebaseLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListUserLinksResponse() + post.return_value = resources.FirebaseLink() - client.list_user_links( + client.create_firebase_link( request, metadata=[ ("key", "val"), @@ -38794,8 +38652,8 @@ def test_list_user_links_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_user_links_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListUserLinksRequest +def test_create_firebase_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateFirebaseLinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -38803,7 +38661,7 @@ def test_list_user_links_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -38815,10 +38673,10 @@ def test_list_user_links_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_user_links(request) + client.create_firebase_link(request) -def test_list_user_links_rest_flattened(): +def test_create_firebase_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -38827,37 +38685,40 @@ def test_list_user_links_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListUserLinksResponse() + return_value = resources.FirebaseLink() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "accounts/sample1"} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( parent="parent_value", + firebase_link=resources.FirebaseLink(name="name_value"), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListUserLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.FirebaseLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_user_links(**mock_args) + client.create_firebase_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=accounts/*}/userLinks" % client.transport._host, args[1] + "%s/v1alpha/{parent=properties/*}/firebaseLinks" % client.transport._host, + args[1], ) -def test_list_user_links_rest_flattened_error(transport: str = "rest"): +def test_create_firebase_link_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -38866,121 +38727,61 @@ def test_list_user_links_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_user_links( - analytics_admin.ListUserLinksRequest(), + client.create_firebase_link( + analytics_admin.CreateFirebaseLinkRequest(), parent="parent_value", + firebase_link=resources.FirebaseLink(name="name_value"), ) -def test_list_user_links_rest_pager(transport: str = "rest"): +def test_create_firebase_link_rest_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), - resources.UserLink(), - resources.UserLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListUserLinksResponse( - user_links=[], - next_page_token="def", - ), - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListUserLinksResponse( - user_links=[ - resources.UserLink(), - resources.UserLink(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListUserLinksResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "accounts/sample1"} - - pager = client.list_user_links(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.UserLink) for i in results) - - pages = list(client.list_user_links(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - @pytest.mark.parametrize( "request_type", [ - analytics_admin.AuditUserLinksRequest, + analytics_admin.DeleteFirebaseLinkRequest, dict, ], ) -def test_audit_user_links_rest(request_type): +def test_delete_firebase_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"name": "properties/sample1/firebaseLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.AuditUserLinksResponse( - next_page_token="next_page_token_value", - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.AuditUserLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.audit_user_links(request) + response = client.delete_firebase_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.AuditUserLinksPager) - assert response.next_page_token == "next_page_token_value" + assert response is None -def test_audit_user_links_rest_required_fields( - request_type=analytics_admin.AuditUserLinksRequest, +def test_delete_firebase_link_rest_required_fields( + request_type=analytics_admin.DeleteFirebaseLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -38995,21 +38796,21 @@ def test_audit_user_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).audit_user_links._get_unset_required_fields(jsonified_request) + ).delete_firebase_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).audit_user_links._get_unset_required_fields(jsonified_request) + ).delete_firebase_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -39018,7 +38819,7 @@ def test_audit_user_links_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.AuditUserLinksResponse() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -39030,39 +38831,36 @@ def test_audit_user_links_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "delete", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = analytics_admin.AuditUserLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.audit_user_links(request) + response = client.delete_firebase_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_audit_user_links_rest_unset_required_fields(): +def test_delete_firebase_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.audit_user_links._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("parent",))) + unset_fields = transport.delete_firebase_link._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_audit_user_links_rest_interceptors(null_interceptor): +def test_delete_firebase_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -39075,14 +38873,11 @@ def test_audit_user_links_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_audit_user_links" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_audit_user_links" + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_firebase_link" ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.AuditUserLinksRequest.pb( - analytics_admin.AuditUserLinksRequest() + pb_message = analytics_admin.DeleteFirebaseLinkRequest.pb( + analytics_admin.DeleteFirebaseLinkRequest() ) transcode.return_value = { "method": "post", @@ -39094,19 +38889,15 @@ def test_audit_user_links_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.AuditUserLinksResponse.to_json( - analytics_admin.AuditUserLinksResponse() - ) - request = analytics_admin.AuditUserLinksRequest() + request = analytics_admin.DeleteFirebaseLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.AuditUserLinksResponse() - client.audit_user_links( + client.delete_firebase_link( request, metadata=[ ("key", "val"), @@ -39115,11 +38906,10 @@ def test_audit_user_links_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_audit_user_links_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.AuditUserLinksRequest +def test_delete_firebase_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeleteFirebaseLinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -39127,7 +38917,7 @@ def test_audit_user_links_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"name": "properties/sample1/firebaseLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -39139,122 +38929,111 @@ def test_audit_user_links_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.audit_user_links(request) + client.delete_firebase_link(request) -def test_audit_user_links_rest_pager(transport: str = "rest"): +def test_delete_firebase_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + transport="rest", ) # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - resources.AuditUserLink(), - resources.AuditUserLink(), - ], - next_page_token="abc", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[], - next_page_token="def", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - ], - next_page_token="ghi", - ), - analytics_admin.AuditUserLinksResponse( - user_links=[ - resources.AuditUserLink(), - resources.AuditUserLink(), - ], - ), + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = None + + # get arguments that satisfy an http rule for this method + sample_request = {"name": "properties/sample1/firebaseLinks/sample2"} + + # get truthy value for each flattened field + mock_args = dict( + name="name_value", ) - # Two responses for two calls - response = response + response + mock_args.update(sample_request) - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.AuditUserLinksResponse.to_json(x) for x in response + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = "" + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.delete_firebase_link(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{name=properties/*/firebaseLinks/*}" % client.transport._host, + args[1], ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - sample_request = {"parent": "accounts/sample1"} - pager = client.audit_user_links(request=sample_request) +def test_delete_firebase_link_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_firebase_link( + analytics_admin.DeleteFirebaseLinkRequest(), + name="name_value", + ) - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.AuditUserLink) for i in results) - pages = list(client.audit_user_links(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token +def test_delete_firebase_link_rest_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateUserLinkRequest, + analytics_admin.ListFirebaseLinksRequest, dict, ], ) -def test_create_user_link_rest(request_type): +def test_list_firebase_links_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} - request_init["user_link"] = { - "name": "name_value", - "email_address": "email_address_value", - "direct_roles": ["direct_roles_value1", "direct_roles_value2"], - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.UserLink( - name="name_value", - email_address="email_address_value", - direct_roles=["direct_roles_value"], + return_value = analytics_admin.ListFirebaseLinksResponse( + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.UserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListFirebaseLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_user_link(request) + response = client.list_firebase_links(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.UserLink) - assert response.name == "name_value" - assert response.email_address == "email_address_value" - assert response.direct_roles == ["direct_roles_value"] + assert isinstance(response, pagers.ListFirebaseLinksPager) + assert response.next_page_token == "next_page_token_value" -def test_create_user_link_rest_required_fields( - request_type=analytics_admin.CreateUserLinkRequest, +def test_list_firebase_links_rest_required_fields( + request_type=analytics_admin.ListFirebaseLinksRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -39274,7 +39053,7 @@ def test_create_user_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_user_link._get_unset_required_fields(jsonified_request) + ).list_firebase_links._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -39283,9 +39062,14 @@ def test_create_user_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_user_link._get_unset_required_fields(jsonified_request) + ).list_firebase_links._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("notify_new_user",)) + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -39299,7 +39083,7 @@ def test_create_user_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.UserLink() + return_value = analytics_admin.ListFirebaseLinksResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -39311,47 +39095,47 @@ def test_create_user_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.UserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListFirebaseLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_user_link(request) + response = client.list_firebase_links(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_user_link_rest_unset_required_fields(): +def test_list_firebase_links_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_user_link._get_unset_required_fields({}) + unset_fields = transport.list_firebase_links._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("notifyNewUser",)) - & set( + set( ( - "parent", - "userLink", + "pageSize", + "pageToken", ) ) + & set(("parent",)) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_user_link_rest_interceptors(null_interceptor): +def test_list_firebase_links_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -39364,14 +39148,14 @@ def test_create_user_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_user_link" + transports.AnalyticsAdminServiceRestInterceptor, "post_list_firebase_links" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_user_link" + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_firebase_links" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateUserLinkRequest.pb( - analytics_admin.CreateUserLinkRequest() + pb_message = analytics_admin.ListFirebaseLinksRequest.pb( + analytics_admin.ListFirebaseLinksRequest() ) transcode.return_value = { "method": "post", @@ -39383,17 +39167,19 @@ def test_create_user_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.UserLink.to_json(resources.UserLink()) + req.return_value._content = analytics_admin.ListFirebaseLinksResponse.to_json( + analytics_admin.ListFirebaseLinksResponse() + ) - request = analytics_admin.CreateUserLinkRequest() + request = analytics_admin.ListFirebaseLinksRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.UserLink() + post.return_value = analytics_admin.ListFirebaseLinksResponse() - client.create_user_link( + client.list_firebase_links( request, metadata=[ ("key", "val"), @@ -39405,8 +39191,8 @@ def test_create_user_link_rest_interceptors(null_interceptor): post.assert_called_once() -def test_create_user_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateUserLinkRequest +def test_list_firebase_links_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListFirebaseLinksRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -39414,12 +39200,7 @@ def test_create_user_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} - request_init["user_link"] = { - "name": "name_value", - "email_address": "email_address_value", - "direct_roles": ["direct_roles_value1", "direct_roles_value2"], - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -39431,10 +39212,10 @@ def test_create_user_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_user_link(request) + client.list_firebase_links(request) -def test_create_user_link_rest_flattened(): +def test_list_firebase_links_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -39443,38 +39224,39 @@ def test_create_user_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.UserLink() + return_value = analytics_admin.ListFirebaseLinksResponse() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "accounts/sample1"} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( parent="parent_value", - user_link=resources.UserLink(name="name_value"), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.UserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListFirebaseLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_user_link(**mock_args) + client.list_firebase_links(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=accounts/*}/userLinks" % client.transport._host, args[1] + "%s/v1alpha/{parent=properties/*}/firebaseLinks" % client.transport._host, + args[1], ) -def test_create_user_link_rest_flattened_error(transport: str = "rest"): +def test_list_firebase_links_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -39483,62 +39265,124 @@ def test_create_user_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_user_link( - analytics_admin.CreateUserLinkRequest(), + client.list_firebase_links( + analytics_admin.ListFirebaseLinksRequest(), parent="parent_value", - user_link=resources.UserLink(name="name_value"), ) -def test_create_user_link_rest_error(): +def test_list_firebase_links_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), + resources.FirebaseLink(), + resources.FirebaseLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[], + next_page_token="def", + ), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListFirebaseLinksResponse( + firebase_links=[ + resources.FirebaseLink(), + resources.FirebaseLink(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListFirebaseLinksResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "properties/sample1"} + + pager = client.list_firebase_links(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.FirebaseLink) for i in results) + + pages = list(client.list_firebase_links(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchCreateUserLinksRequest, + analytics_admin.GetGlobalSiteTagRequest, dict, ], ) -def test_batch_create_user_links_rest(request_type): +def test_get_global_site_tag_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"name": "properties/sample1/dataStreams/sample2/globalSiteTag"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.BatchCreateUserLinksResponse() + return_value = resources.GlobalSiteTag( + name="name_value", + snippet="snippet_value", + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.BatchCreateUserLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GlobalSiteTag.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_create_user_links(request) + response = client.get_global_site_tag(request) # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchCreateUserLinksResponse) + assert isinstance(response, resources.GlobalSiteTag) + assert response.name == "name_value" + assert response.snippet == "snippet_value" -def test_batch_create_user_links_rest_required_fields( - request_type=analytics_admin.BatchCreateUserLinksRequest, +def test_get_global_site_tag_rest_required_fields( + request_type=analytics_admin.GetGlobalSiteTagRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -39553,21 +39397,21 @@ def test_batch_create_user_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_create_user_links._get_unset_required_fields(jsonified_request) + ).get_global_site_tag._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_create_user_links._get_unset_required_fields(jsonified_request) + ).get_global_site_tag._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -39576,7 +39420,7 @@ def test_batch_create_user_links_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.BatchCreateUserLinksResponse() + return_value = resources.GlobalSiteTag() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -39588,49 +39432,39 @@ def test_batch_create_user_links_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.BatchCreateUserLinksResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GlobalSiteTag.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_create_user_links(request) + response = client.get_global_site_tag(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_batch_create_user_links_rest_unset_required_fields(): +def test_get_global_site_tag_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.batch_create_user_links._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(()) - & set( - ( - "parent", - "requests", - ) - ) - ) + unset_fields = transport.get_global_site_tag._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_batch_create_user_links_rest_interceptors(null_interceptor): +def test_get_global_site_tag_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -39643,14 +39477,14 @@ def test_batch_create_user_links_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_batch_create_user_links" + transports.AnalyticsAdminServiceRestInterceptor, "post_get_global_site_tag" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_batch_create_user_links" + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_global_site_tag" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.BatchCreateUserLinksRequest.pb( - analytics_admin.BatchCreateUserLinksRequest() + pb_message = analytics_admin.GetGlobalSiteTagRequest.pb( + analytics_admin.GetGlobalSiteTagRequest() ) transcode.return_value = { "method": "post", @@ -39662,21 +39496,19 @@ def test_batch_create_user_links_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.BatchCreateUserLinksResponse.to_json( - analytics_admin.BatchCreateUserLinksResponse() - ) + req.return_value._content = resources.GlobalSiteTag.to_json( + resources.GlobalSiteTag() ) - request = analytics_admin.BatchCreateUserLinksRequest() + request = analytics_admin.GetGlobalSiteTagRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.BatchCreateUserLinksResponse() + post.return_value = resources.GlobalSiteTag() - client.batch_create_user_links( + client.get_global_site_tag( request, metadata=[ ("key", "val"), @@ -39688,8 +39520,8 @@ def test_batch_create_user_links_rest_interceptors(null_interceptor): post.assert_called_once() -def test_batch_create_user_links_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.BatchCreateUserLinksRequest +def test_get_global_site_tag_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetGlobalSiteTagRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -39697,7 +39529,7 @@ def test_batch_create_user_links_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"name": "properties/sample1/dataStreams/sample2/globalSiteTag"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -39709,10 +39541,69 @@ def test_batch_create_user_links_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.batch_create_user_links(request) + client.get_global_site_tag(request) + + +def test_get_global_site_tag_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resources.GlobalSiteTag() + + # get arguments that satisfy an http rule for this method + sample_request = { + "name": "properties/sample1/dataStreams/sample2/globalSiteTag" + } + + # get truthy value for each flattened field + mock_args = dict( + name="name_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = resources.GlobalSiteTag.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_global_site_tag(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{name=properties/*/dataStreams/*/globalSiteTag}" + % client.transport._host, + args[1], + ) + + +def test_get_global_site_tag_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_global_site_tag( + analytics_admin.GetGlobalSiteTagRequest(), + name="name_value", + ) -def test_batch_create_user_links_rest_error(): +def test_get_global_site_tag_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -39721,57 +39612,134 @@ def test_batch_create_user_links_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateUserLinkRequest, + analytics_admin.CreateGoogleAdsLinkRequest, dict, ], ) -def test_update_user_link_rest(request_type): +def test_create_google_ads_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"user_link": {"name": "accounts/sample1/userLinks/sample2"}} - request_init["user_link"] = { - "name": "accounts/sample1/userLinks/sample2", - "email_address": "email_address_value", - "direct_roles": ["direct_roles_value1", "direct_roles_value2"], + request_init = {"parent": "properties/sample1"} + request_init["google_ads_link"] = { + "name": "name_value", + "customer_id": "customer_id_value", + "can_manage_clients": True, + "ads_personalization_enabled": {"value": True}, + "create_time": {"seconds": 751, "nanos": 543}, + "update_time": {}, + "creator_email_address": "creator_email_address_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateGoogleAdsLinkRequest.meta.fields[ + "google_ads_link" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["google_ads_link"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["google_ads_link"][field])): + del request_init["google_ads_link"][field][i][subfield] + else: + del request_init["google_ads_link"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.UserLink( + return_value = resources.GoogleAdsLink( name="name_value", - email_address="email_address_value", - direct_roles=["direct_roles_value"], + customer_id="customer_id_value", + can_manage_clients=True, + creator_email_address="creator_email_address_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.UserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleAdsLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_user_link(request) + response = client.create_google_ads_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.UserLink) + assert isinstance(response, resources.GoogleAdsLink) assert response.name == "name_value" - assert response.email_address == "email_address_value" - assert response.direct_roles == ["direct_roles_value"] + assert response.customer_id == "customer_id_value" + assert response.can_manage_clients is True + assert response.creator_email_address == "creator_email_address_value" -def test_update_user_link_rest_required_fields( - request_type=analytics_admin.UpdateUserLinkRequest, +def test_create_google_ads_link_rest_required_fields( + request_type=analytics_admin.CreateGoogleAdsLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -39786,17 +39754,21 @@ def test_update_user_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_user_link._get_unset_required_fields(jsonified_request) + ).create_google_ads_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["parent"] = "parent_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_user_link._get_unset_required_fields(jsonified_request) + ).create_google_ads_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -39805,7 +39777,7 @@ def test_update_user_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.UserLink() + return_value = resources.GoogleAdsLink() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -39817,7 +39789,7 @@ def test_update_user_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "post", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -39826,30 +39798,39 @@ def test_update_user_link_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.UserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleAdsLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_user_link(request) + response = client.create_google_ads_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_user_link_rest_unset_required_fields(): +def test_create_google_ads_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_user_link._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("userLink",))) + unset_fields = transport.create_google_ads_link._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "googleAdsLink", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_user_link_rest_interceptors(null_interceptor): +def test_create_google_ads_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -39862,14 +39843,14 @@ def test_update_user_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_user_link" + transports.AnalyticsAdminServiceRestInterceptor, "post_create_google_ads_link" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_user_link" + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_google_ads_link" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateUserLinkRequest.pb( - analytics_admin.UpdateUserLinkRequest() + pb_message = analytics_admin.CreateGoogleAdsLinkRequest.pb( + analytics_admin.CreateGoogleAdsLinkRequest() ) transcode.return_value = { "method": "post", @@ -39881,17 +39862,19 @@ def test_update_user_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.UserLink.to_json(resources.UserLink()) + req.return_value._content = resources.GoogleAdsLink.to_json( + resources.GoogleAdsLink() + ) - request = analytics_admin.UpdateUserLinkRequest() + request = analytics_admin.CreateGoogleAdsLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.UserLink() + post.return_value = resources.GoogleAdsLink() - client.update_user_link( + client.create_google_ads_link( request, metadata=[ ("key", "val"), @@ -39903,8 +39886,8 @@ def test_update_user_link_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_user_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateUserLinkRequest +def test_create_google_ads_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateGoogleAdsLinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -39912,12 +39895,7 @@ def test_update_user_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"user_link": {"name": "accounts/sample1/userLinks/sample2"}} - request_init["user_link"] = { - "name": "accounts/sample1/userLinks/sample2", - "email_address": "email_address_value", - "direct_roles": ["direct_roles_value1", "direct_roles_value2"], - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -39929,10 +39907,10 @@ def test_update_user_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_user_link(request) + client.create_google_ads_link(request) -def test_update_user_link_rest_flattened(): +def test_create_google_ads_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -39941,39 +39919,40 @@ def test_update_user_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.UserLink() + return_value = resources.GoogleAdsLink() # get arguments that satisfy an http rule for this method - sample_request = {"user_link": {"name": "accounts/sample1/userLinks/sample2"}} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - user_link=resources.UserLink(name="name_value"), + parent="parent_value", + google_ads_link=resources.GoogleAdsLink(name="name_value"), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.UserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleAdsLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_user_link(**mock_args) + client.create_google_ads_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{user_link.name=accounts/*/userLinks/*}" - % client.transport._host, + "%s/v1alpha/{parent=properties/*}/googleAdsLinks" % client.transport._host, args[1], ) -def test_update_user_link_rest_flattened_error(transport: str = "rest"): +def test_create_google_ads_link_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -39982,13 +39961,14 @@ def test_update_user_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_user_link( - analytics_admin.UpdateUserLinkRequest(), - user_link=resources.UserLink(name="name_value"), + client.create_google_ads_link( + analytics_admin.CreateGoogleAdsLinkRequest(), + parent="parent_value", + google_ads_link=resources.GoogleAdsLink(name="name_value"), ) -def test_update_user_link_rest_error(): +def test_create_google_ads_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -39997,46 +39977,135 @@ def test_update_user_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchUpdateUserLinksRequest, + analytics_admin.UpdateGoogleAdsLinkRequest, dict, ], ) -def test_batch_update_user_links_rest(request_type): +def test_update_google_ads_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = { + "google_ads_link": {"name": "properties/sample1/googleAdsLinks/sample2"} + } + request_init["google_ads_link"] = { + "name": "properties/sample1/googleAdsLinks/sample2", + "customer_id": "customer_id_value", + "can_manage_clients": True, + "ads_personalization_enabled": {"value": True}, + "create_time": {"seconds": 751, "nanos": 543}, + "update_time": {}, + "creator_email_address": "creator_email_address_value", + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateGoogleAdsLinkRequest.meta.fields[ + "google_ads_link" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["google_ads_link"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["google_ads_link"][field])): + del request_init["google_ads_link"][field][i][subfield] + else: + del request_init["google_ads_link"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.BatchUpdateUserLinksResponse() + return_value = resources.GoogleAdsLink( + name="name_value", + customer_id="customer_id_value", + can_manage_clients=True, + creator_email_address="creator_email_address_value", + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.BatchUpdateUserLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleAdsLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_update_user_links(request) + response = client.update_google_ads_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchUpdateUserLinksResponse) + assert isinstance(response, resources.GoogleAdsLink) + assert response.name == "name_value" + assert response.customer_id == "customer_id_value" + assert response.can_manage_clients is True + assert response.creator_email_address == "creator_email_address_value" -def test_batch_update_user_links_rest_required_fields( - request_type=analytics_admin.BatchUpdateUserLinksRequest, +def test_update_google_ads_link_rest_required_fields( + request_type=analytics_admin.UpdateGoogleAdsLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -40051,21 +40120,19 @@ def test_batch_update_user_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_update_user_links._get_unset_required_fields(jsonified_request) + ).update_google_ads_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_update_user_links._get_unset_required_fields(jsonified_request) + ).update_google_ads_link._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -40074,7 +40141,7 @@ def test_batch_update_user_links_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.BatchUpdateUserLinksResponse() + return_value = resources.GoogleAdsLink() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -40086,7 +40153,7 @@ def test_batch_update_user_links_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "patch", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -40095,40 +40162,31 @@ def test_batch_update_user_links_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.BatchUpdateUserLinksResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleAdsLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_update_user_links(request) + response = client.update_google_ads_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_batch_update_user_links_rest_unset_required_fields(): +def test_update_google_ads_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.batch_update_user_links._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(()) - & set( - ( - "parent", - "requests", - ) - ) - ) + unset_fields = transport.update_google_ads_link._get_unset_required_fields({}) + assert set(unset_fields) == (set(("updateMask",)) & set(("updateMask",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_batch_update_user_links_rest_interceptors(null_interceptor): +def test_update_google_ads_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -40141,14 +40199,14 @@ def test_batch_update_user_links_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_batch_update_user_links" + transports.AnalyticsAdminServiceRestInterceptor, "post_update_google_ads_link" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_batch_update_user_links" + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_google_ads_link" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.BatchUpdateUserLinksRequest.pb( - analytics_admin.BatchUpdateUserLinksRequest() + pb_message = analytics_admin.UpdateGoogleAdsLinkRequest.pb( + analytics_admin.UpdateGoogleAdsLinkRequest() ) transcode.return_value = { "method": "post", @@ -40160,21 +40218,19 @@ def test_batch_update_user_links_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.BatchUpdateUserLinksResponse.to_json( - analytics_admin.BatchUpdateUserLinksResponse() - ) + req.return_value._content = resources.GoogleAdsLink.to_json( + resources.GoogleAdsLink() ) - request = analytics_admin.BatchUpdateUserLinksRequest() + request = analytics_admin.UpdateGoogleAdsLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.BatchUpdateUserLinksResponse() + post.return_value = resources.GoogleAdsLink() - client.batch_update_user_links( + client.update_google_ads_link( request, metadata=[ ("key", "val"), @@ -40186,8 +40242,8 @@ def test_batch_update_user_links_rest_interceptors(null_interceptor): post.assert_called_once() -def test_batch_update_user_links_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.BatchUpdateUserLinksRequest +def test_update_google_ads_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateGoogleAdsLinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -40195,7 +40251,9 @@ def test_batch_update_user_links_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = { + "google_ads_link": {"name": "properties/sample1/googleAdsLinks/sample2"} + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -40207,10 +40265,71 @@ def test_batch_update_user_links_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.batch_update_user_links(request) + client.update_google_ads_link(request) + + +def test_update_google_ads_link_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resources.GoogleAdsLink() + + # get arguments that satisfy an http rule for this method + sample_request = { + "google_ads_link": {"name": "properties/sample1/googleAdsLinks/sample2"} + } + + # get truthy value for each flattened field + mock_args = dict( + google_ads_link=resources.GoogleAdsLink(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = resources.GoogleAdsLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.update_google_ads_link(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{google_ads_link.name=properties/*/googleAdsLinks/*}" + % client.transport._host, + args[1], + ) + + +def test_update_google_ads_link_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_google_ads_link( + analytics_admin.UpdateGoogleAdsLinkRequest(), + google_ads_link=resources.GoogleAdsLink(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) -def test_batch_update_user_links_rest_error(): +def test_update_google_ads_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -40219,18 +40338,18 @@ def test_batch_update_user_links_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteUserLinkRequest, + analytics_admin.DeleteGoogleAdsLinkRequest, dict, ], ) -def test_delete_user_link_rest(request_type): +def test_delete_google_ads_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1/userLinks/sample2"} + request_init = {"name": "properties/sample1/googleAdsLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -40245,14 +40364,14 @@ def test_delete_user_link_rest(request_type): response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_user_link(request) + response = client.delete_google_ads_link(request) # Establish that the response is the type that we expect. assert response is None -def test_delete_user_link_rest_required_fields( - request_type=analytics_admin.DeleteUserLinkRequest, +def test_delete_google_ads_link_rest_required_fields( + request_type=analytics_admin.DeleteGoogleAdsLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -40272,7 +40391,7 @@ def test_delete_user_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_user_link._get_unset_required_fields(jsonified_request) + ).delete_google_ads_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -40281,7 +40400,7 @@ def test_delete_user_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_user_link._get_unset_required_fields(jsonified_request) + ).delete_google_ads_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -40319,24 +40438,24 @@ def test_delete_user_link_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_user_link(request) + response = client.delete_google_ads_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_user_link_rest_unset_required_fields(): +def test_delete_google_ads_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_user_link._get_unset_required_fields({}) + unset_fields = transport.delete_google_ads_link._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_user_link_rest_interceptors(null_interceptor): +def test_delete_google_ads_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -40349,11 +40468,11 @@ def test_delete_user_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_user_link" + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_google_ads_link" ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteUserLinkRequest.pb( - analytics_admin.DeleteUserLinkRequest() + pb_message = analytics_admin.DeleteGoogleAdsLinkRequest.pb( + analytics_admin.DeleteGoogleAdsLinkRequest() ) transcode.return_value = { "method": "post", @@ -40366,14 +40485,14 @@ def test_delete_user_link_rest_interceptors(null_interceptor): req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - request = analytics_admin.DeleteUserLinkRequest() + request = analytics_admin.DeleteGoogleAdsLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - client.delete_user_link( + client.delete_google_ads_link( request, metadata=[ ("key", "val"), @@ -40384,8 +40503,8 @@ def test_delete_user_link_rest_interceptors(null_interceptor): pre.assert_called_once() -def test_delete_user_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteUserLinkRequest +def test_delete_google_ads_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeleteGoogleAdsLinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -40393,7 +40512,7 @@ def test_delete_user_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1/userLinks/sample2"} + request_init = {"name": "properties/sample1/googleAdsLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -40405,10 +40524,10 @@ def test_delete_user_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_user_link(request) + client.delete_google_ads_link(request) -def test_delete_user_link_rest_flattened(): +def test_delete_google_ads_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -40420,7 +40539,7 @@ def test_delete_user_link_rest_flattened(): return_value = None # get arguments that satisfy an http rule for this method - sample_request = {"name": "accounts/sample1/userLinks/sample2"} + sample_request = {"name": "properties/sample1/googleAdsLinks/sample2"} # get truthy value for each flattened field mock_args = dict( @@ -40435,18 +40554,19 @@ def test_delete_user_link_rest_flattened(): response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.delete_user_link(**mock_args) + client.delete_google_ads_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=accounts/*/userLinks/*}" % client.transport._host, args[1] + "%s/v1alpha/{name=properties/*/googleAdsLinks/*}" % client.transport._host, + args[1], ) -def test_delete_user_link_rest_flattened_error(transport: str = "rest"): +def test_delete_google_ads_link_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -40455,13 +40575,13 @@ def test_delete_user_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_user_link( - analytics_admin.DeleteUserLinkRequest(), + client.delete_google_ads_link( + analytics_admin.DeleteGoogleAdsLinkRequest(), name="name_value", ) -def test_delete_user_link_rest_error(): +def test_delete_google_ads_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -40470,40 +40590,45 @@ def test_delete_user_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchDeleteUserLinksRequest, + analytics_admin.ListGoogleAdsLinksRequest, dict, ], ) -def test_batch_delete_user_links_rest(request_type): +def test_list_google_ads_links_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = analytics_admin.ListGoogleAdsLinksResponse( + next_page_token="next_page_token_value", + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = analytics_admin.ListGoogleAdsLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_delete_user_links(request) + response = client.list_google_ads_links(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, pagers.ListGoogleAdsLinksPager) + assert response.next_page_token == "next_page_token_value" -def test_batch_delete_user_links_rest_required_fields( - request_type=analytics_admin.BatchDeleteUserLinksRequest, +def test_list_google_ads_links_rest_required_fields( + request_type=analytics_admin.ListGoogleAdsLinksRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -40523,7 +40648,7 @@ def test_batch_delete_user_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_delete_user_links._get_unset_required_fields(jsonified_request) + ).list_google_ads_links._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -40532,7 +40657,14 @@ def test_batch_delete_user_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_delete_user_links._get_unset_required_fields(jsonified_request) + ).list_google_ads_links._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -40546,7 +40678,7 @@ def test_batch_delete_user_links_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = analytics_admin.ListGoogleAdsLinksResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -40558,45 +40690,47 @@ def test_batch_delete_user_links_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = analytics_admin.ListGoogleAdsLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_delete_user_links(request) + response = client.list_google_ads_links(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_batch_delete_user_links_rest_unset_required_fields(): +def test_list_google_ads_links_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.batch_delete_user_links._get_unset_required_fields({}) + unset_fields = transport.list_google_ads_links._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) - & set( + set( ( - "parent", - "requests", + "pageSize", + "pageToken", ) ) + & set(("parent",)) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_batch_delete_user_links_rest_interceptors(null_interceptor): +def test_list_google_ads_links_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -40609,11 +40743,14 @@ def test_batch_delete_user_links_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_batch_delete_user_links" + transports.AnalyticsAdminServiceRestInterceptor, "post_list_google_ads_links" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_google_ads_links" ) as pre: pre.assert_not_called() - pb_message = analytics_admin.BatchDeleteUserLinksRequest.pb( - analytics_admin.BatchDeleteUserLinksRequest() + post.assert_not_called() + pb_message = analytics_admin.ListGoogleAdsLinksRequest.pb( + analytics_admin.ListGoogleAdsLinksRequest() ) transcode.return_value = { "method": "post", @@ -40622,111 +40759,233 @@ def test_batch_delete_user_links_rest_interceptors(null_interceptor): "query_params": pb_message, } - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = analytics_admin.ListGoogleAdsLinksResponse.to_json( + analytics_admin.ListGoogleAdsLinksResponse() + ) + + request = analytics_admin.ListGoogleAdsLinksRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = analytics_admin.ListGoogleAdsLinksResponse() + + client.list_google_ads_links( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_google_ads_links_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListGoogleAdsLinksRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "properties/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list_google_ads_links(request) + + +def test_list_google_ads_links_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = analytics_admin.ListGoogleAdsLinksResponse() + + # get arguments that satisfy an http rule for this method + sample_request = {"parent": "properties/sample1"} + + # get truthy value for each flattened field + mock_args = dict( + parent="parent_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = analytics_admin.ListGoogleAdsLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.list_google_ads_links(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{parent=properties/*}/googleAdsLinks" % client.transport._host, + args[1], + ) + - request = analytics_admin.BatchDeleteUserLinksRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata +def test_list_google_ads_links_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) - client.batch_delete_user_links( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_google_ads_links( + analytics_admin.ListGoogleAdsLinksRequest(), + parent="parent_value", ) - pre.assert_called_once() - -def test_batch_delete_user_links_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.BatchDeleteUserLinksRequest -): +def test_list_google_ads_links_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) - # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} - request = request_type(**request_init) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[], + next_page_token="def", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListGoogleAdsLinksResponse( + google_ads_links=[ + resources.GoogleAdsLink(), + resources.GoogleAdsLink(), + ], + ), + ) + # Two responses for two calls + response = response + response - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.batch_delete_user_links(request) + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListGoogleAdsLinksResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + sample_request = {"parent": "properties/sample1"} -def test_batch_delete_user_links_rest_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) + pager = client.list_google_ads_links(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.GoogleAdsLink) for i in results) + + pages = list(client.list_google_ads_links(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateFirebaseLinkRequest, + analytics_admin.GetDataSharingSettingsRequest, dict, ], ) -def test_create_firebase_link_rest(request_type): +def test_get_data_sharing_settings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["firebase_link"] = { - "name": "name_value", - "project": "project_value", - "create_time": {"seconds": 751, "nanos": 543}, - } + request_init = {"name": "accounts/sample1/dataSharingSettings"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.FirebaseLink( + return_value = resources.DataSharingSettings( name="name_value", - project="project_value", + sharing_with_google_support_enabled=True, + sharing_with_google_assigned_sales_enabled=True, + sharing_with_google_any_sales_enabled=True, + sharing_with_google_products_enabled=True, + sharing_with_others_enabled=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.FirebaseLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataSharingSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_firebase_link(request) + response = client.get_data_sharing_settings(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.FirebaseLink) + assert isinstance(response, resources.DataSharingSettings) assert response.name == "name_value" - assert response.project == "project_value" + assert response.sharing_with_google_support_enabled is True + assert response.sharing_with_google_assigned_sales_enabled is True + assert response.sharing_with_google_any_sales_enabled is True + assert response.sharing_with_google_products_enabled is True + assert response.sharing_with_others_enabled is True -def test_create_firebase_link_rest_required_fields( - request_type=analytics_admin.CreateFirebaseLinkRequest, +def test_get_data_sharing_settings_rest_required_fields( + request_type=analytics_admin.GetDataSharingSettingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -40741,21 +41000,21 @@ def test_create_firebase_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_firebase_link._get_unset_required_fields(jsonified_request) + ).get_data_sharing_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_firebase_link._get_unset_required_fields(jsonified_request) + ).get_data_sharing_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -40764,7 +41023,7 @@ def test_create_firebase_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.FirebaseLink() + return_value = resources.DataSharingSettings() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -40776,47 +41035,39 @@ def test_create_firebase_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.FirebaseLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataSharingSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_firebase_link(request) + response = client.get_data_sharing_settings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_firebase_link_rest_unset_required_fields(): +def test_get_data_sharing_settings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_firebase_link._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(()) - & set( - ( - "parent", - "firebaseLink", - ) - ) - ) + unset_fields = transport.get_data_sharing_settings._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_firebase_link_rest_interceptors(null_interceptor): +def test_get_data_sharing_settings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -40829,14 +41080,15 @@ def test_create_firebase_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_firebase_link" + transports.AnalyticsAdminServiceRestInterceptor, + "post_get_data_sharing_settings", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_firebase_link" + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_data_sharing_settings" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateFirebaseLinkRequest.pb( - analytics_admin.CreateFirebaseLinkRequest() + pb_message = analytics_admin.GetDataSharingSettingsRequest.pb( + analytics_admin.GetDataSharingSettingsRequest() ) transcode.return_value = { "method": "post", @@ -40848,19 +41100,19 @@ def test_create_firebase_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.FirebaseLink.to_json( - resources.FirebaseLink() + req.return_value._content = resources.DataSharingSettings.to_json( + resources.DataSharingSettings() ) - request = analytics_admin.CreateFirebaseLinkRequest() + request = analytics_admin.GetDataSharingSettingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.FirebaseLink() + post.return_value = resources.DataSharingSettings() - client.create_firebase_link( + client.get_data_sharing_settings( request, metadata=[ ("key", "val"), @@ -40872,8 +41124,8 @@ def test_create_firebase_link_rest_interceptors(null_interceptor): post.assert_called_once() -def test_create_firebase_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateFirebaseLinkRequest +def test_get_data_sharing_settings_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetDataSharingSettingsRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -40881,12 +41133,7 @@ def test_create_firebase_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["firebase_link"] = { - "name": "name_value", - "project": "project_value", - "create_time": {"seconds": 751, "nanos": 543}, - } + request_init = {"name": "accounts/sample1/dataSharingSettings"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -40898,10 +41145,10 @@ def test_create_firebase_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_firebase_link(request) + client.get_data_sharing_settings(request) -def test_create_firebase_link_rest_flattened(): +def test_get_data_sharing_settings_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -40910,39 +41157,39 @@ def test_create_firebase_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.FirebaseLink() + return_value = resources.DataSharingSettings() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = {"name": "accounts/sample1/dataSharingSettings"} # get truthy value for each flattened field mock_args = dict( - parent="parent_value", - firebase_link=resources.FirebaseLink(name="name_value"), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.FirebaseLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataSharingSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_firebase_link(**mock_args) + client.get_data_sharing_settings(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/firebaseLinks" % client.transport._host, + "%s/v1alpha/{name=accounts/*/dataSharingSettings}" % client.transport._host, args[1], ) -def test_create_firebase_link_rest_flattened_error(transport: str = "rest"): +def test_get_data_sharing_settings_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -40951,14 +41198,13 @@ def test_create_firebase_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_firebase_link( - analytics_admin.CreateFirebaseLinkRequest(), - parent="parent_value", - firebase_link=resources.FirebaseLink(name="name_value"), + client.get_data_sharing_settings( + analytics_admin.GetDataSharingSettingsRequest(), + name="name_value", ) -def test_create_firebase_link_rest_error(): +def test_get_data_sharing_settings_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -40967,40 +41213,51 @@ def test_create_firebase_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteFirebaseLinkRequest, + analytics_admin.GetMeasurementProtocolSecretRequest, dict, ], ) -def test_delete_firebase_link_rest(request_type): +def test_get_measurement_protocol_secret_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/firebaseLinks/sample2"} + request_init = { + "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" + } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.MeasurementProtocolSecret( + name="name_value", + display_name="display_name_value", + secret_value="secret_value_value", + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_firebase_link(request) + response = client.get_measurement_protocol_secret(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.MeasurementProtocolSecret) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.secret_value == "secret_value_value" -def test_delete_firebase_link_rest_required_fields( - request_type=analytics_admin.DeleteFirebaseLinkRequest, +def test_get_measurement_protocol_secret_rest_required_fields( + request_type=analytics_admin.GetMeasurementProtocolSecretRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -41020,7 +41277,7 @@ def test_delete_firebase_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_firebase_link._get_unset_required_fields(jsonified_request) + ).get_measurement_protocol_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -41029,7 +41286,7 @@ def test_delete_firebase_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_firebase_link._get_unset_required_fields(jsonified_request) + ).get_measurement_protocol_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -41043,7 +41300,7 @@ def test_delete_firebase_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.MeasurementProtocolSecret() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -41055,36 +41312,41 @@ def test_delete_firebase_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "get", "query_params": pb_request, } transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_firebase_link(request) + response = client.get_measurement_protocol_secret(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_firebase_link_rest_unset_required_fields(): +def test_get_measurement_protocol_secret_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_firebase_link._get_unset_required_fields({}) + unset_fields = transport.get_measurement_protocol_secret._get_unset_required_fields( + {} + ) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_firebase_link_rest_interceptors(null_interceptor): +def test_get_measurement_protocol_secret_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -41097,11 +41359,16 @@ def test_delete_firebase_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_firebase_link" + transports.AnalyticsAdminServiceRestInterceptor, + "post_get_measurement_protocol_secret", + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, + "pre_get_measurement_protocol_secret", ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteFirebaseLinkRequest.pb( - analytics_admin.DeleteFirebaseLinkRequest() + post.assert_not_called() + pb_message = analytics_admin.GetMeasurementProtocolSecretRequest.pb( + analytics_admin.GetMeasurementProtocolSecretRequest() ) transcode.return_value = { "method": "post", @@ -41113,15 +41380,19 @@ def test_delete_firebase_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = resources.MeasurementProtocolSecret.to_json( + resources.MeasurementProtocolSecret() + ) - request = analytics_admin.DeleteFirebaseLinkRequest() + request = analytics_admin.GetMeasurementProtocolSecretRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = resources.MeasurementProtocolSecret() - client.delete_firebase_link( + client.get_measurement_protocol_secret( request, metadata=[ ("key", "val"), @@ -41130,10 +41401,12 @@ def test_delete_firebase_link_rest_interceptors(null_interceptor): ) pre.assert_called_once() + post.assert_called_once() -def test_delete_firebase_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteFirebaseLinkRequest +def test_get_measurement_protocol_secret_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.GetMeasurementProtocolSecretRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -41141,7 +41414,9 @@ def test_delete_firebase_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/firebaseLinks/sample2"} + request_init = { + "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -41153,10 +41428,10 @@ def test_delete_firebase_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_firebase_link(request) + client.get_measurement_protocol_secret(request) -def test_delete_firebase_link_rest_flattened(): +def test_get_measurement_protocol_secret_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -41165,10 +41440,12 @@ def test_delete_firebase_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.MeasurementProtocolSecret() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/firebaseLinks/sample2"} + sample_request = { + "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" + } # get truthy value for each flattened field mock_args = dict( @@ -41179,23 +41456,26 @@ def test_delete_firebase_link_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.delete_firebase_link(**mock_args) + client.get_measurement_protocol_secret(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/firebaseLinks/*}" % client.transport._host, + "%s/v1alpha/{name=properties/*/dataStreams/*/measurementProtocolSecrets/*}" + % client.transport._host, args[1], ) -def test_delete_firebase_link_rest_flattened_error(transport: str = "rest"): +def test_get_measurement_protocol_secret_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -41204,13 +41484,13 @@ def test_delete_firebase_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_firebase_link( - analytics_admin.DeleteFirebaseLinkRequest(), + client.get_measurement_protocol_secret( + analytics_admin.GetMeasurementProtocolSecretRequest(), name="name_value", ) -def test_delete_firebase_link_rest_error(): +def test_get_measurement_protocol_secret_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -41219,44 +41499,47 @@ def test_delete_firebase_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListFirebaseLinksRequest, + analytics_admin.ListMeasurementProtocolSecretsRequest, dict, ], ) -def test_list_firebase_links_rest(request_type): +def test_list_measurement_protocol_secrets_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = {"parent": "properties/sample1/dataStreams/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListFirebaseLinksResponse( + return_value = analytics_admin.ListMeasurementProtocolSecretsResponse( next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListFirebaseLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListMeasurementProtocolSecretsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_firebase_links(request) + response = client.list_measurement_protocol_secrets(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListFirebaseLinksPager) + assert isinstance(response, pagers.ListMeasurementProtocolSecretsPager) assert response.next_page_token == "next_page_token_value" -def test_list_firebase_links_rest_required_fields( - request_type=analytics_admin.ListFirebaseLinksRequest, +def test_list_measurement_protocol_secrets_rest_required_fields( + request_type=analytics_admin.ListMeasurementProtocolSecretsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -41276,7 +41559,7 @@ def test_list_firebase_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_firebase_links._get_unset_required_fields(jsonified_request) + ).list_measurement_protocol_secrets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -41285,7 +41568,7 @@ def test_list_firebase_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_firebase_links._get_unset_required_fields(jsonified_request) + ).list_measurement_protocol_secrets._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( ( @@ -41306,7 +41589,7 @@ def test_list_firebase_links_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListFirebaseLinksResponse() + return_value = analytics_admin.ListMeasurementProtocolSecretsResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -41326,25 +41609,30 @@ def test_list_firebase_links_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListFirebaseLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListMeasurementProtocolSecretsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_firebase_links(request) + response = client.list_measurement_protocol_secrets(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_firebase_links_rest_unset_required_fields(): +def test_list_measurement_protocol_secrets_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_firebase_links._get_unset_required_fields({}) + unset_fields = ( + transport.list_measurement_protocol_secrets._get_unset_required_fields({}) + ) assert set(unset_fields) == ( set( ( @@ -41357,7 +41645,7 @@ def test_list_firebase_links_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_firebase_links_rest_interceptors(null_interceptor): +def test_list_measurement_protocol_secrets_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -41370,14 +41658,16 @@ def test_list_firebase_links_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_firebase_links" + transports.AnalyticsAdminServiceRestInterceptor, + "post_list_measurement_protocol_secrets", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_firebase_links" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_list_measurement_protocol_secrets", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListFirebaseLinksRequest.pb( - analytics_admin.ListFirebaseLinksRequest() + pb_message = analytics_admin.ListMeasurementProtocolSecretsRequest.pb( + analytics_admin.ListMeasurementProtocolSecretsRequest() ) transcode.return_value = { "method": "post", @@ -41389,19 +41679,21 @@ def test_list_firebase_links_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ListFirebaseLinksResponse.to_json( - analytics_admin.ListFirebaseLinksResponse() + req.return_value._content = ( + analytics_admin.ListMeasurementProtocolSecretsResponse.to_json( + analytics_admin.ListMeasurementProtocolSecretsResponse() + ) ) - request = analytics_admin.ListFirebaseLinksRequest() + request = analytics_admin.ListMeasurementProtocolSecretsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListFirebaseLinksResponse() + post.return_value = analytics_admin.ListMeasurementProtocolSecretsResponse() - client.list_firebase_links( + client.list_measurement_protocol_secrets( request, metadata=[ ("key", "val"), @@ -41413,8 +41705,9 @@ def test_list_firebase_links_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_firebase_links_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListFirebaseLinksRequest +def test_list_measurement_protocol_secrets_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.ListMeasurementProtocolSecretsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -41422,7 +41715,7 @@ def test_list_firebase_links_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = {"parent": "properties/sample1/dataStreams/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -41434,10 +41727,10 @@ def test_list_firebase_links_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_firebase_links(request) + client.list_measurement_protocol_secrets(request) -def test_list_firebase_links_rest_flattened(): +def test_list_measurement_protocol_secrets_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -41446,10 +41739,10 @@ def test_list_firebase_links_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListFirebaseLinksResponse() + return_value = analytics_admin.ListMeasurementProtocolSecretsResponse() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = {"parent": "properties/sample1/dataStreams/sample2"} # get truthy value for each flattened field mock_args = dict( @@ -41460,24 +41753,30 @@ def test_list_firebase_links_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListFirebaseLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListMeasurementProtocolSecretsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_firebase_links(**mock_args) + client.list_measurement_protocol_secrets(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/firebaseLinks" % client.transport._host, + "%s/v1alpha/{parent=properties/*/dataStreams/*}/measurementProtocolSecrets" + % client.transport._host, args[1], ) -def test_list_firebase_links_rest_flattened_error(transport: str = "rest"): +def test_list_measurement_protocol_secrets_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -41486,13 +41785,13 @@ def test_list_firebase_links_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_firebase_links( - analytics_admin.ListFirebaseLinksRequest(), + client.list_measurement_protocol_secrets( + analytics_admin.ListMeasurementProtocolSecretsRequest(), parent="parent_value", ) -def test_list_firebase_links_rest_pager(transport: str = "rest"): +def test_list_measurement_protocol_secrets_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -41504,28 +41803,28 @@ def test_list_firebase_links_rest_pager(transport: str = "rest"): # with mock.patch.object(path_template, 'transcode') as transcode: # Set the response as a series of pages response = ( - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), - resources.FirebaseLink(), - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), ], next_page_token="abc", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[], + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[], next_page_token="def", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), ], next_page_token="ghi", ), - analytics_admin.ListFirebaseLinksResponse( - firebase_links=[ - resources.FirebaseLink(), - resources.FirebaseLink(), + analytics_admin.ListMeasurementProtocolSecretsResponse( + measurement_protocol_secrets=[ + resources.MeasurementProtocolSecret(), + resources.MeasurementProtocolSecret(), ], ), ) @@ -41534,7 +41833,8 @@ def test_list_firebase_links_rest_pager(transport: str = "rest"): # Wrap the values into proper Response objs response = tuple( - analytics_admin.ListFirebaseLinksResponse.to_json(x) for x in response + analytics_admin.ListMeasurementProtocolSecretsResponse.to_json(x) + for x in response ) return_values = tuple(Response() for i in response) for return_val, response_val in zip(return_values, response): @@ -41542,15 +41842,17 @@ def test_list_firebase_links_rest_pager(transport: str = "rest"): return_val.status_code = 200 req.side_effect = return_values - sample_request = {"parent": "properties/sample1"} + sample_request = {"parent": "properties/sample1/dataStreams/sample2"} - pager = client.list_firebase_links(request=sample_request) + pager = client.list_measurement_protocol_secrets(request=sample_request) results = list(pager) assert len(results) == 6 - assert all(isinstance(i, resources.FirebaseLink) for i in results) + assert all(isinstance(i, resources.MeasurementProtocolSecret) for i in results) - pages = list(client.list_firebase_links(request=sample_request).pages) + pages = list( + client.list_measurement_protocol_secrets(request=sample_request).pages + ) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -41558,51 +41860,132 @@ def test_list_firebase_links_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetGlobalSiteTagRequest, + analytics_admin.CreateMeasurementProtocolSecretRequest, dict, ], ) -def test_get_global_site_tag_rest(request_type): +def test_create_measurement_protocol_secret_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/dataStreams/sample2/globalSiteTag"} + request_init = {"parent": "properties/sample1/dataStreams/sample2"} + request_init["measurement_protocol_secret"] = { + "name": "name_value", + "display_name": "display_name_value", + "secret_value": "secret_value_value", + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateMeasurementProtocolSecretRequest.meta.fields[ + "measurement_protocol_secret" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "measurement_protocol_secret" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range( + 0, len(request_init["measurement_protocol_secret"][field]) + ): + del request_init["measurement_protocol_secret"][field][i][subfield] + else: + del request_init["measurement_protocol_secret"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.GlobalSiteTag( + return_value = resources.MeasurementProtocolSecret( name="name_value", - snippet="snippet_value", + display_name="display_name_value", + secret_value="secret_value_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GlobalSiteTag.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_global_site_tag(request) + response = client.create_measurement_protocol_secret(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.GlobalSiteTag) + assert isinstance(response, resources.MeasurementProtocolSecret) assert response.name == "name_value" - assert response.snippet == "snippet_value" + assert response.display_name == "display_name_value" + assert response.secret_value == "secret_value_value" -def test_get_global_site_tag_rest_required_fields( - request_type=analytics_admin.GetGlobalSiteTagRequest, +def test_create_measurement_protocol_secret_rest_required_fields( + request_type=analytics_admin.CreateMeasurementProtocolSecretRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -41617,21 +42000,21 @@ def test_get_global_site_tag_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_global_site_tag._get_unset_required_fields(jsonified_request) + ).create_measurement_protocol_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_global_site_tag._get_unset_required_fields(jsonified_request) + ).create_measurement_protocol_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -41640,7 +42023,7 @@ def test_get_global_site_tag_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.GlobalSiteTag() + return_value = resources.MeasurementProtocolSecret() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -41652,38 +42035,50 @@ def test_get_global_site_tag_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GlobalSiteTag.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_global_site_tag(request) + response = client.create_measurement_protocol_secret(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_global_site_tag_rest_unset_required_fields(): +def test_create_measurement_protocol_secret_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - - unset_fields = transport.get_global_site_tag._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + + unset_fields = ( + transport.create_measurement_protocol_secret._get_unset_required_fields({}) + ) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "measurementProtocolSecret", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_global_site_tag_rest_interceptors(null_interceptor): +def test_create_measurement_protocol_secret_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -41696,14 +42091,16 @@ def test_get_global_site_tag_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_global_site_tag" + transports.AnalyticsAdminServiceRestInterceptor, + "post_create_measurement_protocol_secret", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_global_site_tag" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_create_measurement_protocol_secret", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetGlobalSiteTagRequest.pb( - analytics_admin.GetGlobalSiteTagRequest() + pb_message = analytics_admin.CreateMeasurementProtocolSecretRequest.pb( + analytics_admin.CreateMeasurementProtocolSecretRequest() ) transcode.return_value = { "method": "post", @@ -41715,19 +42112,19 @@ def test_get_global_site_tag_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.GlobalSiteTag.to_json( - resources.GlobalSiteTag() + req.return_value._content = resources.MeasurementProtocolSecret.to_json( + resources.MeasurementProtocolSecret() ) - request = analytics_admin.GetGlobalSiteTagRequest() + request = analytics_admin.CreateMeasurementProtocolSecretRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.GlobalSiteTag() + post.return_value = resources.MeasurementProtocolSecret() - client.get_global_site_tag( + client.create_measurement_protocol_secret( request, metadata=[ ("key", "val"), @@ -41739,8 +42136,9 @@ def test_get_global_site_tag_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_global_site_tag_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetGlobalSiteTagRequest +def test_create_measurement_protocol_secret_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.CreateMeasurementProtocolSecretRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -41748,7 +42146,7 @@ def test_get_global_site_tag_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/dataStreams/sample2/globalSiteTag"} + request_init = {"parent": "properties/sample1/dataStreams/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -41760,10 +42158,10 @@ def test_get_global_site_tag_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_global_site_tag(request) + client.create_measurement_protocol_secret(request) -def test_get_global_site_tag_rest_flattened(): +def test_create_measurement_protocol_secret_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -41772,41 +42170,45 @@ def test_get_global_site_tag_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.GlobalSiteTag() + return_value = resources.MeasurementProtocolSecret() # get arguments that satisfy an http rule for this method - sample_request = { - "name": "properties/sample1/dataStreams/sample2/globalSiteTag" - } + sample_request = {"parent": "properties/sample1/dataStreams/sample2"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", + measurement_protocol_secret=resources.MeasurementProtocolSecret( + name="name_value" + ), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GlobalSiteTag.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_global_site_tag(**mock_args) + client.create_measurement_protocol_secret(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/dataStreams/*/globalSiteTag}" + "%s/v1alpha/{parent=properties/*/dataStreams/*}/measurementProtocolSecrets" % client.transport._host, args[1], ) -def test_get_global_site_tag_rest_flattened_error(transport: str = "rest"): +def test_create_measurement_protocol_secret_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -41815,13 +42217,16 @@ def test_get_global_site_tag_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_global_site_tag( - analytics_admin.GetGlobalSiteTagRequest(), - name="name_value", + client.create_measurement_protocol_secret( + analytics_admin.CreateMeasurementProtocolSecretRequest(), + parent="parent_value", + measurement_protocol_secret=resources.MeasurementProtocolSecret( + name="name_value" + ), ) -def test_get_global_site_tag_rest_error(): +def test_create_measurement_protocol_secret_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -41830,64 +42235,47 @@ def test_get_global_site_tag_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateGoogleAdsLinkRequest, + analytics_admin.DeleteMeasurementProtocolSecretRequest, dict, ], ) -def test_create_google_ads_link_rest(request_type): +def test_delete_measurement_protocol_secret_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["google_ads_link"] = { - "name": "name_value", - "customer_id": "customer_id_value", - "can_manage_clients": True, - "ads_personalization_enabled": {"value": True}, - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "creator_email_address": "creator_email_address_value", + request_init = { + "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.GoogleAdsLink( - name="name_value", - customer_id="customer_id_value", - can_manage_clients=True, - creator_email_address="creator_email_address_value", - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleAdsLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_google_ads_link(request) + response = client.delete_measurement_protocol_secret(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.GoogleAdsLink) - assert response.name == "name_value" - assert response.customer_id == "customer_id_value" - assert response.can_manage_clients is True - assert response.creator_email_address == "creator_email_address_value" + assert response is None -def test_create_google_ads_link_rest_required_fields( - request_type=analytics_admin.CreateGoogleAdsLinkRequest, +def test_delete_measurement_protocol_secret_rest_required_fields( + request_type=analytics_admin.DeleteMeasurementProtocolSecretRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -41902,21 +42290,21 @@ def test_create_google_ads_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_google_ads_link._get_unset_required_fields(jsonified_request) + ).delete_measurement_protocol_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_google_ads_link._get_unset_required_fields(jsonified_request) + ).delete_measurement_protocol_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -41925,7 +42313,7 @@ def test_create_google_ads_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.GoogleAdsLink() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -41937,47 +42325,38 @@ def test_create_google_ads_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "delete", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = resources.GoogleAdsLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_google_ads_link(request) + response = client.delete_measurement_protocol_secret(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_google_ads_link_rest_unset_required_fields(): +def test_delete_measurement_protocol_secret_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_google_ads_link._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(()) - & set( - ( - "parent", - "googleAdsLink", - ) - ) + unset_fields = ( + transport.delete_measurement_protocol_secret._get_unset_required_fields({}) ) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_google_ads_link_rest_interceptors(null_interceptor): +def test_delete_measurement_protocol_secret_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -41990,14 +42369,12 @@ def test_create_google_ads_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_google_ads_link" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_google_ads_link" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_delete_measurement_protocol_secret", ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.CreateGoogleAdsLinkRequest.pb( - analytics_admin.CreateGoogleAdsLinkRequest() + pb_message = analytics_admin.DeleteMeasurementProtocolSecretRequest.pb( + analytics_admin.DeleteMeasurementProtocolSecretRequest() ) transcode.return_value = { "method": "post", @@ -42009,19 +42386,15 @@ def test_create_google_ads_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.GoogleAdsLink.to_json( - resources.GoogleAdsLink() - ) - request = analytics_admin.CreateGoogleAdsLinkRequest() + request = analytics_admin.DeleteMeasurementProtocolSecretRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.GoogleAdsLink() - client.create_google_ads_link( + client.delete_measurement_protocol_secret( request, metadata=[ ("key", "val"), @@ -42030,11 +42403,11 @@ def test_create_google_ads_link_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_create_google_ads_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateGoogleAdsLinkRequest +def test_delete_measurement_protocol_secret_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.DeleteMeasurementProtocolSecretRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42042,15 +42415,8 @@ def test_create_google_ads_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["google_ads_link"] = { - "name": "name_value", - "customer_id": "customer_id_value", - "can_manage_clients": True, - "ads_personalization_enabled": {"value": True}, - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "creator_email_address": "creator_email_address_value", + request_init = { + "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" } request = request_type(**request_init) @@ -42063,10 +42429,10 @@ def test_create_google_ads_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_google_ads_link(request) + client.delete_measurement_protocol_secret(request) -def test_create_google_ads_link_rest_flattened(): +def test_delete_measurement_protocol_secret_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -42075,39 +42441,42 @@ def test_create_google_ads_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.GoogleAdsLink() + return_value = None # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = { + "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" + } # get truthy value for each flattened field mock_args = dict( - parent="parent_value", - google_ads_link=resources.GoogleAdsLink(name="name_value"), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleAdsLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_google_ads_link(**mock_args) + client.delete_measurement_protocol_secret(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/googleAdsLinks" % client.transport._host, + "%s/v1alpha/{name=properties/*/dataStreams/*/measurementProtocolSecrets/*}" + % client.transport._host, args[1], ) -def test_create_google_ads_link_rest_flattened_error(transport: str = "rest"): +def test_delete_measurement_protocol_secret_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -42116,14 +42485,13 @@ def test_create_google_ads_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_google_ads_link( - analytics_admin.CreateGoogleAdsLinkRequest(), - parent="parent_value", - google_ads_link=resources.GoogleAdsLink(name="name_value"), + client.delete_measurement_protocol_secret( + analytics_admin.DeleteMeasurementProtocolSecretRequest(), + name="name_value", ) -def test_create_google_ads_link_rest_error(): +def test_delete_measurement_protocol_secret_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -42132,11 +42500,11 @@ def test_create_google_ads_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateGoogleAdsLinkRequest, + analytics_admin.UpdateMeasurementProtocolSecretRequest, dict, ], ) -def test_update_google_ads_link_rest(request_type): +def test_update_measurement_protocol_secret_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -42144,49 +42512,119 @@ def test_update_google_ads_link_rest(request_type): # send a request that will satisfy transcoding request_init = { - "google_ads_link": {"name": "properties/sample1/googleAdsLinks/sample2"} + "measurement_protocol_secret": { + "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" + } } - request_init["google_ads_link"] = { - "name": "properties/sample1/googleAdsLinks/sample2", - "customer_id": "customer_id_value", - "can_manage_clients": True, - "ads_personalization_enabled": {"value": True}, - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "creator_email_address": "creator_email_address_value", + request_init["measurement_protocol_secret"] = { + "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3", + "display_name": "display_name_value", + "secret_value": "secret_value_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateMeasurementProtocolSecretRequest.meta.fields[ + "measurement_protocol_secret" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "measurement_protocol_secret" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range( + 0, len(request_init["measurement_protocol_secret"][field]) + ): + del request_init["measurement_protocol_secret"][field][i][subfield] + else: + del request_init["measurement_protocol_secret"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.GoogleAdsLink( + return_value = resources.MeasurementProtocolSecret( name="name_value", - customer_id="customer_id_value", - can_manage_clients=True, - creator_email_address="creator_email_address_value", + display_name="display_name_value", + secret_value="secret_value_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleAdsLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_google_ads_link(request) + response = client.update_measurement_protocol_secret(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.GoogleAdsLink) + assert isinstance(response, resources.MeasurementProtocolSecret) assert response.name == "name_value" - assert response.customer_id == "customer_id_value" - assert response.can_manage_clients is True - assert response.creator_email_address == "creator_email_address_value" + assert response.display_name == "display_name_value" + assert response.secret_value == "secret_value_value" -def test_update_google_ads_link_rest_required_fields( - request_type=analytics_admin.UpdateGoogleAdsLinkRequest, +def test_update_measurement_protocol_secret_rest_required_fields( + request_type=analytics_admin.UpdateMeasurementProtocolSecretRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -42205,14 +42643,14 @@ def test_update_google_ads_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_google_ads_link._get_unset_required_fields(jsonified_request) + ).update_measurement_protocol_secret._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_google_ads_link._get_unset_required_fields(jsonified_request) + ).update_measurement_protocol_secret._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) @@ -42226,7 +42664,7 @@ def test_update_google_ads_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.GoogleAdsLink() + return_value = resources.MeasurementProtocolSecret() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -42247,30 +42685,41 @@ def test_update_google_ads_link_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleAdsLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_google_ads_link(request) + response = client.update_measurement_protocol_secret(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_google_ads_link_rest_unset_required_fields(): +def test_update_measurement_protocol_secret_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_google_ads_link._get_unset_required_fields({}) - assert set(unset_fields) == (set(("updateMask",)) & set(("updateMask",))) + unset_fields = ( + transport.update_measurement_protocol_secret._get_unset_required_fields({}) + ) + assert set(unset_fields) == ( + set(("updateMask",)) + & set( + ( + "measurementProtocolSecret", + "updateMask", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_google_ads_link_rest_interceptors(null_interceptor): +def test_update_measurement_protocol_secret_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -42283,14 +42732,16 @@ def test_update_google_ads_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_google_ads_link" + transports.AnalyticsAdminServiceRestInterceptor, + "post_update_measurement_protocol_secret", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_google_ads_link" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_update_measurement_protocol_secret", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateGoogleAdsLinkRequest.pb( - analytics_admin.UpdateGoogleAdsLinkRequest() + pb_message = analytics_admin.UpdateMeasurementProtocolSecretRequest.pb( + analytics_admin.UpdateMeasurementProtocolSecretRequest() ) transcode.return_value = { "method": "post", @@ -42302,19 +42753,19 @@ def test_update_google_ads_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.GoogleAdsLink.to_json( - resources.GoogleAdsLink() + req.return_value._content = resources.MeasurementProtocolSecret.to_json( + resources.MeasurementProtocolSecret() ) - request = analytics_admin.UpdateGoogleAdsLinkRequest() + request = analytics_admin.UpdateMeasurementProtocolSecretRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.GoogleAdsLink() + post.return_value = resources.MeasurementProtocolSecret() - client.update_google_ads_link( + client.update_measurement_protocol_secret( request, metadata=[ ("key", "val"), @@ -42326,8 +42777,9 @@ def test_update_google_ads_link_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_google_ads_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateGoogleAdsLinkRequest +def test_update_measurement_protocol_secret_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.UpdateMeasurementProtocolSecretRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42336,16 +42788,9 @@ def test_update_google_ads_link_rest_bad_request( # send a request that will satisfy transcoding request_init = { - "google_ads_link": {"name": "properties/sample1/googleAdsLinks/sample2"} - } - request_init["google_ads_link"] = { - "name": "properties/sample1/googleAdsLinks/sample2", - "customer_id": "customer_id_value", - "can_manage_clients": True, - "ads_personalization_enabled": {"value": True}, - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "creator_email_address": "creator_email_address_value", + "measurement_protocol_secret": { + "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" + } } request = request_type(**request_init) @@ -42358,10 +42803,10 @@ def test_update_google_ads_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_google_ads_link(request) + client.update_measurement_protocol_secret(request) -def test_update_google_ads_link_rest_flattened(): +def test_update_measurement_protocol_secret_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -42370,16 +42815,20 @@ def test_update_google_ads_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.GoogleAdsLink() + return_value = resources.MeasurementProtocolSecret() # get arguments that satisfy an http rule for this method sample_request = { - "google_ads_link": {"name": "properties/sample1/googleAdsLinks/sample2"} + "measurement_protocol_secret": { + "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" + } } # get truthy value for each flattened field mock_args = dict( - google_ads_link=resources.GoogleAdsLink(name="name_value"), + measurement_protocol_secret=resources.MeasurementProtocolSecret( + name="name_value" + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) @@ -42387,25 +42836,28 @@ def test_update_google_ads_link_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleAdsLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_google_ads_link(**mock_args) + client.update_measurement_protocol_secret(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{google_ads_link.name=properties/*/googleAdsLinks/*}" + "%s/v1alpha/{measurement_protocol_secret.name=properties/*/dataStreams/*/measurementProtocolSecrets/*}" % client.transport._host, args[1], ) -def test_update_google_ads_link_rest_flattened_error(transport: str = "rest"): +def test_update_measurement_protocol_secret_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -42414,14 +42866,16 @@ def test_update_google_ads_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_google_ads_link( - analytics_admin.UpdateGoogleAdsLinkRequest(), - google_ads_link=resources.GoogleAdsLink(name="name_value"), + client.update_measurement_protocol_secret( + analytics_admin.UpdateMeasurementProtocolSecretRequest(), + measurement_protocol_secret=resources.MeasurementProtocolSecret( + name="name_value" + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_update_google_ads_link_rest_error(): +def test_update_measurement_protocol_secret_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -42430,45 +42884,50 @@ def test_update_google_ads_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteGoogleAdsLinkRequest, + analytics_admin.AcknowledgeUserDataCollectionRequest, dict, ], ) -def test_delete_google_ads_link_rest(request_type): +def test_acknowledge_user_data_collection_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/googleAdsLinks/sample2"} + request_init = {"property": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = analytics_admin.AcknowledgeUserDataCollectionResponse() # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = analytics_admin.AcknowledgeUserDataCollectionResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_google_ads_link(request) + response = client.acknowledge_user_data_collection(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, analytics_admin.AcknowledgeUserDataCollectionResponse) -def test_delete_google_ads_link_rest_required_fields( - request_type=analytics_admin.DeleteGoogleAdsLinkRequest, +def test_acknowledge_user_data_collection_rest_required_fields( + request_type=analytics_admin.AcknowledgeUserDataCollectionRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["property"] = "" + request_init["acknowledgement"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -42483,21 +42942,24 @@ def test_delete_google_ads_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_google_ads_link._get_unset_required_fields(jsonified_request) + ).acknowledge_user_data_collection._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["property"] = "property_value" + jsonified_request["acknowledgement"] = "acknowledgement_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_google_ads_link._get_unset_required_fields(jsonified_request) + ).acknowledge_user_data_collection._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "property" in jsonified_request + assert jsonified_request["property"] == "property_value" + assert "acknowledgement" in jsonified_request + assert jsonified_request["acknowledgement"] == "acknowledgement_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42506,7 +42968,7 @@ def test_delete_google_ads_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = analytics_admin.AcknowledgeUserDataCollectionResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -42518,36 +42980,52 @@ def test_delete_google_ads_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = analytics_admin.AcknowledgeUserDataCollectionResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_google_ads_link(request) + response = client.acknowledge_user_data_collection(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_google_ads_link_rest_unset_required_fields(): +def test_acknowledge_user_data_collection_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_google_ads_link._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = ( + transport.acknowledge_user_data_collection._get_unset_required_fields({}) + ) + assert set(unset_fields) == ( + set(()) + & set( + ( + "property", + "acknowledgement", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_google_ads_link_rest_interceptors(null_interceptor): +def test_acknowledge_user_data_collection_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -42560,11 +43038,16 @@ def test_delete_google_ads_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_google_ads_link" + transports.AnalyticsAdminServiceRestInterceptor, + "post_acknowledge_user_data_collection", + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, + "pre_acknowledge_user_data_collection", ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteGoogleAdsLinkRequest.pb( - analytics_admin.DeleteGoogleAdsLinkRequest() + post.assert_not_called() + pb_message = analytics_admin.AcknowledgeUserDataCollectionRequest.pb( + analytics_admin.AcknowledgeUserDataCollectionRequest() ) transcode.return_value = { "method": "post", @@ -42576,15 +43059,21 @@ def test_delete_google_ads_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = ( + analytics_admin.AcknowledgeUserDataCollectionResponse.to_json( + analytics_admin.AcknowledgeUserDataCollectionResponse() + ) + ) - request = analytics_admin.DeleteGoogleAdsLinkRequest() + request = analytics_admin.AcknowledgeUserDataCollectionRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = analytics_admin.AcknowledgeUserDataCollectionResponse() - client.delete_google_ads_link( + client.acknowledge_user_data_collection( request, metadata=[ ("key", "val"), @@ -42593,10 +43082,12 @@ def test_delete_google_ads_link_rest_interceptors(null_interceptor): ) pre.assert_called_once() + post.assert_called_once() -def test_delete_google_ads_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteGoogleAdsLinkRequest +def test_acknowledge_user_data_collection_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.AcknowledgeUserDataCollectionRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42604,7 +43095,7 @@ def test_delete_google_ads_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/googleAdsLinks/sample2"} + request_init = {"property": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -42616,64 +43107,10 @@ def test_delete_google_ads_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_google_ads_link(request) - - -def test_delete_google_ads_link_rest_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = None - - # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/googleAdsLinks/sample2"} - - # get truthy value for each flattened field - mock_args = dict( - name="name_value", - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = "" - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.delete_google_ads_link(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{name=properties/*/googleAdsLinks/*}" % client.transport._host, - args[1], - ) - - -def test_delete_google_ads_link_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_google_ads_link( - analytics_admin.DeleteGoogleAdsLinkRequest(), - name="name_value", - ) + client.acknowledge_user_data_collection(request) -def test_delete_google_ads_link_rest_error(): +def test_acknowledge_user_data_collection_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -42682,49 +43119,54 @@ def test_delete_google_ads_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListGoogleAdsLinksRequest, + analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, dict, ], ) -def test_list_google_ads_links_rest(request_type): +def test_get_sk_ad_network_conversion_value_schema_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = { + "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" + } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListGoogleAdsLinksResponse( - next_page_token="next_page_token_value", + return_value = resources.SKAdNetworkConversionValueSchema( + name="name_value", + apply_conversion_values=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListGoogleAdsLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_google_ads_links(request) + response = client.get_sk_ad_network_conversion_value_schema(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListGoogleAdsLinksPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.SKAdNetworkConversionValueSchema) + assert response.name == "name_value" + assert response.apply_conversion_values is True -def test_list_google_ads_links_rest_required_fields( - request_type=analytics_admin.ListGoogleAdsLinksRequest, +def test_get_sk_ad_network_conversion_value_schema_rest_required_fields( + request_type=analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -42739,28 +43181,25 @@ def test_list_google_ads_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_google_ads_links._get_unset_required_fields(jsonified_request) + ).get_sk_ad_network_conversion_value_schema._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_google_ads_links._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) + ).get_sk_ad_network_conversion_value_schema._get_unset_required_fields( + jsonified_request ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42769,7 +43208,7 @@ def test_list_google_ads_links_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListGoogleAdsLinksResponse() + return_value = resources.SKAdNetworkConversionValueSchema() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -42789,40 +43228,35 @@ def test_list_google_ads_links_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListGoogleAdsLinksResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_google_ads_links(request) + response = client.get_sk_ad_network_conversion_value_schema(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_google_ads_links_rest_unset_required_fields(): +def test_get_sk_ad_network_conversion_value_schema_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_google_ads_links._get_unset_required_fields({}) - assert set(unset_fields) == ( - set( - ( - "pageSize", - "pageToken", - ) + unset_fields = ( + transport.get_sk_ad_network_conversion_value_schema._get_unset_required_fields( + {} ) - & set(("parent",)) ) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_google_ads_links_rest_interceptors(null_interceptor): +def test_get_sk_ad_network_conversion_value_schema_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -42835,14 +43269,16 @@ def test_list_google_ads_links_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_google_ads_links" + transports.AnalyticsAdminServiceRestInterceptor, + "post_get_sk_ad_network_conversion_value_schema", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_google_ads_links" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_get_sk_ad_network_conversion_value_schema", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListGoogleAdsLinksRequest.pb( - analytics_admin.ListGoogleAdsLinksRequest() + pb_message = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest.pb( + analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() ) transcode.return_value = { "method": "post", @@ -42854,19 +43290,19 @@ def test_list_google_ads_links_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ListGoogleAdsLinksResponse.to_json( - analytics_admin.ListGoogleAdsLinksResponse() + req.return_value._content = resources.SKAdNetworkConversionValueSchema.to_json( + resources.SKAdNetworkConversionValueSchema() ) - request = analytics_admin.ListGoogleAdsLinksRequest() + request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListGoogleAdsLinksResponse() + post.return_value = resources.SKAdNetworkConversionValueSchema() - client.list_google_ads_links( + client.get_sk_ad_network_conversion_value_schema( request, metadata=[ ("key", "val"), @@ -42878,8 +43314,9 @@ def test_list_google_ads_links_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_google_ads_links_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListGoogleAdsLinksRequest +def test_get_sk_ad_network_conversion_value_schema_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -42887,7 +43324,9 @@ def test_list_google_ads_links_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = { + "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -42899,10 +43338,10 @@ def test_list_google_ads_links_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_google_ads_links(request) + client.get_sk_ad_network_conversion_value_schema(request) -def test_list_google_ads_links_rest_flattened(): +def test_get_sk_ad_network_conversion_value_schema_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -42911,38 +43350,44 @@ def test_list_google_ads_links_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListGoogleAdsLinksResponse() + return_value = resources.SKAdNetworkConversionValueSchema() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = { + "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" + } # get truthy value for each flattened field mock_args = dict( - parent="parent_value", + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListGoogleAdsLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_google_ads_links(**mock_args) + client.get_sk_ad_network_conversion_value_schema(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/googleAdsLinks" % client.transport._host, + "%s/v1alpha/{name=properties/*/dataStreams/*/sKAdNetworkConversionValueSchema/*}" + % client.transport._host, args[1], ) -def test_list_google_ads_links_rest_flattened_error(transport: str = "rest"): +def test_get_sk_ad_network_conversion_value_schema_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -42951,131 +43396,170 @@ def test_list_google_ads_links_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_google_ads_links( - analytics_admin.ListGoogleAdsLinksRequest(), - parent="parent_value", + client.get_sk_ad_network_conversion_value_schema( + analytics_admin.GetSKAdNetworkConversionValueSchemaRequest(), + name="name_value", ) -def test_list_google_ads_links_rest_pager(transport: str = "rest"): +def test_get_sk_ad_network_conversion_value_schema_rest_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[], - next_page_token="def", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListGoogleAdsLinksResponse( - google_ads_links=[ - resources.GoogleAdsLink(), - resources.GoogleAdsLink(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListGoogleAdsLinksResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "properties/sample1"} - - pager = client.list_google_ads_links(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.GoogleAdsLink) for i in results) - - pages = list(client.list_google_ads_links(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataSharingSettingsRequest, + analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, dict, ], ) -def test_get_data_sharing_settings_rest(request_type): +def test_create_sk_ad_network_conversion_value_schema_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1/dataSharingSettings"} + request_init = {"parent": "properties/sample1/dataStreams/sample2"} + request_init["skadnetwork_conversion_value_schema"] = { + "name": "name_value", + "postback_window_one": { + "conversion_values": [ + { + "display_name": "display_name_value", + "fine_value": 1054, + "coarse_value": 1, + "event_mappings": [ + { + "event_name": "event_name_value", + "min_event_count": 1613, + "max_event_count": 1615, + "min_event_value": 0.16010000000000002, + "max_event_value": 0.1603, + } + ], + "lock_enabled": True, + } + ], + "postback_window_settings_enabled": True, + }, + "postback_window_two": {}, + "postback_window_three": {}, + "apply_conversion_values": True, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = ( + analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest.meta.fields[ + "skadnetwork_conversion_value_schema" + ] + ) + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "skadnetwork_conversion_value_schema" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range( + 0, len(request_init["skadnetwork_conversion_value_schema"][field]) + ): + del request_init["skadnetwork_conversion_value_schema"][field][i][ + subfield + ] + else: + del request_init["skadnetwork_conversion_value_schema"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DataSharingSettings( + return_value = resources.SKAdNetworkConversionValueSchema( name="name_value", - sharing_with_google_support_enabled=True, - sharing_with_google_assigned_sales_enabled=True, - sharing_with_google_any_sales_enabled=True, - sharing_with_google_products_enabled=True, - sharing_with_others_enabled=True, + apply_conversion_values=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataSharingSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_data_sharing_settings(request) + response = client.create_sk_ad_network_conversion_value_schema(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataSharingSettings) + assert isinstance(response, resources.SKAdNetworkConversionValueSchema) assert response.name == "name_value" - assert response.sharing_with_google_support_enabled is True - assert response.sharing_with_google_assigned_sales_enabled is True - assert response.sharing_with_google_any_sales_enabled is True - assert response.sharing_with_google_products_enabled is True - assert response.sharing_with_others_enabled is True + assert response.apply_conversion_values is True -def test_get_data_sharing_settings_rest_required_fields( - request_type=analytics_admin.GetDataSharingSettingsRequest, +def test_create_sk_ad_network_conversion_value_schema_rest_required_fields( + request_type=analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -43090,21 +43574,25 @@ def test_get_data_sharing_settings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_data_sharing_settings._get_unset_required_fields(jsonified_request) + ).create_sk_ad_network_conversion_value_schema._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_data_sharing_settings._get_unset_required_fields(jsonified_request) + ).create_sk_ad_network_conversion_value_schema._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -43113,7 +43601,7 @@ def test_get_data_sharing_settings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.DataSharingSettings() + return_value = resources.SKAdNetworkConversionValueSchema() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -43125,38 +43613,52 @@ def test_get_data_sharing_settings_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataSharingSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_data_sharing_settings(request) + response = client.create_sk_ad_network_conversion_value_schema(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_data_sharing_settings_rest_unset_required_fields(): +def test_create_sk_ad_network_conversion_value_schema_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_data_sharing_settings._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.create_sk_ad_network_conversion_value_schema._get_unset_required_fields( + {} + ) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "skadnetworkConversionValueSchema", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_data_sharing_settings_rest_interceptors(null_interceptor): +def test_create_sk_ad_network_conversion_value_schema_rest_interceptors( + null_interceptor, +): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -43170,14 +43672,15 @@ def test_get_data_sharing_settings_rest_interceptors(null_interceptor): path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_get_data_sharing_settings", + "post_create_sk_ad_network_conversion_value_schema", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_data_sharing_settings" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_create_sk_ad_network_conversion_value_schema", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetDataSharingSettingsRequest.pb( - analytics_admin.GetDataSharingSettingsRequest() + pb_message = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest.pb( + analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() ) transcode.return_value = { "method": "post", @@ -43189,19 +43692,19 @@ def test_get_data_sharing_settings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.DataSharingSettings.to_json( - resources.DataSharingSettings() + req.return_value._content = resources.SKAdNetworkConversionValueSchema.to_json( + resources.SKAdNetworkConversionValueSchema() ) - request = analytics_admin.GetDataSharingSettingsRequest() + request = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.DataSharingSettings() + post.return_value = resources.SKAdNetworkConversionValueSchema() - client.get_data_sharing_settings( + client.create_sk_ad_network_conversion_value_schema( request, metadata=[ ("key", "val"), @@ -43213,8 +43716,9 @@ def test_get_data_sharing_settings_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_data_sharing_settings_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetDataSharingSettingsRequest +def test_create_sk_ad_network_conversion_value_schema_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -43222,7 +43726,7 @@ def test_get_data_sharing_settings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1/dataSharingSettings"} + request_init = {"parent": "properties/sample1/dataStreams/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -43234,10 +43738,10 @@ def test_get_data_sharing_settings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_data_sharing_settings(request) + client.create_sk_ad_network_conversion_value_schema(request) -def test_get_data_sharing_settings_rest_flattened(): +def test_create_sk_ad_network_conversion_value_schema_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -43246,38 +43750,45 @@ def test_get_data_sharing_settings_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DataSharingSettings() + return_value = resources.SKAdNetworkConversionValueSchema() # get arguments that satisfy an http rule for this method - sample_request = {"name": "accounts/sample1/dataSharingSettings"} + sample_request = {"parent": "properties/sample1/dataStreams/sample2"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", + skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( + name="name_value" + ), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataSharingSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_data_sharing_settings(**mock_args) + client.create_sk_ad_network_conversion_value_schema(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=accounts/*/dataSharingSettings}" % client.transport._host, + "%s/v1alpha/{parent=properties/*/dataStreams/*}/sKAdNetworkConversionValueSchema" + % client.transport._host, args[1], ) -def test_get_data_sharing_settings_rest_flattened_error(transport: str = "rest"): +def test_create_sk_ad_network_conversion_value_schema_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -43286,13 +43797,16 @@ def test_get_data_sharing_settings_rest_flattened_error(transport: str = "rest") # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_data_sharing_settings( - analytics_admin.GetDataSharingSettingsRequest(), - name="name_value", + client.create_sk_ad_network_conversion_value_schema( + analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest(), + parent="parent_value", + skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( + name="name_value" + ), ) -def test_get_data_sharing_settings_rest_error(): +def test_create_sk_ad_network_conversion_value_schema_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -43301,11 +43815,11 @@ def test_get_data_sharing_settings_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetMeasurementProtocolSecretRequest, + analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, dict, ], ) -def test_get_measurement_protocol_secret_rest(request_type): +def test_delete_sk_ad_network_conversion_value_schema_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -43313,38 +43827,30 @@ def test_get_measurement_protocol_secret_rest(request_type): # send a request that will satisfy transcoding request_init = { - "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" + "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.MeasurementProtocolSecret( - name="name_value", - display_name="display_name_value", - secret_value="secret_value_value", - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_measurement_protocol_secret(request) + response = client.delete_sk_ad_network_conversion_value_schema(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.MeasurementProtocolSecret) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.secret_value == "secret_value_value" + assert response is None -def test_get_measurement_protocol_secret_rest_required_fields( - request_type=analytics_admin.GetMeasurementProtocolSecretRequest, +def test_delete_sk_ad_network_conversion_value_schema_rest_required_fields( + request_type=analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -43364,7 +43870,9 @@ def test_get_measurement_protocol_secret_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_measurement_protocol_secret._get_unset_required_fields(jsonified_request) + ).delete_sk_ad_network_conversion_value_schema._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -43373,7 +43881,9 @@ def test_get_measurement_protocol_secret_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_measurement_protocol_secret._get_unset_required_fields(jsonified_request) + ).delete_sk_ad_network_conversion_value_schema._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -43387,7 +43897,7 @@ def test_get_measurement_protocol_secret_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.MeasurementProtocolSecret() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -43399,40 +43909,40 @@ def test_get_measurement_protocol_secret_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "delete", "query_params": pb_request, } transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_measurement_protocol_secret(request) + response = client.delete_sk_ad_network_conversion_value_schema(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_measurement_protocol_secret_rest_unset_required_fields(): +def test_delete_sk_ad_network_conversion_value_schema_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_measurement_protocol_secret._get_unset_required_fields( + unset_fields = transport.delete_sk_ad_network_conversion_value_schema._get_unset_required_fields( {} ) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_measurement_protocol_secret_rest_interceptors(null_interceptor): +def test_delete_sk_ad_network_conversion_value_schema_rest_interceptors( + null_interceptor, +): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -43446,15 +43956,11 @@ def test_get_measurement_protocol_secret_rest_interceptors(null_interceptor): path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_get_measurement_protocol_secret", - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_get_measurement_protocol_secret", + "pre_delete_sk_ad_network_conversion_value_schema", ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.GetMeasurementProtocolSecretRequest.pb( - analytics_admin.GetMeasurementProtocolSecretRequest() + pb_message = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest.pb( + analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() ) transcode.return_value = { "method": "post", @@ -43466,19 +43972,15 @@ def test_get_measurement_protocol_secret_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.MeasurementProtocolSecret.to_json( - resources.MeasurementProtocolSecret() - ) - request = analytics_admin.GetMeasurementProtocolSecretRequest() + request = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.MeasurementProtocolSecret() - client.get_measurement_protocol_secret( + client.delete_sk_ad_network_conversion_value_schema( request, metadata=[ ("key", "val"), @@ -43487,12 +43989,11 @@ def test_get_measurement_protocol_secret_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_get_measurement_protocol_secret_rest_bad_request( +def test_delete_sk_ad_network_conversion_value_schema_rest_bad_request( transport: str = "rest", - request_type=analytics_admin.GetMeasurementProtocolSecretRequest, + request_type=analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -43501,7 +44002,7 @@ def test_get_measurement_protocol_secret_rest_bad_request( # send a request that will satisfy transcoding request_init = { - "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" + "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" } request = request_type(**request_init) @@ -43514,10 +44015,10 @@ def test_get_measurement_protocol_secret_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_measurement_protocol_secret(request) + client.delete_sk_ad_network_conversion_value_schema(request) -def test_get_measurement_protocol_secret_rest_flattened(): +def test_delete_sk_ad_network_conversion_value_schema_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -43526,11 +44027,11 @@ def test_get_measurement_protocol_secret_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.MeasurementProtocolSecret() + return_value = None # get arguments that satisfy an http rule for this method sample_request = { - "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" + "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" } # get truthy value for each flattened field @@ -43542,25 +44043,26 @@ def test_get_measurement_protocol_secret_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_measurement_protocol_secret(**mock_args) + client.delete_sk_ad_network_conversion_value_schema(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/dataStreams/*/measurementProtocolSecrets/*}" + "%s/v1alpha/{name=properties/*/dataStreams/*/sKAdNetworkConversionValueSchema/*}" % client.transport._host, args[1], ) -def test_get_measurement_protocol_secret_rest_flattened_error(transport: str = "rest"): +def test_delete_sk_ad_network_conversion_value_schema_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -43569,13 +44071,13 @@ def test_get_measurement_protocol_secret_rest_flattened_error(transport: str = " # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_measurement_protocol_secret( - analytics_admin.GetMeasurementProtocolSecretRequest(), + client.delete_sk_ad_network_conversion_value_schema( + analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest(), name="name_value", ) -def test_get_measurement_protocol_secret_rest_error(): +def test_delete_sk_ad_network_conversion_value_schema_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -43584,51 +44086,158 @@ def test_get_measurement_protocol_secret_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListMeasurementProtocolSecretsRequest, + analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, dict, ], ) -def test_list_measurement_protocol_secrets_rest(request_type): +def test_update_sk_ad_network_conversion_value_schema_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1/dataStreams/sample2"} + request_init = { + "skadnetwork_conversion_value_schema": { + "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" + } + } + request_init["skadnetwork_conversion_value_schema"] = { + "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3", + "postback_window_one": { + "conversion_values": [ + { + "display_name": "display_name_value", + "fine_value": 1054, + "coarse_value": 1, + "event_mappings": [ + { + "event_name": "event_name_value", + "min_event_count": 1613, + "max_event_count": 1615, + "min_event_value": 0.16010000000000002, + "max_event_value": 0.1603, + } + ], + "lock_enabled": True, + } + ], + "postback_window_settings_enabled": True, + }, + "postback_window_two": {}, + "postback_window_three": {}, + "apply_conversion_values": True, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = ( + analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest.meta.fields[ + "skadnetwork_conversion_value_schema" + ] + ) + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "skadnetwork_conversion_value_schema" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range( + 0, len(request_init["skadnetwork_conversion_value_schema"][field]) + ): + del request_init["skadnetwork_conversion_value_schema"][field][i][ + subfield + ] + else: + del request_init["skadnetwork_conversion_value_schema"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListMeasurementProtocolSecretsResponse( - next_page_token="next_page_token_value", + return_value = resources.SKAdNetworkConversionValueSchema( + name="name_value", + apply_conversion_values=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListMeasurementProtocolSecretsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_measurement_protocol_secrets(request) + response = client.update_sk_ad_network_conversion_value_schema(request) - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListMeasurementProtocolSecretsPager) - assert response.next_page_token == "next_page_token_value" + # Establish that the response is the type that we expect. + assert isinstance(response, resources.SKAdNetworkConversionValueSchema) + assert response.name == "name_value" + assert response.apply_conversion_values is True -def test_list_measurement_protocol_secrets_rest_required_fields( - request_type=analytics_admin.ListMeasurementProtocolSecretsRequest, +def test_update_sk_ad_network_conversion_value_schema_rest_required_fields( + request_type=analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -43643,28 +44252,23 @@ def test_list_measurement_protocol_secrets_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_measurement_protocol_secrets._get_unset_required_fields(jsonified_request) + ).update_sk_ad_network_conversion_value_schema._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_measurement_protocol_secrets._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) + ).update_sk_ad_network_conversion_value_schema._get_unset_required_fields( + jsonified_request ) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -43673,7 +44277,7 @@ def test_list_measurement_protocol_secrets_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListMeasurementProtocolSecretsResponse() + return_value = resources.SKAdNetworkConversionValueSchema() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -43685,50 +44289,52 @@ def test_list_measurement_protocol_secrets_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "patch", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListMeasurementProtocolSecretsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_measurement_protocol_secrets(request) + response = client.update_sk_ad_network_conversion_value_schema(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_measurement_protocol_secrets_rest_unset_required_fields(): +def test_update_sk_ad_network_conversion_value_schema_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.list_measurement_protocol_secrets._get_unset_required_fields({}) + unset_fields = transport.update_sk_ad_network_conversion_value_schema._get_unset_required_fields( + {} ) assert set(unset_fields) == ( - set( + set(("updateMask",)) + & set( ( - "pageSize", - "pageToken", + "skadnetworkConversionValueSchema", + "updateMask", ) ) - & set(("parent",)) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_measurement_protocol_secrets_rest_interceptors(null_interceptor): +def test_update_sk_ad_network_conversion_value_schema_rest_interceptors( + null_interceptor, +): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -43742,15 +44348,15 @@ def test_list_measurement_protocol_secrets_rest_interceptors(null_interceptor): path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_list_measurement_protocol_secrets", + "post_update_sk_ad_network_conversion_value_schema", ) as post, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "pre_list_measurement_protocol_secrets", + "pre_update_sk_ad_network_conversion_value_schema", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListMeasurementProtocolSecretsRequest.pb( - analytics_admin.ListMeasurementProtocolSecretsRequest() + pb_message = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest.pb( + analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() ) transcode.return_value = { "method": "post", @@ -43762,21 +44368,19 @@ def test_list_measurement_protocol_secrets_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.ListMeasurementProtocolSecretsResponse.to_json( - analytics_admin.ListMeasurementProtocolSecretsResponse() - ) + req.return_value._content = resources.SKAdNetworkConversionValueSchema.to_json( + resources.SKAdNetworkConversionValueSchema() ) - request = analytics_admin.ListMeasurementProtocolSecretsRequest() + request = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListMeasurementProtocolSecretsResponse() + post.return_value = resources.SKAdNetworkConversionValueSchema() - client.list_measurement_protocol_secrets( + client.update_sk_ad_network_conversion_value_schema( request, metadata=[ ("key", "val"), @@ -43788,9 +44392,9 @@ def test_list_measurement_protocol_secrets_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_measurement_protocol_secrets_rest_bad_request( +def test_update_sk_ad_network_conversion_value_schema_rest_bad_request( transport: str = "rest", - request_type=analytics_admin.ListMeasurementProtocolSecretsRequest, + request_type=analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -43798,7 +44402,11 @@ def test_list_measurement_protocol_secrets_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1/dataStreams/sample2"} + request_init = { + "skadnetwork_conversion_value_schema": { + "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" + } + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -43810,10 +44418,10 @@ def test_list_measurement_protocol_secrets_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_measurement_protocol_secrets(request) + client.update_sk_ad_network_conversion_value_schema(request) -def test_list_measurement_protocol_secrets_rest_flattened(): +def test_update_sk_ad_network_conversion_value_schema_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -43822,41 +44430,47 @@ def test_list_measurement_protocol_secrets_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListMeasurementProtocolSecretsResponse() + return_value = resources.SKAdNetworkConversionValueSchema() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1/dataStreams/sample2"} + sample_request = { + "skadnetwork_conversion_value_schema": { + "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" + } + } # get truthy value for each flattened field mock_args = dict( - parent="parent_value", + skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListMeasurementProtocolSecretsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_measurement_protocol_secrets(**mock_args) + client.update_sk_ad_network_conversion_value_schema(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*/dataStreams/*}/measurementProtocolSecrets" + "%s/v1alpha/{skadnetwork_conversion_value_schema.name=properties/*/dataStreams/*/sKAdNetworkConversionValueSchema/*}" % client.transport._host, args[1], ) -def test_list_measurement_protocol_secrets_rest_flattened_error( +def test_update_sk_ad_network_conversion_value_schema_rest_flattened_error( transport: str = "rest", ): client = AnalyticsAdminServiceClient( @@ -43867,86 +44481,29 @@ def test_list_measurement_protocol_secrets_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_measurement_protocol_secrets( - analytics_admin.ListMeasurementProtocolSecretsRequest(), - parent="parent_value", + client.update_sk_ad_network_conversion_value_schema( + analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest(), + skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_list_measurement_protocol_secrets_rest_pager(transport: str = "rest"): +def test_update_sk_ad_network_conversion_value_schema_rest_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - ], - next_page_token="abc", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[], - next_page_token="def", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - ], - next_page_token="ghi", - ), - analytics_admin.ListMeasurementProtocolSecretsResponse( - measurement_protocol_secrets=[ - resources.MeasurementProtocolSecret(), - resources.MeasurementProtocolSecret(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListMeasurementProtocolSecretsResponse.to_json(x) - for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "properties/sample1/dataStreams/sample2"} - - pager = client.list_measurement_protocol_secrets(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.MeasurementProtocolSecret) for i in results) - - pages = list( - client.list_measurement_protocol_secrets(request=sample_request).pages - ) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateMeasurementProtocolSecretRequest, + analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, dict, ], ) -def test_create_measurement_protocol_secret_rest(request_type): +def test_list_sk_ad_network_conversion_value_schemas_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -43954,41 +44511,35 @@ def test_create_measurement_protocol_secret_rest(request_type): # send a request that will satisfy transcoding request_init = {"parent": "properties/sample1/dataStreams/sample2"} - request_init["measurement_protocol_secret"] = { - "name": "name_value", - "display_name": "display_name_value", - "secret_value": "secret_value_value", - } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.MeasurementProtocolSecret( - name="name_value", - display_name="display_name_value", - secret_value="secret_value_value", + return_value = analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListSKAdNetworkConversionValueSchemasResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_measurement_protocol_secret(request) + response = client.list_sk_ad_network_conversion_value_schemas(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.MeasurementProtocolSecret) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.secret_value == "secret_value_value" + assert isinstance(response, pagers.ListSKAdNetworkConversionValueSchemasPager) + assert response.next_page_token == "next_page_token_value" -def test_create_measurement_protocol_secret_rest_required_fields( - request_type=analytics_admin.CreateMeasurementProtocolSecretRequest, +def test_list_sk_ad_network_conversion_value_schemas_rest_required_fields( + request_type=analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -44008,7 +44559,9 @@ def test_create_measurement_protocol_secret_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_measurement_protocol_secret._get_unset_required_fields(jsonified_request) + ).list_sk_ad_network_conversion_value_schemas._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -44017,7 +44570,16 @@ def test_create_measurement_protocol_secret_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_measurement_protocol_secret._get_unset_required_fields(jsonified_request) + ).list_sk_ad_network_conversion_value_schemas._get_unset_required_fields( + jsonified_request + ) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -44031,7 +44593,7 @@ def test_create_measurement_protocol_secret_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.MeasurementProtocolSecret() + return_value = analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -44043,49 +44605,55 @@ def test_create_measurement_protocol_secret_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse.pb( + return_value + ) + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_measurement_protocol_secret(request) + response = client.list_sk_ad_network_conversion_value_schemas(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_measurement_protocol_secret_rest_unset_required_fields(): +def test_list_sk_ad_network_conversion_value_schemas_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.create_measurement_protocol_secret._get_unset_required_fields({}) + unset_fields = transport.list_sk_ad_network_conversion_value_schemas._get_unset_required_fields( + {} ) assert set(unset_fields) == ( - set(()) - & set( + set( ( - "parent", - "measurementProtocolSecret", + "pageSize", + "pageToken", ) ) + & set(("parent",)) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_measurement_protocol_secret_rest_interceptors(null_interceptor): +def test_list_sk_ad_network_conversion_value_schemas_rest_interceptors( + null_interceptor, +): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -44099,15 +44667,15 @@ def test_create_measurement_protocol_secret_rest_interceptors(null_interceptor): path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_create_measurement_protocol_secret", + "post_list_sk_ad_network_conversion_value_schemas", ) as post, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "pre_create_measurement_protocol_secret", + "pre_list_sk_ad_network_conversion_value_schemas", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateMeasurementProtocolSecretRequest.pb( - analytics_admin.CreateMeasurementProtocolSecretRequest() + pb_message = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest.pb( + analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() ) transcode.return_value = { "method": "post", @@ -44119,19 +44687,23 @@ def test_create_measurement_protocol_secret_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.MeasurementProtocolSecret.to_json( - resources.MeasurementProtocolSecret() + req.return_value._content = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse.to_json( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() + ) ) - request = analytics_admin.CreateMeasurementProtocolSecretRequest() + request = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.MeasurementProtocolSecret() + post.return_value = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() + ) - client.create_measurement_protocol_secret( + client.list_sk_ad_network_conversion_value_schemas( request, metadata=[ ("key", "val"), @@ -44143,9 +44715,9 @@ def test_create_measurement_protocol_secret_rest_interceptors(null_interceptor): post.assert_called_once() -def test_create_measurement_protocol_secret_rest_bad_request( +def test_list_sk_ad_network_conversion_value_schemas_rest_bad_request( transport: str = "rest", - request_type=analytics_admin.CreateMeasurementProtocolSecretRequest, + request_type=analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -44154,11 +44726,6 @@ def test_create_measurement_protocol_secret_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "properties/sample1/dataStreams/sample2"} - request_init["measurement_protocol_secret"] = { - "name": "name_value", - "display_name": "display_name_value", - "secret_value": "secret_value_value", - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -44170,10 +44737,10 @@ def test_create_measurement_protocol_secret_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_measurement_protocol_secret(request) + client.list_sk_ad_network_conversion_value_schemas(request) -def test_create_measurement_protocol_secret_rest_flattened(): +def test_list_sk_ad_network_conversion_value_schemas_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -44182,7 +44749,7 @@ def test_create_measurement_protocol_secret_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.MeasurementProtocolSecret() + return_value = analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() # get arguments that satisfy an http rule for this method sample_request = {"parent": "properties/sample1/dataStreams/sample2"} @@ -44190,34 +44757,34 @@ def test_create_measurement_protocol_secret_rest_flattened(): # get truthy value for each flattened field mock_args = dict( parent="parent_value", - measurement_protocol_secret=resources.MeasurementProtocolSecret( - name="name_value" - ), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListSKAdNetworkConversionValueSchemasResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_measurement_protocol_secret(**mock_args) + client.list_sk_ad_network_conversion_value_schemas(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*/dataStreams/*}/measurementProtocolSecrets" + "%s/v1alpha/{parent=properties/*/dataStreams/*}/sKAdNetworkConversionValueSchema" % client.transport._host, args[1], ) -def test_create_measurement_protocol_secret_rest_flattened_error( +def test_list_sk_ad_network_conversion_value_schemas_rest_flattened_error( transport: str = "rest", ): client = AnalyticsAdminServiceClient( @@ -44228,65 +44795,135 @@ def test_create_measurement_protocol_secret_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_measurement_protocol_secret( - analytics_admin.CreateMeasurementProtocolSecretRequest(), + client.list_sk_ad_network_conversion_value_schemas( + analytics_admin.ListSKAdNetworkConversionValueSchemasRequest(), parent="parent_value", - measurement_protocol_secret=resources.MeasurementProtocolSecret( - name="name_value" - ), ) -def test_create_measurement_protocol_secret_rest_error(): +def test_list_sk_ad_network_conversion_value_schemas_rest_pager( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + ], + next_page_token="abc", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[], + next_page_token="def", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + ], + next_page_token="ghi", + ), + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + skadnetwork_conversion_value_schemas=[ + resources.SKAdNetworkConversionValueSchema(), + resources.SKAdNetworkConversionValueSchema(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListSKAdNetworkConversionValueSchemasResponse.to_json(x) + for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "properties/sample1/dataStreams/sample2"} + + pager = client.list_sk_ad_network_conversion_value_schemas( + request=sample_request + ) + + results = list(pager) + assert len(results) == 6 + assert all( + isinstance(i, resources.SKAdNetworkConversionValueSchema) for i in results + ) + + pages = list( + client.list_sk_ad_network_conversion_value_schemas( + request=sample_request + ).pages + ) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteMeasurementProtocolSecretRequest, + analytics_admin.SearchChangeHistoryEventsRequest, dict, ], ) -def test_delete_measurement_protocol_secret_rest(request_type): +def test_search_change_history_events_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" - } + request_init = {"account": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = analytics_admin.SearchChangeHistoryEventsResponse( + next_page_token="next_page_token_value", + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = analytics_admin.SearchChangeHistoryEventsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_measurement_protocol_secret(request) + response = client.search_change_history_events(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, pagers.SearchChangeHistoryEventsPager) + assert response.next_page_token == "next_page_token_value" -def test_delete_measurement_protocol_secret_rest_required_fields( - request_type=analytics_admin.DeleteMeasurementProtocolSecretRequest, +def test_search_change_history_events_rest_required_fields( + request_type=analytics_admin.SearchChangeHistoryEventsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["account"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -44301,21 +44938,21 @@ def test_delete_measurement_protocol_secret_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_measurement_protocol_secret._get_unset_required_fields(jsonified_request) + ).search_change_history_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["account"] = "account_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_measurement_protocol_secret._get_unset_required_fields(jsonified_request) + ).search_change_history_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "account" in jsonified_request + assert jsonified_request["account"] == "account_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -44324,7 +44961,7 @@ def test_delete_measurement_protocol_secret_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = analytics_admin.SearchChangeHistoryEventsResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -44336,38 +44973,42 @@ def test_delete_measurement_protocol_secret_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = analytics_admin.SearchChangeHistoryEventsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_measurement_protocol_secret(request) + response = client.search_change_history_events(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_measurement_protocol_secret_rest_unset_required_fields(): +def test_search_change_history_events_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.delete_measurement_protocol_secret._get_unset_required_fields({}) - ) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.search_change_history_events._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("account",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_measurement_protocol_secret_rest_interceptors(null_interceptor): +def test_search_change_history_events_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -44381,11 +45022,15 @@ def test_delete_measurement_protocol_secret_rest_interceptors(null_interceptor): path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "pre_delete_measurement_protocol_secret", + "post_search_change_history_events", + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, + "pre_search_change_history_events", ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteMeasurementProtocolSecretRequest.pb( - analytics_admin.DeleteMeasurementProtocolSecretRequest() + post.assert_not_called() + pb_message = analytics_admin.SearchChangeHistoryEventsRequest.pb( + analytics_admin.SearchChangeHistoryEventsRequest() ) transcode.return_value = { "method": "post", @@ -44397,15 +45042,21 @@ def test_delete_measurement_protocol_secret_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = ( + analytics_admin.SearchChangeHistoryEventsResponse.to_json( + analytics_admin.SearchChangeHistoryEventsResponse() + ) + ) - request = analytics_admin.DeleteMeasurementProtocolSecretRequest() + request = analytics_admin.SearchChangeHistoryEventsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = analytics_admin.SearchChangeHistoryEventsResponse() - client.delete_measurement_protocol_secret( + client.search_change_history_events( request, metadata=[ ("key", "val"), @@ -44414,11 +45065,12 @@ def test_delete_measurement_protocol_secret_rest_interceptors(null_interceptor): ) pre.assert_called_once() + post.assert_called_once() -def test_delete_measurement_protocol_secret_rest_bad_request( +def test_search_change_history_events_rest_bad_request( transport: str = "rest", - request_type=analytics_admin.DeleteMeasurementProtocolSecretRequest, + request_type=analytics_admin.SearchChangeHistoryEventsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -44426,9 +45078,7 @@ def test_delete_measurement_protocol_secret_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" - } + request_init = {"account": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -44440,132 +45090,127 @@ def test_delete_measurement_protocol_secret_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_measurement_protocol_secret(request) + client.search_change_history_events(request) -def test_delete_measurement_protocol_secret_rest_flattened(): +def test_search_change_history_events_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport="rest", + transport=transport, ) # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = None - - # get arguments that satisfy an http rule for this method - sample_request = { - "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" - } - - # get truthy value for each flattened field - mock_args = dict( - name="name_value", + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + ], + next_page_token="abc", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[], + next_page_token="def", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + ], + next_page_token="ghi", + ), + analytics_admin.SearchChangeHistoryEventsResponse( + change_history_events=[ + resources.ChangeHistoryEvent(), + resources.ChangeHistoryEvent(), + ], + ), ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = "" - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.delete_measurement_protocol_secret(**mock_args) + # Two responses for two calls + response = response + response - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{name=properties/*/dataStreams/*/measurementProtocolSecrets/*}" - % client.transport._host, - args[1], + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.SearchChangeHistoryEventsResponse.to_json(x) + for x in response ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + sample_request = {"account": "accounts/sample1"} -def test_delete_measurement_protocol_secret_rest_flattened_error( - transport: str = "rest", -): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_measurement_protocol_secret( - analytics_admin.DeleteMeasurementProtocolSecretRequest(), - name="name_value", - ) + pager = client.search_change_history_events(request=sample_request) + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.ChangeHistoryEvent) for i in results) -def test_delete_measurement_protocol_secret_rest_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) + pages = list(client.search_change_history_events(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateMeasurementProtocolSecretRequest, + analytics_admin.GetGoogleSignalsSettingsRequest, dict, ], ) -def test_update_measurement_protocol_secret_rest(request_type): +def test_get_google_signals_settings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "measurement_protocol_secret": { - "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" - } - } - request_init["measurement_protocol_secret"] = { - "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3", - "display_name": "display_name_value", - "secret_value": "secret_value_value", - } + request_init = {"name": "properties/sample1/googleSignalsSettings"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.MeasurementProtocolSecret( + return_value = resources.GoogleSignalsSettings( name="name_value", - display_name="display_name_value", - secret_value="secret_value_value", + state=resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED, + consent=resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleSignalsSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_measurement_protocol_secret(request) + response = client.get_google_signals_settings(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.MeasurementProtocolSecret) + assert isinstance(response, resources.GoogleSignalsSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.secret_value == "secret_value_value" + assert response.state == resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED + assert ( + response.consent + == resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED + ) -def test_update_measurement_protocol_secret_rest_required_fields( - request_type=analytics_admin.UpdateMeasurementProtocolSecretRequest, +def test_get_google_signals_settings_rest_required_fields( + request_type=analytics_admin.GetGoogleSignalsSettingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -44580,19 +45225,21 @@ def test_update_measurement_protocol_secret_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_measurement_protocol_secret._get_unset_required_fields(jsonified_request) + ).get_google_signals_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["name"] = "name_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_measurement_protocol_secret._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + ).get_google_signals_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -44601,7 +45248,7 @@ def test_update_measurement_protocol_secret_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.MeasurementProtocolSecret() + return_value = resources.GoogleSignalsSettings() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -44613,49 +45260,39 @@ def test_update_measurement_protocol_secret_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleSignalsSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_measurement_protocol_secret(request) + response = client.get_google_signals_settings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_measurement_protocol_secret_rest_unset_required_fields(): +def test_get_google_signals_settings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.update_measurement_protocol_secret._get_unset_required_fields({}) - ) - assert set(unset_fields) == ( - set(("updateMask",)) - & set( - ( - "measurementProtocolSecret", - "updateMask", - ) - ) - ) + unset_fields = transport.get_google_signals_settings._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_measurement_protocol_secret_rest_interceptors(null_interceptor): +def test_get_google_signals_settings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -44669,15 +45306,15 @@ def test_update_measurement_protocol_secret_rest_interceptors(null_interceptor): path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_update_measurement_protocol_secret", + "post_get_google_signals_settings", ) as post, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "pre_update_measurement_protocol_secret", + "pre_get_google_signals_settings", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateMeasurementProtocolSecretRequest.pb( - analytics_admin.UpdateMeasurementProtocolSecretRequest() + pb_message = analytics_admin.GetGoogleSignalsSettingsRequest.pb( + analytics_admin.GetGoogleSignalsSettingsRequest() ) transcode.return_value = { "method": "post", @@ -44689,19 +45326,19 @@ def test_update_measurement_protocol_secret_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.MeasurementProtocolSecret.to_json( - resources.MeasurementProtocolSecret() + req.return_value._content = resources.GoogleSignalsSettings.to_json( + resources.GoogleSignalsSettings() ) - request = analytics_admin.UpdateMeasurementProtocolSecretRequest() + request = analytics_admin.GetGoogleSignalsSettingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.MeasurementProtocolSecret() + post.return_value = resources.GoogleSignalsSettings() - client.update_measurement_protocol_secret( + client.get_google_signals_settings( request, metadata=[ ("key", "val"), @@ -44713,9 +45350,9 @@ def test_update_measurement_protocol_secret_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_measurement_protocol_secret_rest_bad_request( +def test_get_google_signals_settings_rest_bad_request( transport: str = "rest", - request_type=analytics_admin.UpdateMeasurementProtocolSecretRequest, + request_type=analytics_admin.GetGoogleSignalsSettingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -44723,16 +45360,7 @@ def test_update_measurement_protocol_secret_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "measurement_protocol_secret": { - "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" - } - } - request_init["measurement_protocol_secret"] = { - "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3", - "display_name": "display_name_value", - "secret_value": "secret_value_value", - } + request_init = {"name": "properties/sample1/googleSignalsSettings"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -44744,10 +45372,10 @@ def test_update_measurement_protocol_secret_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_measurement_protocol_secret(request) + client.get_google_signals_settings(request) -def test_update_measurement_protocol_secret_rest_flattened(): +def test_get_google_signals_settings_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -44756,48 +45384,40 @@ def test_update_measurement_protocol_secret_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.MeasurementProtocolSecret() + return_value = resources.GoogleSignalsSettings() # get arguments that satisfy an http rule for this method - sample_request = { - "measurement_protocol_secret": { - "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" - } - } + sample_request = {"name": "properties/sample1/googleSignalsSettings"} # get truthy value for each flattened field mock_args = dict( - measurement_protocol_secret=resources.MeasurementProtocolSecret( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleSignalsSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_measurement_protocol_secret(**mock_args) + client.get_google_signals_settings(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{measurement_protocol_secret.name=properties/*/dataStreams/*/measurementProtocolSecrets/*}" + "%s/v1alpha/{name=properties/*/googleSignalsSettings}" % client.transport._host, args[1], ) -def test_update_measurement_protocol_secret_rest_flattened_error( - transport: str = "rest", -): +def test_get_google_signals_settings_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -44806,16 +45426,13 @@ def test_update_measurement_protocol_secret_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_measurement_protocol_secret( - analytics_admin.UpdateMeasurementProtocolSecretRequest(), - measurement_protocol_secret=resources.MeasurementProtocolSecret( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.get_google_signals_settings( + analytics_admin.GetGoogleSignalsSettingsRequest(), + name="name_value", ) -def test_update_measurement_protocol_secret_rest_error(): +def test_get_google_signals_settings_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -44824,49 +45441,134 @@ def test_update_measurement_protocol_secret_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.AcknowledgeUserDataCollectionRequest, + analytics_admin.UpdateGoogleSignalsSettingsRequest, dict, ], ) -def test_acknowledge_user_data_collection_rest(request_type): +def test_update_google_signals_settings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"property": "properties/sample1"} + request_init = { + "google_signals_settings": {"name": "properties/sample1/googleSignalsSettings"} + } + request_init["google_signals_settings"] = { + "name": "properties/sample1/googleSignalsSettings", + "state": 1, + "consent": 2, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateGoogleSignalsSettingsRequest.meta.fields[ + "google_signals_settings" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "google_signals_settings" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["google_signals_settings"][field])): + del request_init["google_signals_settings"][field][i][subfield] + else: + del request_init["google_signals_settings"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.AcknowledgeUserDataCollectionResponse() + return_value = resources.GoogleSignalsSettings( + name="name_value", + state=resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED, + consent=resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED, + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.AcknowledgeUserDataCollectionResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleSignalsSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.acknowledge_user_data_collection(request) + response = client.update_google_signals_settings(request) # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.AcknowledgeUserDataCollectionResponse) + assert isinstance(response, resources.GoogleSignalsSettings) + assert response.name == "name_value" + assert response.state == resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED + assert ( + response.consent + == resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED + ) -def test_acknowledge_user_data_collection_rest_required_fields( - request_type=analytics_admin.AcknowledgeUserDataCollectionRequest, +def test_update_google_signals_settings_rest_required_fields( + request_type=analytics_admin.UpdateGoogleSignalsSettingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["property"] = "" - request_init["acknowledgement"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -44881,24 +45583,19 @@ def test_acknowledge_user_data_collection_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).acknowledge_user_data_collection._get_unset_required_fields(jsonified_request) + ).update_google_signals_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["property"] = "property_value" - jsonified_request["acknowledgement"] = "acknowledgement_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).acknowledge_user_data_collection._get_unset_required_fields(jsonified_request) + ).update_google_signals_settings._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "property" in jsonified_request - assert jsonified_request["property"] == "property_value" - assert "acknowledgement" in jsonified_request - assert jsonified_request["acknowledgement"] == "acknowledgement_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -44907,7 +45604,7 @@ def test_acknowledge_user_data_collection_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.AcknowledgeUserDataCollectionResponse() + return_value = resources.GoogleSignalsSettings() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -44919,7 +45616,7 @@ def test_acknowledge_user_data_collection_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "patch", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -44928,42 +45625,41 @@ def test_acknowledge_user_data_collection_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.AcknowledgeUserDataCollectionResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleSignalsSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.acknowledge_user_data_collection(request) + response = client.update_google_signals_settings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_acknowledge_user_data_collection_rest_unset_required_fields(): +def test_update_google_signals_settings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.acknowledge_user_data_collection._get_unset_required_fields({}) + unset_fields = transport.update_google_signals_settings._get_unset_required_fields( + {} ) assert set(unset_fields) == ( - set(()) + set(("updateMask",)) & set( ( - "property", - "acknowledgement", + "googleSignalsSettings", + "updateMask", ) ) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_acknowledge_user_data_collection_rest_interceptors(null_interceptor): +def test_update_google_signals_settings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -44977,15 +45673,15 @@ def test_acknowledge_user_data_collection_rest_interceptors(null_interceptor): path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_acknowledge_user_data_collection", + "post_update_google_signals_settings", ) as post, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "pre_acknowledge_user_data_collection", + "pre_update_google_signals_settings", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.AcknowledgeUserDataCollectionRequest.pb( - analytics_admin.AcknowledgeUserDataCollectionRequest() + pb_message = analytics_admin.UpdateGoogleSignalsSettingsRequest.pb( + analytics_admin.UpdateGoogleSignalsSettingsRequest() ) transcode.return_value = { "method": "post", @@ -44997,21 +45693,19 @@ def test_acknowledge_user_data_collection_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.AcknowledgeUserDataCollectionResponse.to_json( - analytics_admin.AcknowledgeUserDataCollectionResponse() - ) + req.return_value._content = resources.GoogleSignalsSettings.to_json( + resources.GoogleSignalsSettings() ) - request = analytics_admin.AcknowledgeUserDataCollectionRequest() + request = analytics_admin.UpdateGoogleSignalsSettingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.AcknowledgeUserDataCollectionResponse() + post.return_value = resources.GoogleSignalsSettings() - client.acknowledge_user_data_collection( + client.update_google_signals_settings( request, metadata=[ ("key", "val"), @@ -45023,9 +45717,9 @@ def test_acknowledge_user_data_collection_rest_interceptors(null_interceptor): post.assert_called_once() -def test_acknowledge_user_data_collection_rest_bad_request( +def test_update_google_signals_settings_rest_bad_request( transport: str = "rest", - request_type=analytics_admin.AcknowledgeUserDataCollectionRequest, + request_type=analytics_admin.UpdateGoogleSignalsSettingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -45033,7 +45727,9 @@ def test_acknowledge_user_data_collection_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"property": "properties/sample1"} + request_init = { + "google_signals_settings": {"name": "properties/sample1/googleSignalsSettings"} + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -45045,10 +45741,73 @@ def test_acknowledge_user_data_collection_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.acknowledge_user_data_collection(request) + client.update_google_signals_settings(request) -def test_acknowledge_user_data_collection_rest_error(): +def test_update_google_signals_settings_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resources.GoogleSignalsSettings() + + # get arguments that satisfy an http rule for this method + sample_request = { + "google_signals_settings": { + "name": "properties/sample1/googleSignalsSettings" + } + } + + # get truthy value for each flattened field + mock_args = dict( + google_signals_settings=resources.GoogleSignalsSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = resources.GoogleSignalsSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.update_google_signals_settings(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{google_signals_settings.name=properties/*/googleSignalsSettings}" + % client.transport._host, + args[1], + ) + + +def test_update_google_signals_settings_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_google_signals_settings( + analytics_admin.UpdateGoogleSignalsSettingsRequest(), + google_signals_settings=resources.GoogleSignalsSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +def test_update_google_signals_settings_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -45057,53 +45816,138 @@ def test_acknowledge_user_data_collection_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, + analytics_admin.CreateConversionEventRequest, dict, ], ) -def test_get_sk_ad_network_conversion_value_schema_rest(request_type): +def test_create_conversion_event_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" + request_init = {"parent": "properties/sample1"} + request_init["conversion_event"] = { + "name": "name_value", + "event_name": "event_name_value", + "create_time": {"seconds": 751, "nanos": 543}, + "deletable": True, + "custom": True, + "counting_method": 1, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateConversionEventRequest.meta.fields[ + "conversion_event" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["conversion_event"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["conversion_event"][field])): + del request_init["conversion_event"][field][i][subfield] + else: + del request_init["conversion_event"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.SKAdNetworkConversionValueSchema( + return_value = resources.ConversionEvent( name="name_value", - apply_conversion_values=True, + event_name="event_name_value", + deletable=True, + custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_sk_ad_network_conversion_value_schema(request) + response = client.create_conversion_event(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.SKAdNetworkConversionValueSchema) + assert isinstance(response, resources.ConversionEvent) assert response.name == "name_value" - assert response.apply_conversion_values is True + assert response.event_name == "event_name_value" + assert response.deletable is True + assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) -def test_get_sk_ad_network_conversion_value_schema_rest_required_fields( - request_type=analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, +def test_create_conversion_event_rest_required_fields( + request_type=analytics_admin.CreateConversionEventRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -45118,25 +45962,21 @@ def test_get_sk_ad_network_conversion_value_schema_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_sk_ad_network_conversion_value_schema._get_unset_required_fields( - jsonified_request - ) + ).create_conversion_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_sk_ad_network_conversion_value_schema._get_unset_required_fields( - jsonified_request - ) + ).create_conversion_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -45145,7 +45985,7 @@ def test_get_sk_ad_network_conversion_value_schema_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.SKAdNetworkConversionValueSchema() + return_value = resources.ConversionEvent() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -45157,44 +45997,48 @@ def test_get_sk_ad_network_conversion_value_schema_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SKAdNetworkConversionValueSchema.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_sk_ad_network_conversion_value_schema(request) + response = client.create_conversion_event(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_sk_ad_network_conversion_value_schema_rest_unset_required_fields(): +def test_create_conversion_event_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.get_sk_ad_network_conversion_value_schema._get_unset_required_fields( - {} + unset_fields = transport.create_conversion_event._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "conversionEvent", + "parent", + ) ) ) - assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_sk_ad_network_conversion_value_schema_rest_interceptors(null_interceptor): +def test_create_conversion_event_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -45207,16 +46051,14 @@ def test_get_sk_ad_network_conversion_value_schema_rest_interceptors(null_interc ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_get_sk_ad_network_conversion_value_schema", + transports.AnalyticsAdminServiceRestInterceptor, "post_create_conversion_event" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_get_sk_ad_network_conversion_value_schema", + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_conversion_event" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest.pb( - analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() + pb_message = analytics_admin.CreateConversionEventRequest.pb( + analytics_admin.CreateConversionEventRequest() ) transcode.return_value = { "method": "post", @@ -45228,19 +46070,19 @@ def test_get_sk_ad_network_conversion_value_schema_rest_interceptors(null_interc req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.SKAdNetworkConversionValueSchema.to_json( - resources.SKAdNetworkConversionValueSchema() + req.return_value._content = resources.ConversionEvent.to_json( + resources.ConversionEvent() ) - request = analytics_admin.GetSKAdNetworkConversionValueSchemaRequest() + request = analytics_admin.CreateConversionEventRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.SKAdNetworkConversionValueSchema() + post.return_value = resources.ConversionEvent() - client.get_sk_ad_network_conversion_value_schema( + client.create_conversion_event( request, metadata=[ ("key", "val"), @@ -45252,9 +46094,8 @@ def test_get_sk_ad_network_conversion_value_schema_rest_interceptors(null_interc post.assert_called_once() -def test_get_sk_ad_network_conversion_value_schema_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.GetSKAdNetworkConversionValueSchemaRequest, +def test_create_conversion_event_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateConversionEventRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -45262,9 +46103,7 @@ def test_get_sk_ad_network_conversion_value_schema_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -45276,10 +46115,10 @@ def test_get_sk_ad_network_conversion_value_schema_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_sk_ad_network_conversion_value_schema(request) + client.create_conversion_event(request) -def test_get_sk_ad_network_conversion_value_schema_rest_flattened(): +def test_create_conversion_event_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -45288,43 +46127,41 @@ def test_get_sk_ad_network_conversion_value_schema_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.SKAdNetworkConversionValueSchema() + return_value = resources.ConversionEvent() # get arguments that satisfy an http rule for this method - sample_request = { - "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" - } + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", + conversion_event=resources.ConversionEvent(name="name_value"), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_sk_ad_network_conversion_value_schema(**mock_args) + client.create_conversion_event(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/dataStreams/*/sKAdNetworkConversionValueSchema/*}" + "%s/v1alpha/{parent=properties/*}/conversionEvents" % client.transport._host, args[1], ) -def test_get_sk_ad_network_conversion_value_schema_rest_flattened_error( - transport: str = "rest", -): +def test_create_conversion_event_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -45333,13 +46170,14 @@ def test_get_sk_ad_network_conversion_value_schema_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_sk_ad_network_conversion_value_schema( - analytics_admin.GetSKAdNetworkConversionValueSchemaRequest(), - name="name_value", + client.create_conversion_event( + analytics_admin.CreateConversionEventRequest(), + parent="parent_value", + conversion_event=resources.ConversionEvent(name="name_value"), ) -def test_get_sk_ad_network_conversion_value_schema_rest_error(): +def test_create_conversion_event_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -45348,77 +46186,139 @@ def test_get_sk_ad_network_conversion_value_schema_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, + analytics_admin.UpdateConversionEventRequest, dict, ], ) -def test_create_sk_ad_network_conversion_value_schema_rest(request_type): +def test_update_conversion_event_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1/dataStreams/sample2"} - request_init["skadnetwork_conversion_value_schema"] = { - "name": "name_value", - "postback_window_one": { - "conversion_values": [ - { - "display_name": "display_name_value", - "fine_value": 1054, - "coarse_value": 1, - "event_mappings": [ + request_init = { + "conversion_event": {"name": "properties/sample1/conversionEvents/sample2"} + } + request_init["conversion_event"] = { + "name": "properties/sample1/conversionEvents/sample2", + "event_name": "event_name_value", + "create_time": {"seconds": 751, "nanos": 543}, + "deletable": True, + "custom": True, + "counting_method": 1, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateConversionEventRequest.meta.fields[ + "conversion_event" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["conversion_event"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( { - "event_name": "event_name_value", - "min_event_count": 1613, - "max_event_count": 1615, - "min_event_value": 0.16010000000000002, - "max_event_value": 0.1603, + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, } - ], - "lock_enabled": True, - } - ], - "postback_window_settings_enabled": True, - }, - "postback_window_two": {}, - "postback_window_three": {}, - "apply_conversion_values": True, - } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["conversion_event"][field])): + del request_init["conversion_event"][field][i][subfield] + else: + del request_init["conversion_event"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.SKAdNetworkConversionValueSchema( + return_value = resources.ConversionEvent( name="name_value", - apply_conversion_values=True, + event_name="event_name_value", + deletable=True, + custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_sk_ad_network_conversion_value_schema(request) + response = client.update_conversion_event(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.SKAdNetworkConversionValueSchema) + assert isinstance(response, resources.ConversionEvent) assert response.name == "name_value" - assert response.apply_conversion_values is True + assert response.event_name == "event_name_value" + assert response.deletable is True + assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) -def test_create_sk_ad_network_conversion_value_schema_rest_required_fields( - request_type=analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, +def test_update_conversion_event_rest_required_fields( + request_type=analytics_admin.UpdateConversionEventRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -45433,25 +46333,19 @@ def test_create_sk_ad_network_conversion_value_schema_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_sk_ad_network_conversion_value_schema._get_unset_required_fields( - jsonified_request - ) + ).update_conversion_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_sk_ad_network_conversion_value_schema._get_unset_required_fields( - jsonified_request - ) + ).update_conversion_event._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -45460,7 +46354,7 @@ def test_create_sk_ad_network_conversion_value_schema_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.SKAdNetworkConversionValueSchema() + return_value = resources.ConversionEvent() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -45472,7 +46366,7 @@ def test_create_sk_ad_network_conversion_value_schema_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "patch", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -45481,44 +46375,39 @@ def test_create_sk_ad_network_conversion_value_schema_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SKAdNetworkConversionValueSchema.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_sk_ad_network_conversion_value_schema(request) + response = client.update_conversion_event(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_sk_ad_network_conversion_value_schema_rest_unset_required_fields(): +def test_update_conversion_event_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_sk_ad_network_conversion_value_schema._get_unset_required_fields( - {} - ) + unset_fields = transport.update_conversion_event._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) + set(("updateMask",)) & set( ( - "parent", - "skadnetworkConversionValueSchema", + "conversionEvent", + "updateMask", ) ) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_sk_ad_network_conversion_value_schema_rest_interceptors( - null_interceptor, -): +def test_update_conversion_event_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -45531,16 +46420,14 @@ def test_create_sk_ad_network_conversion_value_schema_rest_interceptors( ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_create_sk_ad_network_conversion_value_schema", + transports.AnalyticsAdminServiceRestInterceptor, "post_update_conversion_event" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_create_sk_ad_network_conversion_value_schema", + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_conversion_event" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest.pb( - analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() + pb_message = analytics_admin.UpdateConversionEventRequest.pb( + analytics_admin.UpdateConversionEventRequest() ) transcode.return_value = { "method": "post", @@ -45552,19 +46439,19 @@ def test_create_sk_ad_network_conversion_value_schema_rest_interceptors( req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.SKAdNetworkConversionValueSchema.to_json( - resources.SKAdNetworkConversionValueSchema() + req.return_value._content = resources.ConversionEvent.to_json( + resources.ConversionEvent() ) - request = analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest() + request = analytics_admin.UpdateConversionEventRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.SKAdNetworkConversionValueSchema() + post.return_value = resources.ConversionEvent() - client.create_sk_ad_network_conversion_value_schema( + client.update_conversion_event( request, metadata=[ ("key", "val"), @@ -45576,9 +46463,8 @@ def test_create_sk_ad_network_conversion_value_schema_rest_interceptors( post.assert_called_once() -def test_create_sk_ad_network_conversion_value_schema_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest, +def test_update_conversion_event_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateConversionEventRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -45586,32 +46472,8 @@ def test_create_sk_ad_network_conversion_value_schema_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1/dataStreams/sample2"} - request_init["skadnetwork_conversion_value_schema"] = { - "name": "name_value", - "postback_window_one": { - "conversion_values": [ - { - "display_name": "display_name_value", - "fine_value": 1054, - "coarse_value": 1, - "event_mappings": [ - { - "event_name": "event_name_value", - "min_event_count": 1613, - "max_event_count": 1615, - "min_event_value": 0.16010000000000002, - "max_event_value": 0.1603, - } - ], - "lock_enabled": True, - } - ], - "postback_window_settings_enabled": True, - }, - "postback_window_two": {}, - "postback_window_three": {}, - "apply_conversion_values": True, + request_init = { + "conversion_event": {"name": "properties/sample1/conversionEvents/sample2"} } request = request_type(**request_init) @@ -45624,10 +46486,10 @@ def test_create_sk_ad_network_conversion_value_schema_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_sk_ad_network_conversion_value_schema(request) + client.update_conversion_event(request) -def test_create_sk_ad_network_conversion_value_schema_rest_flattened(): +def test_update_conversion_event_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -45636,44 +46498,43 @@ def test_create_sk_ad_network_conversion_value_schema_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.SKAdNetworkConversionValueSchema() + return_value = resources.ConversionEvent() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1/dataStreams/sample2"} + sample_request = { + "conversion_event": {"name": "properties/sample1/conversionEvents/sample2"} + } # get truthy value for each flattened field mock_args = dict( - parent="parent_value", - skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( - name="name_value" - ), + conversion_event=resources.ConversionEvent(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_sk_ad_network_conversion_value_schema(**mock_args) + client.update_conversion_event(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*/dataStreams/*}/sKAdNetworkConversionValueSchema" + "%s/v1alpha/{conversion_event.name=properties/*/conversionEvents/*}" % client.transport._host, args[1], ) -def test_create_sk_ad_network_conversion_value_schema_rest_flattened_error( - transport: str = "rest", -): +def test_update_conversion_event_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -45682,16 +46543,14 @@ def test_create_sk_ad_network_conversion_value_schema_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_sk_ad_network_conversion_value_schema( - analytics_admin.CreateSKAdNetworkConversionValueSchemaRequest(), - parent="parent_value", - skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( - name="name_value" - ), + client.update_conversion_event( + analytics_admin.UpdateConversionEventRequest(), + conversion_event=resources.ConversionEvent(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_create_sk_ad_network_conversion_value_schema_rest_error(): +def test_update_conversion_event_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -45700,42 +46559,56 @@ def test_create_sk_ad_network_conversion_value_schema_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, + analytics_admin.GetConversionEventRequest, dict, ], ) -def test_delete_sk_ad_network_conversion_value_schema_rest(request_type): +def test_get_conversion_event_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" - } + request_init = {"name": "properties/sample1/conversionEvents/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.ConversionEvent( + name="name_value", + event_name="event_name_value", + deletable=True, + custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_sk_ad_network_conversion_value_schema(request) + response = client.get_conversion_event(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.ConversionEvent) + assert response.name == "name_value" + assert response.event_name == "event_name_value" + assert response.deletable is True + assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) -def test_delete_sk_ad_network_conversion_value_schema_rest_required_fields( - request_type=analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, +def test_get_conversion_event_rest_required_fields( + request_type=analytics_admin.GetConversionEventRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -45755,9 +46628,7 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_sk_ad_network_conversion_value_schema._get_unset_required_fields( - jsonified_request - ) + ).get_conversion_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -45766,9 +46637,7 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_sk_ad_network_conversion_value_schema._get_unset_required_fields( - jsonified_request - ) + ).get_conversion_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -45782,7 +46651,7 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.ConversionEvent() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -45794,40 +46663,39 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "get", "query_params": pb_request, } transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_sk_ad_network_conversion_value_schema(request) + response = client.get_conversion_event(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_sk_ad_network_conversion_value_schema_rest_unset_required_fields(): +def test_get_conversion_event_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_sk_ad_network_conversion_value_schema._get_unset_required_fields( - {} - ) + unset_fields = transport.get_conversion_event._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_sk_ad_network_conversion_value_schema_rest_interceptors( - null_interceptor, -): +def test_get_conversion_event_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -45840,12 +46708,14 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_interceptors( ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_delete_sk_ad_network_conversion_value_schema", + transports.AnalyticsAdminServiceRestInterceptor, "post_get_conversion_event" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_conversion_event" ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest.pb( - analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() + post.assert_not_called() + pb_message = analytics_admin.GetConversionEventRequest.pb( + analytics_admin.GetConversionEventRequest() ) transcode.return_value = { "method": "post", @@ -45857,15 +46727,19 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_interceptors( req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = resources.ConversionEvent.to_json( + resources.ConversionEvent() + ) - request = analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest() + request = analytics_admin.GetConversionEventRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = resources.ConversionEvent() - client.delete_sk_ad_network_conversion_value_schema( + client.get_conversion_event( request, metadata=[ ("key", "val"), @@ -45874,11 +46748,11 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_interceptors( ) pre.assert_called_once() + post.assert_called_once() -def test_delete_sk_ad_network_conversion_value_schema_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest, +def test_get_conversion_event_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetConversionEventRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -45886,9 +46760,7 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" - } + request_init = {"name": "properties/sample1/conversionEvents/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -45900,10 +46772,10 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_sk_ad_network_conversion_value_schema(request) + client.get_conversion_event(request) -def test_delete_sk_ad_network_conversion_value_schema_rest_flattened(): +def test_get_conversion_event_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -45912,12 +46784,10 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.ConversionEvent() # get arguments that satisfy an http rule for this method - sample_request = { - "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" - } + sample_request = {"name": "properties/sample1/conversionEvents/sample2"} # get truthy value for each flattened field mock_args = dict( @@ -45928,26 +46798,26 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.delete_sk_ad_network_conversion_value_schema(**mock_args) + client.get_conversion_event(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/dataStreams/*/sKAdNetworkConversionValueSchema/*}" + "%s/v1alpha/{name=properties/*/conversionEvents/*}" % client.transport._host, args[1], ) -def test_delete_sk_ad_network_conversion_value_schema_rest_flattened_error( - transport: str = "rest", -): +def test_get_conversion_event_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -45956,13 +46826,13 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_sk_ad_network_conversion_value_schema( - analytics_admin.DeleteSKAdNetworkConversionValueSchemaRequest(), + client.get_conversion_event( + analytics_admin.GetConversionEventRequest(), name="name_value", ) -def test_delete_sk_ad_network_conversion_value_schema_rest_error(): +def test_get_conversion_event_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -45971,80 +46841,45 @@ def test_delete_sk_ad_network_conversion_value_schema_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, + analytics_admin.DeleteConversionEventRequest, dict, ], ) -def test_update_sk_ad_network_conversion_value_schema_rest(request_type): +def test_delete_conversion_event_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "skadnetwork_conversion_value_schema": { - "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" - } - } - request_init["skadnetwork_conversion_value_schema"] = { - "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3", - "postback_window_one": { - "conversion_values": [ - { - "display_name": "display_name_value", - "fine_value": 1054, - "coarse_value": 1, - "event_mappings": [ - { - "event_name": "event_name_value", - "min_event_count": 1613, - "max_event_count": 1615, - "min_event_value": 0.16010000000000002, - "max_event_value": 0.1603, - } - ], - "lock_enabled": True, - } - ], - "postback_window_settings_enabled": True, - }, - "postback_window_two": {}, - "postback_window_three": {}, - "apply_conversion_values": True, - } + request_init = {"name": "properties/sample1/conversionEvents/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.SKAdNetworkConversionValueSchema( - name="name_value", - apply_conversion_values=True, - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_sk_ad_network_conversion_value_schema(request) + response = client.delete_conversion_event(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.SKAdNetworkConversionValueSchema) - assert response.name == "name_value" - assert response.apply_conversion_values is True + assert response is None -def test_update_sk_ad_network_conversion_value_schema_rest_required_fields( - request_type=analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, +def test_delete_conversion_event_rest_required_fields( + request_type=analytics_admin.DeleteConversionEventRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -46059,23 +46894,21 @@ def test_update_sk_ad_network_conversion_value_schema_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_sk_ad_network_conversion_value_schema._get_unset_required_fields( - jsonified_request - ) + ).delete_conversion_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["name"] = "name_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_sk_ad_network_conversion_value_schema._get_unset_required_fields( - jsonified_request - ) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + ).delete_conversion_event._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -46084,7 +46917,7 @@ def test_update_sk_ad_network_conversion_value_schema_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.SKAdNetworkConversionValueSchema() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -46096,53 +46929,36 @@ def test_update_sk_ad_network_conversion_value_schema_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "delete", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = resources.SKAdNetworkConversionValueSchema.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_sk_ad_network_conversion_value_schema(request) + response = client.delete_conversion_event(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_sk_ad_network_conversion_value_schema_rest_unset_required_fields(): +def test_delete_conversion_event_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_sk_ad_network_conversion_value_schema._get_unset_required_fields( - {} - ) - assert set(unset_fields) == ( - set(("updateMask",)) - & set( - ( - "skadnetworkConversionValueSchema", - "updateMask", - ) - ) - ) + unset_fields = transport.delete_conversion_event._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_sk_ad_network_conversion_value_schema_rest_interceptors( - null_interceptor, -): +def test_delete_conversion_event_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -46155,16 +46971,11 @@ def test_update_sk_ad_network_conversion_value_schema_rest_interceptors( ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_update_sk_ad_network_conversion_value_schema", - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_update_sk_ad_network_conversion_value_schema", + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_conversion_event" ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest.pb( - analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() + pb_message = analytics_admin.DeleteConversionEventRequest.pb( + analytics_admin.DeleteConversionEventRequest() ) transcode.return_value = { "method": "post", @@ -46176,19 +46987,15 @@ def test_update_sk_ad_network_conversion_value_schema_rest_interceptors( req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.SKAdNetworkConversionValueSchema.to_json( - resources.SKAdNetworkConversionValueSchema() - ) - request = analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest() + request = analytics_admin.DeleteConversionEventRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.SKAdNetworkConversionValueSchema() - client.update_sk_ad_network_conversion_value_schema( + client.delete_conversion_event( request, metadata=[ ("key", "val"), @@ -46197,12 +47004,10 @@ def test_update_sk_ad_network_conversion_value_schema_rest_interceptors( ) pre.assert_called_once() - post.assert_called_once() -def test_update_sk_ad_network_conversion_value_schema_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest, +def test_delete_conversion_event_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeleteConversionEventRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -46210,37 +47015,7 @@ def test_update_sk_ad_network_conversion_value_schema_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "skadnetwork_conversion_value_schema": { - "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" - } - } - request_init["skadnetwork_conversion_value_schema"] = { - "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3", - "postback_window_one": { - "conversion_values": [ - { - "display_name": "display_name_value", - "fine_value": 1054, - "coarse_value": 1, - "event_mappings": [ - { - "event_name": "event_name_value", - "min_event_count": 1613, - "max_event_count": 1615, - "min_event_value": 0.16010000000000002, - "max_event_value": 0.1603, - } - ], - "lock_enabled": True, - } - ], - "postback_window_settings_enabled": True, - }, - "postback_window_two": {}, - "postback_window_three": {}, - "apply_conversion_values": True, - } + request_init = {"name": "properties/sample1/conversionEvents/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -46252,10 +47027,10 @@ def test_update_sk_ad_network_conversion_value_schema_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_sk_ad_network_conversion_value_schema(request) + client.delete_conversion_event(request) -def test_update_sk_ad_network_conversion_value_schema_rest_flattened(): +def test_delete_conversion_event_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -46264,48 +47039,38 @@ def test_update_sk_ad_network_conversion_value_schema_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.SKAdNetworkConversionValueSchema() + return_value = None # get arguments that satisfy an http rule for this method - sample_request = { - "skadnetwork_conversion_value_schema": { - "name": "properties/sample1/dataStreams/sample2/sKAdNetworkConversionValueSchema/sample3" - } - } + sample_request = {"name": "properties/sample1/conversionEvents/sample2"} # get truthy value for each flattened field mock_args = dict( - skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SKAdNetworkConversionValueSchema.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_sk_ad_network_conversion_value_schema(**mock_args) + client.delete_conversion_event(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{skadnetwork_conversion_value_schema.name=properties/*/dataStreams/*/sKAdNetworkConversionValueSchema/*}" + "%s/v1alpha/{name=properties/*/conversionEvents/*}" % client.transport._host, args[1], ) -def test_update_sk_ad_network_conversion_value_schema_rest_flattened_error( - transport: str = "rest", -): +def test_delete_conversion_event_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -46314,16 +47079,13 @@ def test_update_sk_ad_network_conversion_value_schema_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_sk_ad_network_conversion_value_schema( - analytics_admin.UpdateSKAdNetworkConversionValueSchemaRequest(), - skadnetwork_conversion_value_schema=resources.SKAdNetworkConversionValueSchema( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.delete_conversion_event( + analytics_admin.DeleteConversionEventRequest(), + name="name_value", ) -def test_update_sk_ad_network_conversion_value_schema_rest_error(): +def test_delete_conversion_event_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -46332,48 +47094,45 @@ def test_update_sk_ad_network_conversion_value_schema_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, + analytics_admin.ListConversionEventsRequest, dict, ], ) -def test_list_sk_ad_network_conversion_value_schemas_rest(request_type): +def test_list_conversion_events_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1/dataStreams/sample2"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( + return_value = analytics_admin.ListConversionEventsResponse( next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse.pb( - return_value - ) - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListConversionEventsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_sk_ad_network_conversion_value_schemas(request) + response = client.list_conversion_events(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListSKAdNetworkConversionValueSchemasPager) + assert isinstance(response, pagers.ListConversionEventsPager) assert response.next_page_token == "next_page_token_value" -def test_list_sk_ad_network_conversion_value_schemas_rest_required_fields( - request_type=analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, +def test_list_conversion_events_rest_required_fields( + request_type=analytics_admin.ListConversionEventsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -46393,9 +47152,7 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_sk_ad_network_conversion_value_schemas._get_unset_required_fields( - jsonified_request - ) + ).list_conversion_events._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -46404,9 +47161,7 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_sk_ad_network_conversion_value_schemas._get_unset_required_fields( - jsonified_request - ) + ).list_conversion_events._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( ( @@ -46427,7 +47182,7 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() + return_value = analytics_admin.ListConversionEventsResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -46447,31 +47202,26 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse.pb( - return_value - ) - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListConversionEventsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_sk_ad_network_conversion_value_schemas(request) + response = client.list_conversion_events(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_sk_ad_network_conversion_value_schemas_rest_unset_required_fields(): +def test_list_conversion_events_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_sk_ad_network_conversion_value_schemas._get_unset_required_fields( - {} - ) + unset_fields = transport.list_conversion_events._get_unset_required_fields({}) assert set(unset_fields) == ( set( ( @@ -46484,9 +47234,7 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_unset_required_fields( @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_sk_ad_network_conversion_value_schemas_rest_interceptors( - null_interceptor, -): +def test_list_conversion_events_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -46499,16 +47247,14 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_interceptors( ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_list_sk_ad_network_conversion_value_schemas", + transports.AnalyticsAdminServiceRestInterceptor, "post_list_conversion_events" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_list_sk_ad_network_conversion_value_schemas", + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_conversion_events" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest.pb( - analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() + pb_message = analytics_admin.ListConversionEventsRequest.pb( + analytics_admin.ListConversionEventsRequest() ) transcode.return_value = { "method": "post", @@ -46521,22 +47267,20 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_interceptors( req.return_value.status_code = 200 req.return_value.request = PreparedRequest() req.return_value._content = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse.to_json( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() + analytics_admin.ListConversionEventsResponse.to_json( + analytics_admin.ListConversionEventsResponse() ) ) - request = analytics_admin.ListSKAdNetworkConversionValueSchemasRequest() + request = analytics_admin.ListConversionEventsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() - ) + post.return_value = analytics_admin.ListConversionEventsResponse() - client.list_sk_ad_network_conversion_value_schemas( + client.list_conversion_events( request, metadata=[ ("key", "val"), @@ -46548,9 +47292,8 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_interceptors( post.assert_called_once() -def test_list_sk_ad_network_conversion_value_schemas_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.ListSKAdNetworkConversionValueSchemasRequest, +def test_list_conversion_events_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListConversionEventsRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -46558,7 +47301,7 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1/dataStreams/sample2"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -46570,10 +47313,10 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_sk_ad_network_conversion_value_schemas(request) + client.list_conversion_events(request) -def test_list_sk_ad_network_conversion_value_schemas_rest_flattened(): +def test_list_conversion_events_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -46582,10 +47325,10 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListSKAdNetworkConversionValueSchemasResponse() + return_value = analytics_admin.ListConversionEventsResponse() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1/dataStreams/sample2"} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( @@ -46596,31 +47339,26 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse.pb( - return_value - ) - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListConversionEventsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_sk_ad_network_conversion_value_schemas(**mock_args) + client.list_conversion_events(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*/dataStreams/*}/sKAdNetworkConversionValueSchema" + "%s/v1alpha/{parent=properties/*}/conversionEvents" % client.transport._host, args[1], ) -def test_list_sk_ad_network_conversion_value_schemas_rest_flattened_error( - transport: str = "rest", -): +def test_list_conversion_events_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -46629,15 +47367,13 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_sk_ad_network_conversion_value_schemas( - analytics_admin.ListSKAdNetworkConversionValueSchemasRequest(), + client.list_conversion_events( + analytics_admin.ListConversionEventsRequest(), parent="parent_value", ) -def test_list_sk_ad_network_conversion_value_schemas_rest_pager( - transport: str = "rest", -): +def test_list_conversion_events_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -46649,28 +47385,28 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_pager( # with mock.patch.object(path_template, 'transcode') as transcode: # Set the response as a series of pages response = ( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), + resources.ConversionEvent(), + resources.ConversionEvent(), ], next_page_token="abc", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[], + analytics_admin.ListConversionEventsResponse( + conversion_events=[], next_page_token="def", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), ], next_page_token="ghi", ), - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse( - skadnetwork_conversion_value_schemas=[ - resources.SKAdNetworkConversionValueSchema(), - resources.SKAdNetworkConversionValueSchema(), + analytics_admin.ListConversionEventsResponse( + conversion_events=[ + resources.ConversionEvent(), + resources.ConversionEvent(), ], ), ) @@ -46679,8 +47415,7 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_pager( # Wrap the values into proper Response objs response = tuple( - analytics_admin.ListSKAdNetworkConversionValueSchemasResponse.to_json(x) - for x in response + analytics_admin.ListConversionEventsResponse.to_json(x) for x in response ) return_values = tuple(Response() for i in response) for return_val, response_val in zip(return_values, response): @@ -46688,23 +47423,15 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_pager( return_val.status_code = 200 req.side_effect = return_values - sample_request = {"parent": "properties/sample1/dataStreams/sample2"} + sample_request = {"parent": "properties/sample1"} - pager = client.list_sk_ad_network_conversion_value_schemas( - request=sample_request - ) + pager = client.list_conversion_events(request=sample_request) results = list(pager) assert len(results) == 6 - assert all( - isinstance(i, resources.SKAdNetworkConversionValueSchema) for i in results - ) + assert all(isinstance(i, resources.ConversionEvent) for i in results) - pages = list( - client.list_sk_ad_network_conversion_value_schemas( - request=sample_request - ).pages - ) + pages = list(client.list_conversion_events(request=sample_request).pages) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -46712,51 +47439,54 @@ def test_list_sk_ad_network_conversion_value_schemas_rest_pager( @pytest.mark.parametrize( "request_type", [ - analytics_admin.SearchChangeHistoryEventsRequest, + analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, dict, ], ) -def test_search_change_history_events_rest(request_type): +def test_get_display_video360_advertiser_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"account": "accounts/sample1"} + request_init = {"name": "properties/sample1/displayVideo360AdvertiserLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.SearchChangeHistoryEventsResponse( - next_page_token="next_page_token_value", + return_value = resources.DisplayVideo360AdvertiserLink( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.SearchChangeHistoryEventsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.search_change_history_events(request) + response = client.get_display_video360_advertiser_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.SearchChangeHistoryEventsPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_search_change_history_events_rest_required_fields( - request_type=analytics_admin.SearchChangeHistoryEventsRequest, +def test_get_display_video360_advertiser_link_rest_required_fields( + request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["account"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -46771,21 +47501,21 @@ def test_search_change_history_events_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).search_change_history_events._get_unset_required_fields(jsonified_request) + ).get_display_video360_advertiser_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["account"] = "account_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).search_change_history_events._get_unset_required_fields(jsonified_request) + ).get_display_video360_advertiser_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "account" in jsonified_request - assert jsonified_request["account"] == "account_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -46794,7 +47524,7 @@ def test_search_change_history_events_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.SearchChangeHistoryEventsResponse() + return_value = resources.DisplayVideo360AdvertiserLink() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -46806,41 +47536,41 @@ def test_search_change_history_events_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.SearchChangeHistoryEventsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.search_change_history_events(request) + response = client.get_display_video360_advertiser_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_search_change_history_events_rest_unset_required_fields(): +def test_get_display_video360_advertiser_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.search_change_history_events._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("account",))) + unset_fields = ( + transport.get_display_video360_advertiser_link._get_unset_required_fields({}) + ) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_search_change_history_events_rest_interceptors(null_interceptor): +def test_get_display_video360_advertiser_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -46854,15 +47584,15 @@ def test_search_change_history_events_rest_interceptors(null_interceptor): path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_search_change_history_events", + "post_get_display_video360_advertiser_link", ) as post, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "pre_search_change_history_events", + "pre_get_display_video360_advertiser_link", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.SearchChangeHistoryEventsRequest.pb( - analytics_admin.SearchChangeHistoryEventsRequest() + pb_message = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest.pb( + analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() ) transcode.return_value = { "method": "post", @@ -46874,21 +47604,19 @@ def test_search_change_history_events_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.SearchChangeHistoryEventsResponse.to_json( - analytics_admin.SearchChangeHistoryEventsResponse() - ) + req.return_value._content = resources.DisplayVideo360AdvertiserLink.to_json( + resources.DisplayVideo360AdvertiserLink() ) - request = analytics_admin.SearchChangeHistoryEventsRequest() + request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.SearchChangeHistoryEventsResponse() + post.return_value = resources.DisplayVideo360AdvertiserLink() - client.search_change_history_events( + client.get_display_video360_advertiser_link( request, metadata=[ ("key", "val"), @@ -46900,9 +47628,9 @@ def test_search_change_history_events_rest_interceptors(null_interceptor): post.assert_called_once() -def test_search_change_history_events_rest_bad_request( +def test_get_display_video360_advertiser_link_rest_bad_request( transport: str = "rest", - request_type=analytics_admin.SearchChangeHistoryEventsRequest, + request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -46910,7 +47638,7 @@ def test_search_change_history_events_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"account": "accounts/sample1"} + request_init = {"name": "properties/sample1/displayVideo360AdvertiserLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -46922,126 +47650,125 @@ def test_search_change_history_events_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.search_change_history_events(request) + client.get_display_video360_advertiser_link(request) -def test_search_change_history_events_rest_pager(transport: str = "rest"): +def test_get_display_video360_advertiser_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + transport="rest", ) # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - ], - next_page_token="abc", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[], - next_page_token="def", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - ], - next_page_token="ghi", - ), - analytics_admin.SearchChangeHistoryEventsResponse( - change_history_events=[ - resources.ChangeHistoryEvent(), - resources.ChangeHistoryEvent(), - ], - ), + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resources.DisplayVideo360AdvertiserLink() + + # get arguments that satisfy an http rule for this method + sample_request = { + "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2" + } + + # get truthy value for each flattened field + mock_args = dict( + name="name_value", ) - # Two responses for two calls - response = response + response + mock_args.update(sample_request) - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.SearchChangeHistoryEventsResponse.to_json(x) - for x in response + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_display_video360_advertiser_link(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{name=properties/*/displayVideo360AdvertiserLinks/*}" + % client.transport._host, + args[1], ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - sample_request = {"account": "accounts/sample1"} - pager = client.search_change_history_events(request=sample_request) +def test_get_display_video360_advertiser_link_rest_flattened_error( + transport: str = "rest", +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.ChangeHistoryEvent) for i in results) + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_display_video360_advertiser_link( + analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(), + name="name_value", + ) - pages = list(client.search_change_history_events(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token + +def test_get_display_video360_advertiser_link_rest_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetGoogleSignalsSettingsRequest, + analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, dict, ], ) -def test_get_google_signals_settings_rest(request_type): +def test_list_display_video360_advertiser_links_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/googleSignalsSettings"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.GoogleSignalsSettings( - name="name_value", - state=resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED, - consent=resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED, + return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleSignalsSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_google_signals_settings(request) + response = client.list_display_video360_advertiser_links(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.GoogleSignalsSettings) - assert response.name == "name_value" - assert response.state == resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED - assert ( - response.consent - == resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED - ) + assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinksPager) + assert response.next_page_token == "next_page_token_value" -def test_get_google_signals_settings_rest_required_fields( - request_type=analytics_admin.GetGoogleSignalsSettingsRequest, +def test_list_display_video360_advertiser_links_rest_required_fields( + request_type=analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -47056,21 +47783,32 @@ def test_get_google_signals_settings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_google_signals_settings._get_unset_required_fields(jsonified_request) + ).list_display_video360_advertiser_links._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_google_signals_settings._get_unset_required_fields(jsonified_request) + ).list_display_video360_advertiser_links._get_unset_required_fields( + jsonified_request + ) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -47079,7 +47817,7 @@ def test_get_google_signals_settings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.GoogleSignalsSettings() + return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -47099,30 +47837,45 @@ def test_get_google_signals_settings_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleSignalsSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse.pb( + return_value + ) + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_google_signals_settings(request) + response = client.list_display_video360_advertiser_links(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_google_signals_settings_rest_unset_required_fields(): +def test_list_display_video360_advertiser_links_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_google_signals_settings._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = ( + transport.list_display_video360_advertiser_links._get_unset_required_fields({}) + ) + assert set(unset_fields) == ( + set( + ( + "pageSize", + "pageToken", + ) + ) + & set(("parent",)) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_google_signals_settings_rest_interceptors(null_interceptor): +def test_list_display_video360_advertiser_links_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -47136,15 +47889,15 @@ def test_get_google_signals_settings_rest_interceptors(null_interceptor): path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_get_google_signals_settings", + "post_list_display_video360_advertiser_links", ) as post, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "pre_get_google_signals_settings", + "pre_list_display_video360_advertiser_links", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetGoogleSignalsSettingsRequest.pb( - analytics_admin.GetGoogleSignalsSettingsRequest() + pb_message = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest.pb( + analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() ) transcode.return_value = { "method": "post", @@ -47156,19 +47909,21 @@ def test_get_google_signals_settings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.GoogleSignalsSettings.to_json( - resources.GoogleSignalsSettings() + req.return_value._content = ( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse.to_json( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() + ) ) - request = analytics_admin.GetGoogleSignalsSettingsRequest() + request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.GoogleSignalsSettings() + post.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() - client.get_google_signals_settings( + client.list_display_video360_advertiser_links( request, metadata=[ ("key", "val"), @@ -47180,9 +47935,9 @@ def test_get_google_signals_settings_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_google_signals_settings_rest_bad_request( +def test_list_display_video360_advertiser_links_rest_bad_request( transport: str = "rest", - request_type=analytics_admin.GetGoogleSignalsSettingsRequest, + request_type=analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -47190,7 +47945,7 @@ def test_get_google_signals_settings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/googleSignalsSettings"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -47202,10 +47957,10 @@ def test_get_google_signals_settings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_google_signals_settings(request) + client.list_display_video360_advertiser_links(request) -def test_get_google_signals_settings_rest_flattened(): +def test_list_display_video360_advertiser_links_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -47214,118 +47969,260 @@ def test_get_google_signals_settings_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.GoogleSignalsSettings() + return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/googleSignalsSettings"} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleSignalsSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_google_signals_settings(**mock_args) + client.list_display_video360_advertiser_links(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/googleSignalsSettings}" + "%s/v1alpha/{parent=properties/*}/displayVideo360AdvertiserLinks" % client.transport._host, args[1], ) -def test_get_google_signals_settings_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) +def test_list_display_video360_advertiser_links_rest_flattened_error( + transport: str = "rest", +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_display_video360_advertiser_links( + analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(), + parent="parent_value", + ) + + +def test_list_display_video360_advertiser_links_rest_pager(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[], + next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse.to_json(x) + for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "properties/sample1"} + + pager = client.list_display_video360_advertiser_links(request=sample_request) - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_google_signals_settings( - analytics_admin.GetGoogleSignalsSettingsRequest(), - name="name_value", + results = list(pager) + assert len(results) == 6 + assert all( + isinstance(i, resources.DisplayVideo360AdvertiserLink) for i in results ) - -def test_get_google_signals_settings_rest_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) + pages = list( + client.list_display_video360_advertiser_links(request=sample_request).pages + ) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateGoogleSignalsSettingsRequest, + analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, dict, ], ) -def test_update_google_signals_settings_rest(request_type): +def test_create_display_video360_advertiser_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "google_signals_settings": {"name": "properties/sample1/googleSignalsSettings"} - } - request_init["google_signals_settings"] = { - "name": "properties/sample1/googleSignalsSettings", - "state": 1, - "consent": 2, + request_init = {"parent": "properties/sample1"} + request_init["display_video_360_advertiser_link"] = { + "name": "name_value", + "advertiser_id": "advertiser_id_value", + "advertiser_display_name": "advertiser_display_name_value", + "ads_personalization_enabled": {"value": True}, + "campaign_data_sharing_enabled": {}, + "cost_data_sharing_enabled": {}, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest.meta.fields[ + "display_video_360_advertiser_link" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "display_video_360_advertiser_link" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range( + 0, len(request_init["display_video_360_advertiser_link"][field]) + ): + del request_init["display_video_360_advertiser_link"][field][i][ + subfield + ] + else: + del request_init["display_video_360_advertiser_link"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.GoogleSignalsSettings( + return_value = resources.DisplayVideo360AdvertiserLink( name="name_value", - state=resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED, - consent=resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleSignalsSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_google_signals_settings(request) + response = client.create_display_video360_advertiser_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.GoogleSignalsSettings) + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) assert response.name == "name_value" - assert response.state == resources.GoogleSignalsState.GOOGLE_SIGNALS_ENABLED - assert ( - response.consent - == resources.GoogleSignalsConsent.GOOGLE_SIGNALS_CONSENT_CONSENTED - ) + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_update_google_signals_settings_rest_required_fields( - request_type=analytics_admin.UpdateGoogleSignalsSettingsRequest, +def test_create_display_video360_advertiser_link_rest_required_fields( + request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -47340,19 +48237,25 @@ def test_update_google_signals_settings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_google_signals_settings._get_unset_required_fields(jsonified_request) + ).create_display_video360_advertiser_link._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["parent"] = "parent_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_google_signals_settings._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + ).create_display_video360_advertiser_link._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -47361,7 +48264,7 @@ def test_update_google_signals_settings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.GoogleSignalsSettings() + return_value = resources.DisplayVideo360AdvertiserLink() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -47373,7 +48276,7 @@ def test_update_google_signals_settings_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "post", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -47382,40 +48285,41 @@ def test_update_google_signals_settings_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleSignalsSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_google_signals_settings(request) + response = client.create_display_video360_advertiser_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_google_signals_settings_rest_unset_required_fields(): +def test_create_display_video360_advertiser_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_google_signals_settings._get_unset_required_fields( - {} + unset_fields = ( + transport.create_display_video360_advertiser_link._get_unset_required_fields({}) ) assert set(unset_fields) == ( - set(("updateMask",)) + set(()) & set( ( - "googleSignalsSettings", - "updateMask", + "parent", + "displayVideo360AdvertiserLink", ) ) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_google_signals_settings_rest_interceptors(null_interceptor): +def test_create_display_video360_advertiser_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -47429,15 +48333,15 @@ def test_update_google_signals_settings_rest_interceptors(null_interceptor): path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_update_google_signals_settings", + "post_create_display_video360_advertiser_link", ) as post, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "pre_update_google_signals_settings", + "pre_create_display_video360_advertiser_link", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateGoogleSignalsSettingsRequest.pb( - analytics_admin.UpdateGoogleSignalsSettingsRequest() + pb_message = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest.pb( + analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() ) transcode.return_value = { "method": "post", @@ -47449,19 +48353,19 @@ def test_update_google_signals_settings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.GoogleSignalsSettings.to_json( - resources.GoogleSignalsSettings() + req.return_value._content = resources.DisplayVideo360AdvertiserLink.to_json( + resources.DisplayVideo360AdvertiserLink() ) - request = analytics_admin.UpdateGoogleSignalsSettingsRequest() + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.GoogleSignalsSettings() + post.return_value = resources.DisplayVideo360AdvertiserLink() - client.update_google_signals_settings( + client.create_display_video360_advertiser_link( request, metadata=[ ("key", "val"), @@ -47473,9 +48377,9 @@ def test_update_google_signals_settings_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_google_signals_settings_rest_bad_request( +def test_create_display_video360_advertiser_link_rest_bad_request( transport: str = "rest", - request_type=analytics_admin.UpdateGoogleSignalsSettingsRequest, + request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -47483,14 +48387,7 @@ def test_update_google_signals_settings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "google_signals_settings": {"name": "properties/sample1/googleSignalsSettings"} - } - request_init["google_signals_settings"] = { - "name": "properties/sample1/googleSignalsSettings", - "state": 1, - "consent": 2, - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -47502,10 +48399,10 @@ def test_update_google_signals_settings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_google_signals_settings(request) + client.create_display_video360_advertiser_link(request) -def test_update_google_signals_settings_rest_flattened(): +def test_create_display_video360_advertiser_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -47514,44 +48411,45 @@ def test_update_google_signals_settings_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.GoogleSignalsSettings() + return_value = resources.DisplayVideo360AdvertiserLink() # get arguments that satisfy an http rule for this method - sample_request = { - "google_signals_settings": { - "name": "properties/sample1/googleSignalsSettings" - } - } + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - google_signals_settings=resources.GoogleSignalsSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + parent="parent_value", + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleSignalsSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_google_signals_settings(**mock_args) + client.create_display_video360_advertiser_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{google_signals_settings.name=properties/*/googleSignalsSettings}" + "%s/v1alpha/{parent=properties/*}/displayVideo360AdvertiserLinks" % client.transport._host, args[1], ) -def test_update_google_signals_settings_rest_flattened_error(transport: str = "rest"): +def test_create_display_video360_advertiser_link_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -47560,14 +48458,16 @@ def test_update_google_signals_settings_rest_flattened_error(transport: str = "r # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_google_signals_settings( - analytics_admin.UpdateGoogleSignalsSettingsRequest(), - google_signals_settings=resources.GoogleSignalsSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.create_display_video360_advertiser_link( + analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(), + parent="parent_value", + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), ) -def test_update_google_signals_settings_rest_error(): +def test_create_display_video360_advertiser_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -47576,68 +48476,45 @@ def test_update_google_signals_settings_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateConversionEventRequest, + analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, dict, ], ) -def test_create_conversion_event_rest(request_type): +def test_delete_display_video360_advertiser_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["conversion_event"] = { - "name": "name_value", - "event_name": "event_name_value", - "create_time": {"seconds": 751, "nanos": 543}, - "deletable": True, - "custom": True, - "counting_method": 1, - } + request_init = {"name": "properties/sample1/displayVideo360AdvertiserLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.ConversionEvent( - name="name_value", - event_name="event_name_value", - deletable=True, - custom=True, - counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_conversion_event(request) + response = client.delete_display_video360_advertiser_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.ConversionEvent) - assert response.name == "name_value" - assert response.event_name == "event_name_value" - assert response.deletable is True - assert response.custom is True - assert ( - response.counting_method - == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT - ) + assert response is None -def test_create_conversion_event_rest_required_fields( - request_type=analytics_admin.CreateConversionEventRequest, +def test_delete_display_video360_advertiser_link_rest_required_fields( + request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -47652,21 +48529,25 @@ def test_create_conversion_event_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_conversion_event._get_unset_required_fields(jsonified_request) + ).delete_display_video360_advertiser_link._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_conversion_event._get_unset_required_fields(jsonified_request) + ).delete_display_video360_advertiser_link._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -47675,7 +48556,7 @@ def test_create_conversion_event_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.ConversionEvent() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -47687,47 +48568,38 @@ def test_create_conversion_event_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "delete", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_conversion_event(request) + response = client.delete_display_video360_advertiser_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_conversion_event_rest_unset_required_fields(): +def test_delete_display_video360_advertiser_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_conversion_event._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(()) - & set( - ( - "conversionEvent", - "parent", - ) - ) + unset_fields = ( + transport.delete_display_video360_advertiser_link._get_unset_required_fields({}) ) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_conversion_event_rest_interceptors(null_interceptor): +def test_delete_display_video360_advertiser_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -47740,14 +48612,12 @@ def test_create_conversion_event_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_conversion_event" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_conversion_event" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_delete_display_video360_advertiser_link", ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.CreateConversionEventRequest.pb( - analytics_admin.CreateConversionEventRequest() + pb_message = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest.pb( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() ) transcode.return_value = { "method": "post", @@ -47759,19 +48629,15 @@ def test_create_conversion_event_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.ConversionEvent.to_json( - resources.ConversionEvent() - ) - request = analytics_admin.CreateConversionEventRequest() + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.ConversionEvent() - client.create_conversion_event( + client.delete_display_video360_advertiser_link( request, metadata=[ ("key", "val"), @@ -47780,11 +48646,11 @@ def test_create_conversion_event_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_create_conversion_event_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateConversionEventRequest +def test_delete_display_video360_advertiser_link_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -47792,15 +48658,7 @@ def test_create_conversion_event_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["conversion_event"] = { - "name": "name_value", - "event_name": "event_name_value", - "create_time": {"seconds": 751, "nanos": 543}, - "deletable": True, - "custom": True, - "counting_method": 1, - } + request_init = {"name": "properties/sample1/displayVideo360AdvertiserLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -47812,10 +48670,10 @@ def test_create_conversion_event_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_conversion_event(request) + client.delete_display_video360_advertiser_link(request) -def test_create_conversion_event_rest_flattened(): +def test_delete_display_video360_advertiser_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -47824,40 +48682,42 @@ def test_create_conversion_event_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.ConversionEvent() + return_value = None # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = { + "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2" + } # get truthy value for each flattened field mock_args = dict( - parent="parent_value", - conversion_event=resources.ConversionEvent(name="name_value"), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_conversion_event(**mock_args) + client.delete_display_video360_advertiser_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/conversionEvents" + "%s/v1alpha/{name=properties/*/displayVideo360AdvertiserLinks/*}" % client.transport._host, args[1], ) -def test_create_conversion_event_rest_flattened_error(transport: str = "rest"): +def test_delete_display_video360_advertiser_link_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -47866,14 +48726,13 @@ def test_create_conversion_event_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_conversion_event( - analytics_admin.CreateConversionEventRequest(), - parent="parent_value", - conversion_event=resources.ConversionEvent(name="name_value"), + client.delete_display_video360_advertiser_link( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(), + name="name_value", ) -def test_create_conversion_event_rest_error(): +def test_delete_display_video360_advertiser_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -47882,11 +48741,11 @@ def test_create_conversion_event_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateConversionEventRequest, + analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, dict, ], ) -def test_update_conversion_event_rest(request_type): +def test_update_display_video360_advertiser_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -47894,53 +48753,124 @@ def test_update_conversion_event_rest(request_type): # send a request that will satisfy transcoding request_init = { - "conversion_event": {"name": "properties/sample1/conversionEvents/sample2"} + "display_video_360_advertiser_link": { + "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2" + } } - request_init["conversion_event"] = { - "name": "properties/sample1/conversionEvents/sample2", - "event_name": "event_name_value", - "create_time": {"seconds": 751, "nanos": 543}, - "deletable": True, - "custom": True, - "counting_method": 1, + request_init["display_video_360_advertiser_link"] = { + "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2", + "advertiser_id": "advertiser_id_value", + "advertiser_display_name": "advertiser_display_name_value", + "ads_personalization_enabled": {"value": True}, + "campaign_data_sharing_enabled": {}, + "cost_data_sharing_enabled": {}, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest.meta.fields[ + "display_video_360_advertiser_link" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "display_video_360_advertiser_link" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range( + 0, len(request_init["display_video_360_advertiser_link"][field]) + ): + del request_init["display_video_360_advertiser_link"][field][i][ + subfield + ] + else: + del request_init["display_video_360_advertiser_link"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.ConversionEvent( + return_value = resources.DisplayVideo360AdvertiserLink( name="name_value", - event_name="event_name_value", - deletable=True, - custom=True, - counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_conversion_event(request) + response = client.update_display_video360_advertiser_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.ConversionEvent) + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) assert response.name == "name_value" - assert response.event_name == "event_name_value" - assert response.deletable is True - assert response.custom is True - assert ( - response.counting_method - == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT - ) + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_update_conversion_event_rest_required_fields( - request_type=analytics_admin.UpdateConversionEventRequest, +def test_update_display_video360_advertiser_link_rest_required_fields( + request_type=analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -47959,14 +48889,18 @@ def test_update_conversion_event_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_conversion_event._get_unset_required_fields(jsonified_request) + ).update_display_video360_advertiser_link._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_conversion_event._get_unset_required_fields(jsonified_request) + ).update_display_video360_advertiser_link._get_unset_required_fields( + jsonified_request + ) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) @@ -47980,7 +48914,7 @@ def test_update_conversion_event_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.ConversionEvent() + return_value = resources.DisplayVideo360AdvertiserLink() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -48001,38 +48935,33 @@ def test_update_conversion_event_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_conversion_event(request) + response = client.update_display_video360_advertiser_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_conversion_event_rest_unset_required_fields(): +def test_update_display_video360_advertiser_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_conversion_event._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(("updateMask",)) - & set( - ( - "conversionEvent", - "updateMask", - ) - ) + unset_fields = ( + transport.update_display_video360_advertiser_link._get_unset_required_fields({}) ) + assert set(unset_fields) == (set(("updateMask",)) & set(("updateMask",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_conversion_event_rest_interceptors(null_interceptor): +def test_update_display_video360_advertiser_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -48045,14 +48974,16 @@ def test_update_conversion_event_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_conversion_event" + transports.AnalyticsAdminServiceRestInterceptor, + "post_update_display_video360_advertiser_link", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_conversion_event" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_update_display_video360_advertiser_link", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateConversionEventRequest.pb( - analytics_admin.UpdateConversionEventRequest() + pb_message = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest.pb( + analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() ) transcode.return_value = { "method": "post", @@ -48064,19 +48995,19 @@ def test_update_conversion_event_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.ConversionEvent.to_json( - resources.ConversionEvent() + req.return_value._content = resources.DisplayVideo360AdvertiserLink.to_json( + resources.DisplayVideo360AdvertiserLink() ) - request = analytics_admin.UpdateConversionEventRequest() + request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.ConversionEvent() + post.return_value = resources.DisplayVideo360AdvertiserLink() - client.update_conversion_event( + client.update_display_video360_advertiser_link( request, metadata=[ ("key", "val"), @@ -48088,8 +49019,9 @@ def test_update_conversion_event_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_conversion_event_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateConversionEventRequest +def test_update_display_video360_advertiser_link_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -48098,15 +49030,9 @@ def test_update_conversion_event_rest_bad_request( # send a request that will satisfy transcoding request_init = { - "conversion_event": {"name": "properties/sample1/conversionEvents/sample2"} - } - request_init["conversion_event"] = { - "name": "properties/sample1/conversionEvents/sample2", - "event_name": "event_name_value", - "create_time": {"seconds": 751, "nanos": 543}, - "deletable": True, - "custom": True, - "counting_method": 1, + "display_video_360_advertiser_link": { + "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2" + } } request = request_type(**request_init) @@ -48119,10 +49045,10 @@ def test_update_conversion_event_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_conversion_event(request) + client.update_display_video360_advertiser_link(request) -def test_update_conversion_event_rest_flattened(): +def test_update_display_video360_advertiser_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -48131,16 +49057,20 @@ def test_update_conversion_event_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.ConversionEvent() + return_value = resources.DisplayVideo360AdvertiserLink() # get arguments that satisfy an http rule for this method sample_request = { - "conversion_event": {"name": "properties/sample1/conversionEvents/sample2"} + "display_video_360_advertiser_link": { + "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2" + } } # get truthy value for each flattened field mock_args = dict( - conversion_event=resources.ConversionEvent(name="name_value"), + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) @@ -48148,25 +49078,28 @@ def test_update_conversion_event_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_conversion_event(**mock_args) + client.update_display_video360_advertiser_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{conversion_event.name=properties/*/conversionEvents/*}" + "%s/v1alpha/{display_video_360_advertiser_link.name=properties/*/displayVideo360AdvertiserLinks/*}" % client.transport._host, args[1], ) -def test_update_conversion_event_rest_flattened_error(transport: str = "rest"): +def test_update_display_video360_advertiser_link_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -48175,14 +49108,16 @@ def test_update_conversion_event_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_conversion_event( - analytics_admin.UpdateConversionEventRequest(), - conversion_event=resources.ConversionEvent(name="name_value"), + client.update_display_video360_advertiser_link( + analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(), + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_update_conversion_event_rest_error(): +def test_update_display_video360_advertiser_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -48191,55 +49126,53 @@ def test_update_conversion_event_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetConversionEventRequest, + analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, dict, ], ) -def test_get_conversion_event_rest(request_type): +def test_get_display_video360_advertiser_link_proposal_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/conversionEvents/sample2"} + request_init = { + "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" + } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.ConversionEvent( + return_value = resources.DisplayVideo360AdvertiserLinkProposal( name="name_value", - event_name="event_name_value", - deletable=True, - custom=True, - counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_conversion_event(request) + response = client.get_display_video360_advertiser_link_proposal(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.ConversionEvent) + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) assert response.name == "name_value" - assert response.event_name == "event_name_value" - assert response.deletable is True - assert response.custom is True - assert ( - response.counting_method - == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT - ) + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" -def test_get_conversion_event_rest_required_fields( - request_type=analytics_admin.GetConversionEventRequest, +def test_get_display_video360_advertiser_link_proposal_rest_required_fields( + request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -48259,7 +49192,9 @@ def test_get_conversion_event_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_conversion_event._get_unset_required_fields(jsonified_request) + ).get_display_video360_advertiser_link_proposal._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -48268,7 +49203,9 @@ def test_get_conversion_event_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_conversion_event._get_unset_required_fields(jsonified_request) + ).get_display_video360_advertiser_link_proposal._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -48282,7 +49219,7 @@ def test_get_conversion_event_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.ConversionEvent() + return_value = resources.DisplayVideo360AdvertiserLinkProposal() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -48302,30 +49239,37 @@ def test_get_conversion_event_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_conversion_event(request) + response = client.get_display_video360_advertiser_link_proposal(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_conversion_event_rest_unset_required_fields(): +def test_get_display_video360_advertiser_link_proposal_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_conversion_event._get_unset_required_fields({}) + unset_fields = transport.get_display_video360_advertiser_link_proposal._get_unset_required_fields( + {} + ) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_conversion_event_rest_interceptors(null_interceptor): +def test_get_display_video360_advertiser_link_proposal_rest_interceptors( + null_interceptor, +): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -48338,14 +49282,16 @@ def test_get_conversion_event_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_conversion_event" + transports.AnalyticsAdminServiceRestInterceptor, + "post_get_display_video360_advertiser_link_proposal", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_conversion_event" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_get_display_video360_advertiser_link_proposal", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetConversionEventRequest.pb( - analytics_admin.GetConversionEventRequest() + pb_message = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest.pb( + analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() ) transcode.return_value = { "method": "post", @@ -48357,19 +49303,21 @@ def test_get_conversion_event_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.ConversionEvent.to_json( - resources.ConversionEvent() + req.return_value._content = ( + resources.DisplayVideo360AdvertiserLinkProposal.to_json( + resources.DisplayVideo360AdvertiserLinkProposal() + ) ) - request = analytics_admin.GetConversionEventRequest() + request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.ConversionEvent() + post.return_value = resources.DisplayVideo360AdvertiserLinkProposal() - client.get_conversion_event( + client.get_display_video360_advertiser_link_proposal( request, metadata=[ ("key", "val"), @@ -48381,8 +49329,9 @@ def test_get_conversion_event_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_conversion_event_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetConversionEventRequest +def test_get_display_video360_advertiser_link_proposal_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -48390,7 +49339,9 @@ def test_get_conversion_event_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/conversionEvents/sample2"} + request_init = { + "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -48402,10 +49353,10 @@ def test_get_conversion_event_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_conversion_event(request) + client.get_display_video360_advertiser_link_proposal(request) -def test_get_conversion_event_rest_flattened(): +def test_get_display_video360_advertiser_link_proposal_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -48414,10 +49365,12 @@ def test_get_conversion_event_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.ConversionEvent() + return_value = resources.DisplayVideo360AdvertiserLinkProposal() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/conversionEvents/sample2"} + sample_request = { + "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" + } # get truthy value for each flattened field mock_args = dict( @@ -48428,25 +49381,28 @@ def test_get_conversion_event_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_conversion_event(**mock_args) + client.get_display_video360_advertiser_link_proposal(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/conversionEvents/*}" + "%s/v1alpha/{name=properties/*/displayVideo360AdvertiserLinkProposals/*}" % client.transport._host, args[1], ) -def test_get_conversion_event_rest_flattened_error(transport: str = "rest"): +def test_get_display_video360_advertiser_link_proposal_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -48455,13 +49411,13 @@ def test_get_conversion_event_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_conversion_event( - analytics_admin.GetConversionEventRequest(), + client.get_display_video360_advertiser_link_proposal( + analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest(), name="name_value", ) -def test_get_conversion_event_rest_error(): +def test_get_display_video360_advertiser_link_proposal_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -48470,45 +49426,56 @@ def test_get_conversion_event_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteConversionEventRequest, + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, dict, ], ) -def test_delete_conversion_event_rest(request_type): +def test_list_display_video360_advertiser_link_proposals_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/conversionEvents/sample2"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + next_page_token="next_page_token_value", + ) + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse.pb( + return_value + ) + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_conversion_event(request) + response = client.list_display_video360_advertiser_link_proposals(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinkProposalsPager) + assert response.next_page_token == "next_page_token_value" -def test_delete_conversion_event_rest_required_fields( - request_type=analytics_admin.DeleteConversionEventRequest, +def test_list_display_video360_advertiser_link_proposals_rest_required_fields( + request_type=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -48523,21 +49490,32 @@ def test_delete_conversion_event_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_conversion_event._get_unset_required_fields(jsonified_request) + ).list_display_video360_advertiser_link_proposals._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_conversion_event._get_unset_required_fields(jsonified_request) + ).list_display_video360_advertiser_link_proposals._get_unset_required_fields( + jsonified_request + ) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -48546,7 +49524,7 @@ def test_delete_conversion_event_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -48558,36 +49536,55 @@ def test_delete_conversion_event_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "get", "query_params": pb_request, } transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse.pb( + return_value + ) + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_conversion_event(request) + response = client.list_display_video360_advertiser_link_proposals(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_conversion_event_rest_unset_required_fields(): +def test_list_display_video360_advertiser_link_proposals_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_conversion_event._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.list_display_video360_advertiser_link_proposals._get_unset_required_fields( + {} + ) + assert set(unset_fields) == ( + set( + ( + "pageSize", + "pageToken", + ) + ) + & set(("parent",)) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_conversion_event_rest_interceptors(null_interceptor): +def test_list_display_video360_advertiser_link_proposals_rest_interceptors( + null_interceptor, +): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -48600,11 +49597,18 @@ def test_delete_conversion_event_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_conversion_event" + transports.AnalyticsAdminServiceRestInterceptor, + "post_list_display_video360_advertiser_link_proposals", + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, + "pre_list_display_video360_advertiser_link_proposals", ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteConversionEventRequest.pb( - analytics_admin.DeleteConversionEventRequest() + post.assert_not_called() + pb_message = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest.pb( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() + ) ) transcode.return_value = { "method": "post", @@ -48616,15 +49620,23 @@ def test_delete_conversion_event_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse.to_json( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() + ) + ) - request = analytics_admin.DeleteConversionEventRequest() + request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() + ) - client.delete_conversion_event( + client.list_display_video360_advertiser_link_proposals( request, metadata=[ ("key", "val"), @@ -48633,10 +49645,12 @@ def test_delete_conversion_event_rest_interceptors(null_interceptor): ) pre.assert_called_once() + post.assert_called_once() -def test_delete_conversion_event_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteConversionEventRequest +def test_list_display_video360_advertiser_link_proposals_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -48644,7 +49658,7 @@ def test_delete_conversion_event_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/conversionEvents/sample2"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -48656,10 +49670,10 @@ def test_delete_conversion_event_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_conversion_event(request) + client.list_display_video360_advertiser_link_proposals(request) -def test_delete_conversion_event_rest_flattened(): +def test_list_display_video360_advertiser_link_proposals_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -48668,38 +49682,48 @@ def test_delete_conversion_event_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() + ) # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/conversionEvents/sample2"} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse.pb( + return_value + ) + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.delete_conversion_event(**mock_args) + client.list_display_video360_advertiser_link_proposals(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/conversionEvents/*}" + "%s/v1alpha/{parent=properties/*}/displayVideo360AdvertiserLinkProposals" % client.transport._host, args[1], ) -def test_delete_conversion_event_rest_flattened_error(transport: str = "rest"): +def test_list_display_video360_advertiser_link_proposals_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -48708,26 +49732,97 @@ def test_delete_conversion_event_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_conversion_event( - analytics_admin.DeleteConversionEventRequest(), - name="name_value", + client.list_display_video360_advertiser_link_proposals( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest(), + parent="parent_value", ) -def test_delete_conversion_event_rest_error(): +def test_list_display_video360_advertiser_link_proposals_rest_pager( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[], + next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse.to_json( + x + ) + for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "properties/sample1"} + + pager = client.list_display_video360_advertiser_link_proposals( + request=sample_request + ) + + results = list(pager) + assert len(results) == 6 + assert all( + isinstance(i, resources.DisplayVideo360AdvertiserLinkProposal) + for i in results + ) + + pages = list( + client.list_display_video360_advertiser_link_proposals( + request=sample_request + ).pages + ) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListConversionEventsRequest, + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, dict, ], ) -def test_list_conversion_events_rest(request_type): +def test_create_display_video360_advertiser_link_proposal_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -48735,32 +49830,137 @@ def test_list_conversion_events_rest(request_type): # send a request that will satisfy transcoding request_init = {"parent": "properties/sample1"} + request_init["display_video_360_advertiser_link_proposal"] = { + "name": "name_value", + "advertiser_id": "advertiser_id_value", + "link_proposal_status_details": { + "link_proposal_initiating_product": 1, + "requestor_email": "requestor_email_value", + "link_proposal_state": 1, + }, + "advertiser_display_name": "advertiser_display_name_value", + "validation_email": "validation_email_value", + "ads_personalization_enabled": {"value": True}, + "campaign_data_sharing_enabled": {}, + "cost_data_sharing_enabled": {}, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = ( + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest.meta.fields[ + "display_video_360_advertiser_link_proposal" + ] + ) + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "display_video_360_advertiser_link_proposal" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range( + 0, + len( + request_init["display_video_360_advertiser_link_proposal"][ + field + ] + ), + ): + del request_init["display_video_360_advertiser_link_proposal"][ + field + ][i][subfield] + else: + del request_init["display_video_360_advertiser_link_proposal"][field][ + subfield + ] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListConversionEventsResponse( - next_page_token="next_page_token_value", + return_value = resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListConversionEventsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_conversion_events(request) + response = client.create_display_video360_advertiser_link_proposal(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListConversionEventsPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" -def test_list_conversion_events_rest_required_fields( - request_type=analytics_admin.ListConversionEventsRequest, +def test_create_display_video360_advertiser_link_proposal_rest_required_fields( + request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -48780,7 +49980,9 @@ def test_list_conversion_events_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_conversion_events._get_unset_required_fields(jsonified_request) + ).create_display_video360_advertiser_link_proposal._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -48789,13 +49991,8 @@ def test_list_conversion_events_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_conversion_events._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) + ).create_display_video360_advertiser_link_proposal._get_unset_required_fields( + jsonified_request ) jsonified_request.update(unset_fields) @@ -48810,7 +50007,7 @@ def test_list_conversion_events_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListConversionEventsResponse() + return_value = resources.DisplayVideo360AdvertiserLinkProposal() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -48822,48 +50019,54 @@ def test_list_conversion_events_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListConversionEventsResponse.pb( + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb( return_value ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_conversion_events(request) + response = client.create_display_video360_advertiser_link_proposal(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_conversion_events_rest_unset_required_fields(): +def test_create_display_video360_advertiser_link_proposal_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_conversion_events._get_unset_required_fields({}) + unset_fields = transport.create_display_video360_advertiser_link_proposal._get_unset_required_fields( + {} + ) assert set(unset_fields) == ( - set( + set(()) + & set( ( - "pageSize", - "pageToken", + "parent", + "displayVideo360AdvertiserLinkProposal", ) ) - & set(("parent",)) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_conversion_events_rest_interceptors(null_interceptor): +def test_create_display_video360_advertiser_link_proposal_rest_interceptors( + null_interceptor, +): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -48876,14 +50079,18 @@ def test_list_conversion_events_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_conversion_events" + transports.AnalyticsAdminServiceRestInterceptor, + "post_create_display_video360_advertiser_link_proposal", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_conversion_events" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_create_display_video360_advertiser_link_proposal", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListConversionEventsRequest.pb( - analytics_admin.ListConversionEventsRequest() + pb_message = ( + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest.pb( + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() + ) ) transcode.return_value = { "method": "post", @@ -48896,20 +50103,20 @@ def test_list_conversion_events_rest_interceptors(null_interceptor): req.return_value.status_code = 200 req.return_value.request = PreparedRequest() req.return_value._content = ( - analytics_admin.ListConversionEventsResponse.to_json( - analytics_admin.ListConversionEventsResponse() + resources.DisplayVideo360AdvertiserLinkProposal.to_json( + resources.DisplayVideo360AdvertiserLinkProposal() ) ) - request = analytics_admin.ListConversionEventsRequest() + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListConversionEventsResponse() + post.return_value = resources.DisplayVideo360AdvertiserLinkProposal() - client.list_conversion_events( + client.create_display_video360_advertiser_link_proposal( request, metadata=[ ("key", "val"), @@ -48921,8 +50128,9 @@ def test_list_conversion_events_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_conversion_events_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListConversionEventsRequest +def test_create_display_video360_advertiser_link_proposal_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -48942,10 +50150,10 @@ def test_list_conversion_events_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_conversion_events(request) + client.create_display_video360_advertiser_link_proposal(request) -def test_list_conversion_events_rest_flattened(): +def test_create_display_video360_advertiser_link_proposal_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -48954,7 +50162,7 @@ def test_list_conversion_events_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListConversionEventsResponse() + return_value = resources.DisplayVideo360AdvertiserLinkProposal() # get arguments that satisfy an http rule for this method sample_request = {"parent": "properties/sample1"} @@ -48962,31 +50170,37 @@ def test_list_conversion_events_rest_flattened(): # get truthy value for each flattened field mock_args = dict( parent="parent_value", + display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value" + ), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListConversionEventsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_conversion_events(**mock_args) + client.create_display_video360_advertiser_link_proposal(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/conversionEvents" + "%s/v1alpha/{parent=properties/*}/displayVideo360AdvertiserLinkProposals" % client.transport._host, args[1], ) -def test_list_conversion_events_rest_flattened_error(transport: str = "rest"): +def test_create_display_video360_advertiser_link_proposal_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -48995,120 +50209,60 @@ def test_list_conversion_events_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_conversion_events( - analytics_admin.ListConversionEventsRequest(), + client.create_display_video360_advertiser_link_proposal( + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest(), parent="parent_value", - ) - - -def test_list_conversion_events_rest_pager(transport: str = "rest"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), - resources.ConversionEvent(), - resources.ConversionEvent(), - ], - next_page_token="abc", - ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[], - next_page_token="def", - ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), - ], - next_page_token="ghi", - ), - analytics_admin.ListConversionEventsResponse( - conversion_events=[ - resources.ConversionEvent(), - resources.ConversionEvent(), - ], + display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value" ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListConversionEventsResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "properties/sample1"} - - pager = client.list_conversion_events(request=sample_request) + ) - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.ConversionEvent) for i in results) - pages = list(client.list_conversion_events(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token +def test_create_display_video360_advertiser_link_proposal_rest_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, dict, ], ) -def test_get_display_video360_advertiser_link_rest(request_type): +def test_delete_display_video360_advertiser_link_proposal_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/displayVideo360AdvertiserLinks/sample2"} + request_init = { + "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" + } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLink( - name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_display_video360_advertiser_link(request) + response = client.delete_display_video360_advertiser_link_proposal(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLink) - assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" + assert response is None -def test_get_display_video360_advertiser_link_rest_required_fields( - request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, +def test_delete_display_video360_advertiser_link_proposal_rest_required_fields( + request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -49128,7 +50282,9 @@ def test_get_display_video360_advertiser_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_display_video360_advertiser_link._get_unset_required_fields(jsonified_request) + ).delete_display_video360_advertiser_link_proposal._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -49137,7 +50293,9 @@ def test_get_display_video360_advertiser_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_display_video360_advertiser_link._get_unset_required_fields(jsonified_request) + ).delete_display_video360_advertiser_link_proposal._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -49151,7 +50309,7 @@ def test_get_display_video360_advertiser_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLink() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -49163,40 +50321,40 @@ def test_get_display_video360_advertiser_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "delete", "query_params": pb_request, } transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_display_video360_advertiser_link(request) + response = client.delete_display_video360_advertiser_link_proposal(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_display_video360_advertiser_link_rest_unset_required_fields(): +def test_delete_display_video360_advertiser_link_proposal_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.get_display_video360_advertiser_link._get_unset_required_fields({}) + unset_fields = transport.delete_display_video360_advertiser_link_proposal._get_unset_required_fields( + {} ) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_display_video360_advertiser_link_rest_interceptors(null_interceptor): +def test_delete_display_video360_advertiser_link_proposal_rest_interceptors( + null_interceptor, +): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -49210,15 +50368,13 @@ def test_get_display_video360_advertiser_link_rest_interceptors(null_interceptor path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_get_display_video360_advertiser_link", - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_get_display_video360_advertiser_link", + "pre_delete_display_video360_advertiser_link_proposal", ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest.pb( - analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() + pb_message = ( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest.pb( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() + ) ) transcode.return_value = { "method": "post", @@ -49230,19 +50386,15 @@ def test_get_display_video360_advertiser_link_rest_interceptors(null_interceptor req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.DisplayVideo360AdvertiserLink.to_json( - resources.DisplayVideo360AdvertiserLink() - ) - request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.DisplayVideo360AdvertiserLink() - client.get_display_video360_advertiser_link( + client.delete_display_video360_advertiser_link_proposal( request, metadata=[ ("key", "val"), @@ -49251,12 +50403,11 @@ def test_get_display_video360_advertiser_link_rest_interceptors(null_interceptor ) pre.assert_called_once() - post.assert_called_once() -def test_get_display_video360_advertiser_link_rest_bad_request( +def test_delete_display_video360_advertiser_link_proposal_rest_bad_request( transport: str = "rest", - request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, + request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -49264,7 +50415,9 @@ def test_get_display_video360_advertiser_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/displayVideo360AdvertiserLinks/sample2"} + request_init = { + "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -49276,10 +50429,10 @@ def test_get_display_video360_advertiser_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_display_video360_advertiser_link(request) + client.delete_display_video360_advertiser_link_proposal(request) -def test_get_display_video360_advertiser_link_rest_flattened(): +def test_delete_display_video360_advertiser_link_proposal_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -49288,11 +50441,11 @@ def test_get_display_video360_advertiser_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLink() + return_value = None # get arguments that satisfy an http rule for this method sample_request = { - "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2" + "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" } # get truthy value for each flattened field @@ -49304,25 +50457,24 @@ def test_get_display_video360_advertiser_link_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_display_video360_advertiser_link(**mock_args) + client.delete_display_video360_advertiser_link_proposal(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/displayVideo360AdvertiserLinks/*}" + "%s/v1alpha/{name=properties/*/displayVideo360AdvertiserLinkProposals/*}" % client.transport._host, args[1], ) -def test_get_display_video360_advertiser_link_rest_flattened_error( +def test_delete_display_video360_advertiser_link_proposal_rest_flattened_error( transport: str = "rest", ): client = AnalyticsAdminServiceClient( @@ -49333,13 +50485,13 @@ def test_get_display_video360_advertiser_link_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_display_video360_advertiser_link( - analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(), + client.delete_display_video360_advertiser_link_proposal( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest(), name="name_value", ) -def test_get_display_video360_advertiser_link_rest_error(): +def test_delete_display_video360_advertiser_link_proposal_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -49348,51 +50500,57 @@ def test_get_display_video360_advertiser_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, dict, ], ) -def test_list_display_video360_advertiser_links_rest(request_type): +def test_approve_display_video360_advertiser_link_proposal_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = { + "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" + } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - next_page_token="next_page_token_value", + return_value = ( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse.pb( - return_value + # Convert return value to protobuf type + return_value = ( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse.pb( + return_value + ) ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_display_video360_advertiser_links(request) + response = client.approve_display_video360_advertiser_link_proposal(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinksPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance( + response, analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse + ) -def test_list_display_video360_advertiser_links_rest_required_fields( - request_type=analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, +def test_approve_display_video360_advertiser_link_proposal_rest_required_fields( + request_type=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -49407,32 +50565,25 @@ def test_list_display_video360_advertiser_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_display_video360_advertiser_links._get_unset_required_fields( + ).approve_display_video360_advertiser_link_proposal._get_unset_required_fields( jsonified_request ) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_display_video360_advertiser_links._get_unset_required_fields( + ).approve_display_video360_advertiser_link_proposal._get_unset_required_fields( jsonified_request ) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) - ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -49441,7 +50592,9 @@ def test_list_display_video360_advertiser_links_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() + return_value = ( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() + ) # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -49453,52 +50606,48 @@ def test_list_display_video360_advertiser_links_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = ( - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse.pb( + # Convert return value to protobuf type + return_value = ( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse.pb( return_value ) ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_display_video360_advertiser_links(request) + response = client.approve_display_video360_advertiser_link_proposal(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_display_video360_advertiser_links_rest_unset_required_fields(): +def test_approve_display_video360_advertiser_link_proposal_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.list_display_video360_advertiser_links._get_unset_required_fields({}) - ) - assert set(unset_fields) == ( - set( - ( - "pageSize", - "pageToken", - ) - ) - & set(("parent",)) + unset_fields = transport.approve_display_video360_advertiser_link_proposal._get_unset_required_fields( + {} ) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_display_video360_advertiser_links_rest_interceptors(null_interceptor): +def test_approve_display_video360_advertiser_link_proposal_rest_interceptors( + null_interceptor, +): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -49512,15 +50661,17 @@ def test_list_display_video360_advertiser_links_rest_interceptors(null_intercept path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_list_display_video360_advertiser_links", + "post_approve_display_video360_advertiser_link_proposal", ) as post, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "pre_list_display_video360_advertiser_links", + "pre_approve_display_video360_advertiser_link_proposal", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest.pb( - analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() + pb_message = ( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest.pb( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() + ) ) transcode.return_value = { "method": "post", @@ -49532,21 +50683,21 @@ def test_list_display_video360_advertiser_links_rest_interceptors(null_intercept req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse.to_json( - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() - ) + req.return_value._content = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse.to_json( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() ) - request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() + request = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() + post.return_value = ( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() + ) - client.list_display_video360_advertiser_links( + client.approve_display_video360_advertiser_link_proposal( request, metadata=[ ("key", "val"), @@ -49558,9 +50709,9 @@ def test_list_display_video360_advertiser_links_rest_interceptors(null_intercept post.assert_called_once() -def test_list_display_video360_advertiser_links_rest_bad_request( +def test_approve_display_video360_advertiser_link_proposal_rest_bad_request( transport: str = "rest", - request_type=analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, + request_type=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -49568,7 +50719,9 @@ def test_list_display_video360_advertiser_links_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = { + "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -49580,195 +50733,70 @@ def test_list_display_video360_advertiser_links_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_display_video360_advertiser_links(request) - - -def test_list_display_video360_advertiser_links_rest_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() - - # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} - - # get truthy value for each flattened field - mock_args = dict( - parent="parent_value", - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.list_display_video360_advertiser_links(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/displayVideo360AdvertiserLinks" - % client.transport._host, - args[1], - ) - - -def test_list_display_video360_advertiser_links_rest_flattened_error( - transport: str = "rest", -): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_display_video360_advertiser_links( - analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(), - parent="parent_value", - ) + client.approve_display_video360_advertiser_link_proposal(request) -def test_list_display_video360_advertiser_links_rest_pager(transport: str = "rest"): +def test_approve_display_video360_advertiser_link_proposal_rest_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[], - next_page_token="def", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( - display_video_360_advertiser_links=[ - resources.DisplayVideo360AdvertiserLink(), - resources.DisplayVideo360AdvertiserLink(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListDisplayVideo360AdvertiserLinksResponse.to_json(x) - for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "properties/sample1"} - - pager = client.list_display_video360_advertiser_links(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all( - isinstance(i, resources.DisplayVideo360AdvertiserLink) for i in results - ) - - pages = list( - client.list_display_video360_advertiser_links(request=sample_request).pages - ) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, + analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, dict, ], ) -def test_create_display_video360_advertiser_link_rest(request_type): +def test_cancel_display_video360_advertiser_link_proposal_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["display_video_360_advertiser_link"] = { - "name": "name_value", - "advertiser_id": "advertiser_id_value", - "advertiser_display_name": "advertiser_display_name_value", - "ads_personalization_enabled": {"value": True}, - "campaign_data_sharing_enabled": {}, - "cost_data_sharing_enabled": {}, + request_init = { + "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLink( + return_value = resources.DisplayVideo360AdvertiserLinkProposal( name="name_value", advertiser_id="advertiser_id_value", advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_display_video360_advertiser_link(request) + response = client.cancel_display_video360_advertiser_link_proposal(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) assert response.name == "name_value" assert response.advertiser_id == "advertiser_id_value" assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" -def test_create_display_video360_advertiser_link_rest_required_fields( - request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, +def test_cancel_display_video360_advertiser_link_proposal_rest_required_fields( + request_type=analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -49783,25 +50811,25 @@ def test_create_display_video360_advertiser_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_display_video360_advertiser_link._get_unset_required_fields( + ).cancel_display_video360_advertiser_link_proposal._get_unset_required_fields( jsonified_request ) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_display_video360_advertiser_link._get_unset_required_fields( + ).cancel_display_video360_advertiser_link_proposal._get_unset_required_fields( jsonified_request ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -49810,7 +50838,7 @@ def test_create_display_video360_advertiser_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLink() + return_value = resources.DisplayVideo360AdvertiserLinkProposal() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -49831,40 +50859,37 @@ def test_create_display_video360_advertiser_link_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_display_video360_advertiser_link(request) + response = client.cancel_display_video360_advertiser_link_proposal(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_display_video360_advertiser_link_rest_unset_required_fields(): +def test_cancel_display_video360_advertiser_link_proposal_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.create_display_video360_advertiser_link._get_unset_required_fields({}) - ) - assert set(unset_fields) == ( - set(()) - & set( - ( - "parent", - "displayVideo360AdvertiserLink", - ) - ) + unset_fields = transport.cancel_display_video360_advertiser_link_proposal._get_unset_required_fields( + {} ) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_display_video360_advertiser_link_rest_interceptors(null_interceptor): +def test_cancel_display_video360_advertiser_link_proposal_rest_interceptors( + null_interceptor, +): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -49878,15 +50903,17 @@ def test_create_display_video360_advertiser_link_rest_interceptors(null_intercep path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_create_display_video360_advertiser_link", + "post_cancel_display_video360_advertiser_link_proposal", ) as post, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "pre_create_display_video360_advertiser_link", + "pre_cancel_display_video360_advertiser_link_proposal", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest.pb( - analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() + pb_message = ( + analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest.pb( + analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() + ) ) transcode.return_value = { "method": "post", @@ -49898,128 +50925,60 @@ def test_create_display_video360_advertiser_link_rest_interceptors(null_intercep req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.DisplayVideo360AdvertiserLink.to_json( - resources.DisplayVideo360AdvertiserLink() + req.return_value._content = ( + resources.DisplayVideo360AdvertiserLinkProposal.to_json( + resources.DisplayVideo360AdvertiserLinkProposal() + ) ) - request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() + request = analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = resources.DisplayVideo360AdvertiserLink() - - client.create_display_video360_advertiser_link( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_create_display_video360_advertiser_link_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, -): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["display_video_360_advertiser_link"] = { - "name": "name_value", - "advertiser_id": "advertiser_id_value", - "advertiser_display_name": "advertiser_display_name_value", - "ads_personalization_enabled": {"value": True}, - "campaign_data_sharing_enabled": {}, - "cost_data_sharing_enabled": {}, - } - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.create_display_video360_advertiser_link(request) - - -def test_create_display_video360_advertiser_link_rest_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLink() - - # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} - - # get truthy value for each flattened field - mock_args = dict( - parent="parent_value", - display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( - name="name_value" - ), - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.create_display_video360_advertiser_link(**mock_args) + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = resources.DisplayVideo360AdvertiserLinkProposal() - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/displayVideo360AdvertiserLinks" - % client.transport._host, - args[1], + client.cancel_display_video360_advertiser_link_proposal( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) + pre.assert_called_once() + post.assert_called_once() + -def test_create_display_video360_advertiser_link_rest_flattened_error( +def test_cancel_display_video360_advertiser_link_proposal_rest_bad_request( transport: str = "rest", + request_type=analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_display_video360_advertiser_link( - analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(), - parent="parent_value", - display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( - name="name_value" - ), - ) + # send a request that will satisfy transcoding + request_init = { + "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.cancel_display_video360_advertiser_link_proposal(request) -def test_create_display_video360_advertiser_link_rest_error(): +def test_cancel_display_video360_advertiser_link_proposal_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -50028,45 +50987,137 @@ def test_create_display_video360_advertiser_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, + analytics_admin.CreateCustomDimensionRequest, dict, ], ) -def test_delete_display_video360_advertiser_link_rest(request_type): +def test_create_custom_dimension_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/displayVideo360AdvertiserLinks/sample2"} + request_init = {"parent": "properties/sample1"} + request_init["custom_dimension"] = { + "name": "name_value", + "parameter_name": "parameter_name_value", + "display_name": "display_name_value", + "description": "description_value", + "scope": 1, + "disallow_ads_personalization": True, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateCustomDimensionRequest.meta.fields[ + "custom_dimension" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["custom_dimension"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["custom_dimension"][field])): + del request_init["custom_dimension"][field][i][subfield] + else: + del request_init["custom_dimension"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.CustomDimension( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_display_video360_advertiser_link(request) + response = client.create_custom_dimension(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.CustomDimension) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True -def test_delete_display_video360_advertiser_link_rest_required_fields( - request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, +def test_create_custom_dimension_rest_required_fields( + request_type=analytics_admin.CreateCustomDimensionRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -50081,25 +51132,21 @@ def test_delete_display_video360_advertiser_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_display_video360_advertiser_link._get_unset_required_fields( - jsonified_request - ) + ).create_custom_dimension._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_display_video360_advertiser_link._get_unset_required_fields( - jsonified_request - ) + ).create_custom_dimension._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -50108,7 +51155,7 @@ def test_delete_display_video360_advertiser_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.CustomDimension() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -50120,38 +51167,48 @@ def test_delete_display_video360_advertiser_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_display_video360_advertiser_link(request) + response = client.create_custom_dimension(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_display_video360_advertiser_link_rest_unset_required_fields(): +def test_create_custom_dimension_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.delete_display_video360_advertiser_link._get_unset_required_fields({}) + unset_fields = transport.create_custom_dimension._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "customDimension", + ) + ) ) - assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_display_video360_advertiser_link_rest_interceptors(null_interceptor): +def test_create_custom_dimension_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -50164,12 +51221,14 @@ def test_delete_display_video360_advertiser_link_rest_interceptors(null_intercep ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_delete_display_video360_advertiser_link", + transports.AnalyticsAdminServiceRestInterceptor, "post_create_custom_dimension" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_custom_dimension" ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest.pb( - analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() + post.assert_not_called() + pb_message = analytics_admin.CreateCustomDimensionRequest.pb( + analytics_admin.CreateCustomDimensionRequest() ) transcode.return_value = { "method": "post", @@ -50181,15 +51240,19 @@ def test_delete_display_video360_advertiser_link_rest_interceptors(null_intercep req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = resources.CustomDimension.to_json( + resources.CustomDimension() + ) - request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() + request = analytics_admin.CreateCustomDimensionRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = resources.CustomDimension() - client.delete_display_video360_advertiser_link( + client.create_custom_dimension( request, metadata=[ ("key", "val"), @@ -50198,11 +51261,11 @@ def test_delete_display_video360_advertiser_link_rest_interceptors(null_intercep ) pre.assert_called_once() + post.assert_called_once() -def test_delete_display_video360_advertiser_link_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, +def test_create_custom_dimension_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateCustomDimensionRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -50210,7 +51273,7 @@ def test_delete_display_video360_advertiser_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/displayVideo360AdvertiserLinks/sample2"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -50222,10 +51285,10 @@ def test_delete_display_video360_advertiser_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_display_video360_advertiser_link(request) + client.create_custom_dimension(request) -def test_delete_display_video360_advertiser_link_rest_flattened(): +def test_create_custom_dimension_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -50234,42 +51297,41 @@ def test_delete_display_video360_advertiser_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.CustomDimension() # get arguments that satisfy an http rule for this method - sample_request = { - "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2" - } + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", + custom_dimension=resources.CustomDimension(name="name_value"), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.delete_display_video360_advertiser_link(**mock_args) + client.create_custom_dimension(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/displayVideo360AdvertiserLinks/*}" + "%s/v1alpha/{parent=properties/*}/customDimensions" % client.transport._host, args[1], ) -def test_delete_display_video360_advertiser_link_rest_flattened_error( - transport: str = "rest", -): +def test_create_custom_dimension_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -50278,13 +51340,14 @@ def test_delete_display_video360_advertiser_link_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_display_video360_advertiser_link( - analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(), - name="name_value", + client.create_custom_dimension( + analytics_admin.CreateCustomDimensionRequest(), + parent="parent_value", + custom_dimension=resources.CustomDimension(name="name_value"), ) -def test_delete_display_video360_advertiser_link_rest_error(): +def test_create_custom_dimension_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -50293,11 +51356,11 @@ def test_delete_display_video360_advertiser_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, + analytics_admin.UpdateCustomDimensionRequest, dict, ], ) -def test_update_display_video360_advertiser_link_rest(request_type): +def test_update_custom_dimension_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -50305,48 +51368,122 @@ def test_update_display_video360_advertiser_link_rest(request_type): # send a request that will satisfy transcoding request_init = { - "display_video_360_advertiser_link": { - "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2" - } + "custom_dimension": {"name": "properties/sample1/customDimensions/sample2"} } - request_init["display_video_360_advertiser_link"] = { - "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2", - "advertiser_id": "advertiser_id_value", - "advertiser_display_name": "advertiser_display_name_value", - "ads_personalization_enabled": {"value": True}, - "campaign_data_sharing_enabled": {}, - "cost_data_sharing_enabled": {}, + request_init["custom_dimension"] = { + "name": "properties/sample1/customDimensions/sample2", + "parameter_name": "parameter_name_value", + "display_name": "display_name_value", + "description": "description_value", + "scope": 1, + "disallow_ads_personalization": True, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateCustomDimensionRequest.meta.fields[ + "custom_dimension" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["custom_dimension"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["custom_dimension"][field])): + del request_init["custom_dimension"][field][i][subfield] + else: + del request_init["custom_dimension"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLink( + return_value = resources.CustomDimension( name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_display_video360_advertiser_link(request) + response = client.update_custom_dimension(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert isinstance(response, resources.CustomDimension) assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True -def test_update_display_video360_advertiser_link_rest_required_fields( - request_type=analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, +def test_update_custom_dimension_rest_required_fields( + request_type=analytics_admin.UpdateCustomDimensionRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -50365,18 +51502,14 @@ def test_update_display_video360_advertiser_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_display_video360_advertiser_link._get_unset_required_fields( - jsonified_request - ) + ).update_custom_dimension._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_display_video360_advertiser_link._get_unset_required_fields( - jsonified_request - ) + ).update_custom_dimension._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) @@ -50390,7 +51523,7 @@ def test_update_display_video360_advertiser_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLink() + return_value = resources.CustomDimension() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -50411,32 +51544,31 @@ def test_update_display_video360_advertiser_link_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_display_video360_advertiser_link(request) + response = client.update_custom_dimension(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_display_video360_advertiser_link_rest_unset_required_fields(): +def test_update_custom_dimension_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.update_display_video360_advertiser_link._get_unset_required_fields({}) - ) + unset_fields = transport.update_custom_dimension._get_unset_required_fields({}) assert set(unset_fields) == (set(("updateMask",)) & set(("updateMask",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_display_video360_advertiser_link_rest_interceptors(null_interceptor): +def test_update_custom_dimension_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -50449,16 +51581,14 @@ def test_update_display_video360_advertiser_link_rest_interceptors(null_intercep ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_update_display_video360_advertiser_link", + transports.AnalyticsAdminServiceRestInterceptor, "post_update_custom_dimension" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_update_display_video360_advertiser_link", + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_custom_dimension" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest.pb( - analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() + pb_message = analytics_admin.UpdateCustomDimensionRequest.pb( + analytics_admin.UpdateCustomDimensionRequest() ) transcode.return_value = { "method": "post", @@ -50470,19 +51600,19 @@ def test_update_display_video360_advertiser_link_rest_interceptors(null_intercep req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.DisplayVideo360AdvertiserLink.to_json( - resources.DisplayVideo360AdvertiserLink() + req.return_value._content = resources.CustomDimension.to_json( + resources.CustomDimension() ) - request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() + request = analytics_admin.UpdateCustomDimensionRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.DisplayVideo360AdvertiserLink() + post.return_value = resources.CustomDimension() - client.update_display_video360_advertiser_link( + client.update_custom_dimension( request, metadata=[ ("key", "val"), @@ -50494,9 +51624,8 @@ def test_update_display_video360_advertiser_link_rest_interceptors(null_intercep post.assert_called_once() -def test_update_display_video360_advertiser_link_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, +def test_update_custom_dimension_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateCustomDimensionRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -50505,17 +51634,7 @@ def test_update_display_video360_advertiser_link_rest_bad_request( # send a request that will satisfy transcoding request_init = { - "display_video_360_advertiser_link": { - "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2" - } - } - request_init["display_video_360_advertiser_link"] = { - "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2", - "advertiser_id": "advertiser_id_value", - "advertiser_display_name": "advertiser_display_name_value", - "ads_personalization_enabled": {"value": True}, - "campaign_data_sharing_enabled": {}, - "cost_data_sharing_enabled": {}, + "custom_dimension": {"name": "properties/sample1/customDimensions/sample2"} } request = request_type(**request_init) @@ -50528,10 +51647,10 @@ def test_update_display_video360_advertiser_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_display_video360_advertiser_link(request) + client.update_custom_dimension(request) -def test_update_display_video360_advertiser_link_rest_flattened(): +def test_update_custom_dimension_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -50540,20 +51659,16 @@ def test_update_display_video360_advertiser_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLink() + return_value = resources.CustomDimension() # get arguments that satisfy an http rule for this method sample_request = { - "display_video_360_advertiser_link": { - "name": "properties/sample1/displayVideo360AdvertiserLinks/sample2" - } + "custom_dimension": {"name": "properties/sample1/customDimensions/sample2"} } # get truthy value for each flattened field mock_args = dict( - display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( - name="name_value" - ), + custom_dimension=resources.CustomDimension(name="name_value"), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) @@ -50561,27 +51676,26 @@ def test_update_display_video360_advertiser_link_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_display_video360_advertiser_link(**mock_args) + client.update_custom_dimension(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{display_video_360_advertiser_link.name=properties/*/displayVideo360AdvertiserLinks/*}" + "%s/v1alpha/{custom_dimension.name=properties/*/customDimensions/*}" % client.transport._host, args[1], ) -def test_update_display_video360_advertiser_link_rest_flattened_error( - transport: str = "rest", -): +def test_update_custom_dimension_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -50590,16 +51704,14 @@ def test_update_display_video360_advertiser_link_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_display_video360_advertiser_link( - analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(), - display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( - name="name_value" - ), + client.update_custom_dimension( + analytics_admin.UpdateCustomDimensionRequest(), + custom_dimension=resources.CustomDimension(name="name_value"), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_update_display_video360_advertiser_link_rest_error(): +def test_update_custom_dimension_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -50608,59 +51720,50 @@ def test_update_display_video360_advertiser_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, + analytics_admin.ListCustomDimensionsRequest, dict, ], ) -def test_get_display_video360_advertiser_link_proposal_rest(request_type): +def test_list_custom_dimensions_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLinkProposal( - name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - validation_email="validation_email_value", + return_value = analytics_admin.ListCustomDimensionsResponse( + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListCustomDimensionsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_display_video360_advertiser_link_proposal(request) + response = client.list_custom_dimensions(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) - assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" - assert response.validation_email == "validation_email_value" + assert isinstance(response, pagers.ListCustomDimensionsPager) + assert response.next_page_token == "next_page_token_value" -def test_get_display_video360_advertiser_link_proposal_rest_required_fields( - request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, +def test_list_custom_dimensions_rest_required_fields( + request_type=analytics_admin.ListCustomDimensionsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -50675,25 +51778,28 @@ def test_get_display_video360_advertiser_link_proposal_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_display_video360_advertiser_link_proposal._get_unset_required_fields( - jsonified_request - ) + ).list_custom_dimensions._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_display_video360_advertiser_link_proposal._get_unset_required_fields( - jsonified_request + ).list_custom_dimensions._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -50702,7 +51808,7 @@ def test_get_display_video360_advertiser_link_proposal_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLinkProposal() + return_value = analytics_admin.ListCustomDimensionsResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -50722,36 +51828,39 @@ def test_get_display_video360_advertiser_link_proposal_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListCustomDimensionsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_display_video360_advertiser_link_proposal(request) + response = client.list_custom_dimensions(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_display_video360_advertiser_link_proposal_rest_unset_required_fields(): +def test_list_custom_dimensions_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_display_video360_advertiser_link_proposal._get_unset_required_fields( - {} + unset_fields = transport.list_custom_dimensions._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "pageSize", + "pageToken", + ) + ) + & set(("parent",)) ) - assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_display_video360_advertiser_link_proposal_rest_interceptors( - null_interceptor, -): +def test_list_custom_dimensions_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -50764,16 +51873,14 @@ def test_get_display_video360_advertiser_link_proposal_rest_interceptors( ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_get_display_video360_advertiser_link_proposal", + transports.AnalyticsAdminServiceRestInterceptor, "post_list_custom_dimensions" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_get_display_video360_advertiser_link_proposal", + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_custom_dimensions" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest.pb( - analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() + pb_message = analytics_admin.ListCustomDimensionsRequest.pb( + analytics_admin.ListCustomDimensionsRequest() ) transcode.return_value = { "method": "post", @@ -50786,20 +51893,20 @@ def test_get_display_video360_advertiser_link_proposal_rest_interceptors( req.return_value.status_code = 200 req.return_value.request = PreparedRequest() req.return_value._content = ( - resources.DisplayVideo360AdvertiserLinkProposal.to_json( - resources.DisplayVideo360AdvertiserLinkProposal() + analytics_admin.ListCustomDimensionsResponse.to_json( + analytics_admin.ListCustomDimensionsResponse() ) ) - request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.ListCustomDimensionsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + post.return_value = analytics_admin.ListCustomDimensionsResponse() - client.get_display_video360_advertiser_link_proposal( + client.list_custom_dimensions( request, metadata=[ ("key", "val"), @@ -50811,9 +51918,8 @@ def test_get_display_video360_advertiser_link_proposal_rest_interceptors( post.assert_called_once() -def test_get_display_video360_advertiser_link_proposal_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, +def test_list_custom_dimensions_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListCustomDimensionsRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -50821,9 +51927,7 @@ def test_get_display_video360_advertiser_link_proposal_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -50835,10 +51939,10 @@ def test_get_display_video360_advertiser_link_proposal_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_display_video360_advertiser_link_proposal(request) + client.list_custom_dimensions(request) -def test_get_display_video360_advertiser_link_proposal_rest_flattened(): +def test_list_custom_dimensions_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -50847,117 +51951,159 @@ def test_get_display_video360_advertiser_link_proposal_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLinkProposal() + return_value = analytics_admin.ListCustomDimensionsResponse() # get arguments that satisfy an http rule for this method - sample_request = { - "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" - } + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListCustomDimensionsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_display_video360_advertiser_link_proposal(**mock_args) + client.list_custom_dimensions(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/displayVideo360AdvertiserLinkProposals/*}" + "%s/v1alpha/{parent=properties/*}/customDimensions" % client.transport._host, args[1], ) -def test_get_display_video360_advertiser_link_proposal_rest_flattened_error( - transport: str = "rest", -): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) +def test_list_custom_dimensions_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_custom_dimensions( + analytics_admin.ListCustomDimensionsRequest(), + parent="parent_value", + ) + + +def test_list_custom_dimensions_rest_pager(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + resources.CustomDimension(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[], + next_page_token="def", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + ], + next_page_token="ghi", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListCustomDimensionsResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "properties/sample1"} - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_display_video360_advertiser_link_proposal( - analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest(), - name="name_value", - ) + pager = client.list_custom_dimensions(request=sample_request) + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.CustomDimension) for i in results) -def test_get_display_video360_advertiser_link_proposal_rest_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) + pages = list(client.list_custom_dimensions(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, + analytics_admin.ArchiveCustomDimensionRequest, dict, ], ) -def test_list_display_video360_advertiser_link_proposals_rest(request_type): +def test_archive_custom_dimension_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = {"name": "properties/sample1/customDimensions/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - next_page_token="next_page_token_value", - ) - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse.pb( - return_value - ) - ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_display_video360_advertiser_link_proposals(request) + response = client.archive_custom_dimension(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinkProposalsPager) - assert response.next_page_token == "next_page_token_value" + assert response is None -def test_list_display_video360_advertiser_link_proposals_rest_required_fields( - request_type=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, +def test_archive_custom_dimension_rest_required_fields( + request_type=analytics_admin.ArchiveCustomDimensionRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -50972,32 +52118,21 @@ def test_list_display_video360_advertiser_link_proposals_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_display_video360_advertiser_link_proposals._get_unset_required_fields( - jsonified_request - ) + ).archive_custom_dimension._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_display_video360_advertiser_link_proposals._get_unset_required_fields( - jsonified_request - ) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) - ) + ).archive_custom_dimension._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -51006,7 +52141,7 @@ def test_list_display_video360_advertiser_link_proposals_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -51018,54 +52153,37 @@ def test_list_display_video360_advertiser_link_proposals_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse.pb( - return_value - ) - ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_display_video360_advertiser_link_proposals(request) + response = client.archive_custom_dimension(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_display_video360_advertiser_link_proposals_rest_unset_required_fields(): +def test_archive_custom_dimension_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_display_video360_advertiser_link_proposals._get_unset_required_fields( - {} - ) - assert set(unset_fields) == ( - set( - ( - "pageSize", - "pageToken", - ) - ) - & set(("parent",)) - ) + unset_fields = transport.archive_custom_dimension._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_display_video360_advertiser_link_proposals_rest_interceptors( - null_interceptor, -): +def test_archive_custom_dimension_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -51078,18 +52196,11 @@ def test_list_display_video360_advertiser_link_proposals_rest_interceptors( ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_list_display_video360_advertiser_link_proposals", - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_list_display_video360_advertiser_link_proposals", + transports.AnalyticsAdminServiceRestInterceptor, "pre_archive_custom_dimension" ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest.pb( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() - ) + pb_message = analytics_admin.ArchiveCustomDimensionRequest.pb( + analytics_admin.ArchiveCustomDimensionRequest() ) transcode.return_value = { "method": "post", @@ -51101,23 +52212,15 @@ def test_list_display_video360_advertiser_link_proposals_rest_interceptors( req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse.to_json( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() - ) - ) - request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() + request = analytics_admin.ArchiveCustomDimensionRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() - ) - client.list_display_video360_advertiser_link_proposals( + client.archive_custom_dimension( request, metadata=[ ("key", "val"), @@ -51126,12 +52229,10 @@ def test_list_display_video360_advertiser_link_proposals_rest_interceptors( ) pre.assert_called_once() - post.assert_called_once() -def test_list_display_video360_advertiser_link_proposals_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, +def test_archive_custom_dimension_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ArchiveCustomDimensionRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -51139,7 +52240,7 @@ def test_list_display_video360_advertiser_link_proposals_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = {"name": "properties/sample1/customDimensions/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -51151,10 +52252,10 @@ def test_list_display_video360_advertiser_link_proposals_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_display_video360_advertiser_link_proposals(request) + client.archive_custom_dimension(request) -def test_list_display_video360_advertiser_link_proposals_rest_flattened(): +def test_archive_custom_dimension_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -51163,47 +52264,38 @@ def test_list_display_video360_advertiser_link_proposals_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() - ) + return_value = None # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = {"name": "properties/sample1/customDimensions/sample2"} # get truthy value for each flattened field mock_args = dict( - parent="parent_value", + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse.pb( - return_value - ) - ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_display_video360_advertiser_link_proposals(**mock_args) + client.archive_custom_dimension(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/displayVideo360AdvertiserLinkProposals" + "%s/v1alpha/{name=properties/*/customDimensions/*}:archive" % client.transport._host, args[1], ) -def test_list_display_video360_advertiser_link_proposals_rest_flattened_error( - transport: str = "rest", -): +def test_archive_custom_dimension_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -51212,157 +52304,75 @@ def test_list_display_video360_advertiser_link_proposals_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_display_video360_advertiser_link_proposals( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest(), - parent="parent_value", + client.archive_custom_dimension( + analytics_admin.ArchiveCustomDimensionRequest(), + name="name_value", ) -def test_list_display_video360_advertiser_link_proposals_rest_pager( - transport: str = "rest", -): +def test_archive_custom_dimension_rest_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - ], - next_page_token="abc", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[], - next_page_token="def", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - ], - next_page_token="ghi", - ), - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( - display_video_360_advertiser_link_proposals=[ - resources.DisplayVideo360AdvertiserLinkProposal(), - resources.DisplayVideo360AdvertiserLinkProposal(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse.to_json( - x - ) - for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "properties/sample1"} - - pager = client.list_display_video360_advertiser_link_proposals( - request=sample_request - ) - - results = list(pager) - assert len(results) == 6 - assert all( - isinstance(i, resources.DisplayVideo360AdvertiserLinkProposal) - for i in results - ) - - pages = list( - client.list_display_video360_advertiser_link_proposals( - request=sample_request - ).pages - ) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, + analytics_admin.GetCustomDimensionRequest, dict, ], ) -def test_create_display_video360_advertiser_link_proposal_rest(request_type): +def test_get_custom_dimension_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["display_video_360_advertiser_link_proposal"] = { - "name": "name_value", - "advertiser_id": "advertiser_id_value", - "link_proposal_status_details": { - "link_proposal_initiating_product": 1, - "requestor_email": "requestor_email_value", - "link_proposal_state": 1, - }, - "advertiser_display_name": "advertiser_display_name_value", - "validation_email": "validation_email_value", - "ads_personalization_enabled": {"value": True}, - "campaign_data_sharing_enabled": {}, - "cost_data_sharing_enabled": {}, - } + request_init = {"name": "properties/sample1/customDimensions/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLinkProposal( + return_value = resources.CustomDimension( name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - validation_email="validation_email_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_display_video360_advertiser_link_proposal(request) + response = client.get_custom_dimension(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) + assert isinstance(response, resources.CustomDimension) assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" - assert response.validation_email == "validation_email_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True -def test_create_display_video360_advertiser_link_proposal_rest_required_fields( - request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, +def test_get_custom_dimension_rest_required_fields( + request_type=analytics_admin.GetCustomDimensionRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -51377,25 +52387,21 @@ def test_create_display_video360_advertiser_link_proposal_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_display_video360_advertiser_link_proposal._get_unset_required_fields( - jsonified_request - ) + ).get_custom_dimension._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_display_video360_advertiser_link_proposal._get_unset_required_fields( - jsonified_request - ) + ).get_custom_dimension._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -51404,7 +52410,7 @@ def test_create_display_video360_advertiser_link_proposal_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLinkProposal() + return_value = resources.CustomDimension() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -51416,53 +52422,39 @@ def test_create_display_video360_advertiser_link_proposal_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_display_video360_advertiser_link_proposal(request) + response = client.get_custom_dimension(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_display_video360_advertiser_link_proposal_rest_unset_required_fields(): +def test_get_custom_dimension_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_display_video360_advertiser_link_proposal._get_unset_required_fields( - {} - ) - assert set(unset_fields) == ( - set(()) - & set( - ( - "parent", - "displayVideo360AdvertiserLinkProposal", - ) - ) - ) + unset_fields = transport.get_custom_dimension._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_display_video360_advertiser_link_proposal_rest_interceptors( - null_interceptor, -): +def test_get_custom_dimension_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -51475,18 +52467,14 @@ def test_create_display_video360_advertiser_link_proposal_rest_interceptors( ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_create_display_video360_advertiser_link_proposal", + transports.AnalyticsAdminServiceRestInterceptor, "post_get_custom_dimension" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_create_display_video360_advertiser_link_proposal", + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_custom_dimension" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = ( - analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest.pb( - analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() - ) + pb_message = analytics_admin.GetCustomDimensionRequest.pb( + analytics_admin.GetCustomDimensionRequest() ) transcode.return_value = { "method": "post", @@ -51498,21 +52486,19 @@ def test_create_display_video360_advertiser_link_proposal_rest_interceptors( req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - resources.DisplayVideo360AdvertiserLinkProposal.to_json( - resources.DisplayVideo360AdvertiserLinkProposal() - ) + req.return_value._content = resources.CustomDimension.to_json( + resources.CustomDimension() ) - request = analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.GetCustomDimensionRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + post.return_value = resources.CustomDimension() - client.create_display_video360_advertiser_link_proposal( + client.get_custom_dimension( request, metadata=[ ("key", "val"), @@ -51524,9 +52510,8 @@ def test_create_display_video360_advertiser_link_proposal_rest_interceptors( post.assert_called_once() -def test_create_display_video360_advertiser_link_proposal_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, +def test_get_custom_dimension_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetCustomDimensionRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -51534,21 +52519,7 @@ def test_create_display_video360_advertiser_link_proposal_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["display_video_360_advertiser_link_proposal"] = { - "name": "name_value", - "advertiser_id": "advertiser_id_value", - "link_proposal_status_details": { - "link_proposal_initiating_product": 1, - "requestor_email": "requestor_email_value", - "link_proposal_state": 1, - }, - "advertiser_display_name": "advertiser_display_name_value", - "validation_email": "validation_email_value", - "ads_personalization_enabled": {"value": True}, - "campaign_data_sharing_enabled": {}, - "cost_data_sharing_enabled": {}, - } + request_init = {"name": "properties/sample1/customDimensions/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -51560,10 +52531,10 @@ def test_create_display_video360_advertiser_link_proposal_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_display_video360_advertiser_link_proposal(request) + client.get_custom_dimension(request) -def test_create_display_video360_advertiser_link_proposal_rest_flattened(): +def test_get_custom_dimension_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -51572,46 +52543,40 @@ def test_create_display_video360_advertiser_link_proposal_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLinkProposal() + return_value = resources.CustomDimension() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = {"name": "properties/sample1/customDimensions/sample2"} # get truthy value for each flattened field mock_args = dict( - parent="parent_value", - display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( - name="name_value" - ), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_display_video360_advertiser_link_proposal(**mock_args) + client.get_custom_dimension(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/displayVideo360AdvertiserLinkProposals" + "%s/v1alpha/{name=properties/*/customDimensions/*}" % client.transport._host, args[1], ) -def test_create_display_video360_advertiser_link_proposal_rest_flattened_error( - transport: str = "rest", -): +def test_get_custom_dimension_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -51620,16 +52585,13 @@ def test_create_display_video360_advertiser_link_proposal_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_display_video360_advertiser_link_proposal( - analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest(), - parent="parent_value", - display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( - name="name_value" - ), + client.get_custom_dimension( + analytics_admin.GetCustomDimensionRequest(), + name="name_value", ) -def test_create_display_video360_advertiser_link_proposal_rest_error(): +def test_get_custom_dimension_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -51638,47 +52600,142 @@ def test_create_display_video360_advertiser_link_proposal_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, + analytics_admin.CreateCustomMetricRequest, dict, ], ) -def test_delete_display_video360_advertiser_link_proposal_rest(request_type): +def test_create_custom_metric_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" + request_init = {"parent": "properties/sample1"} + request_init["custom_metric"] = { + "name": "name_value", + "parameter_name": "parameter_name_value", + "display_name": "display_name_value", + "description": "description_value", + "measurement_unit": 1, + "scope": 1, + "restricted_metric_type": [1], } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateCustomMetricRequest.meta.fields["custom_metric"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["custom_metric"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["custom_metric"][field])): + del request_init["custom_metric"][field][i][subfield] + else: + del request_init["custom_metric"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.CustomMetric( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + restricted_metric_type=[ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ], + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_display_video360_advertiser_link_proposal(request) + response = client.create_custom_metric(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.CustomMetric) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert response.restricted_metric_type == [ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ] -def test_delete_display_video360_advertiser_link_proposal_rest_required_fields( - request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, +def test_create_custom_metric_rest_required_fields( + request_type=analytics_admin.CreateCustomMetricRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -51693,25 +52750,21 @@ def test_delete_display_video360_advertiser_link_proposal_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_display_video360_advertiser_link_proposal._get_unset_required_fields( - jsonified_request - ) + ).create_custom_metric._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_display_video360_advertiser_link_proposal._get_unset_required_fields( - jsonified_request - ) + ).create_custom_metric._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -51720,7 +52773,7 @@ def test_delete_display_video360_advertiser_link_proposal_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.CustomMetric() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -51732,40 +52785,48 @@ def test_delete_display_video360_advertiser_link_proposal_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_display_video360_advertiser_link_proposal(request) + response = client.create_custom_metric(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_display_video360_advertiser_link_proposal_rest_unset_required_fields(): +def test_create_custom_metric_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_display_video360_advertiser_link_proposal._get_unset_required_fields( - {} + unset_fields = transport.create_custom_metric._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "customMetric", + ) + ) ) - assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_display_video360_advertiser_link_proposal_rest_interceptors( - null_interceptor, -): +def test_create_custom_metric_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -51778,14 +52839,14 @@ def test_delete_display_video360_advertiser_link_proposal_rest_interceptors( ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_delete_display_video360_advertiser_link_proposal", + transports.AnalyticsAdminServiceRestInterceptor, "post_create_custom_metric" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_custom_metric" ) as pre: pre.assert_not_called() - pb_message = ( - analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest.pb( - analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() - ) + post.assert_not_called() + pb_message = analytics_admin.CreateCustomMetricRequest.pb( + analytics_admin.CreateCustomMetricRequest() ) transcode.return_value = { "method": "post", @@ -51797,15 +52858,19 @@ def test_delete_display_video360_advertiser_link_proposal_rest_interceptors( req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = resources.CustomMetric.to_json( + resources.CustomMetric() + ) - request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.CreateCustomMetricRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = resources.CustomMetric() - client.delete_display_video360_advertiser_link_proposal( + client.create_custom_metric( request, metadata=[ ("key", "val"), @@ -51814,11 +52879,11 @@ def test_delete_display_video360_advertiser_link_proposal_rest_interceptors( ) pre.assert_called_once() + post.assert_called_once() -def test_delete_display_video360_advertiser_link_proposal_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, +def test_create_custom_metric_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateCustomMetricRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -51826,9 +52891,7 @@ def test_delete_display_video360_advertiser_link_proposal_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -51840,10 +52903,10 @@ def test_delete_display_video360_advertiser_link_proposal_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_display_video360_advertiser_link_proposal(request) + client.create_custom_metric(request) -def test_delete_display_video360_advertiser_link_proposal_rest_flattened(): +def test_create_custom_metric_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -51852,42 +52915,40 @@ def test_delete_display_video360_advertiser_link_proposal_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.CustomMetric() # get arguments that satisfy an http rule for this method - sample_request = { - "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" - } + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", + custom_metric=resources.CustomMetric(name="name_value"), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.delete_display_video360_advertiser_link_proposal(**mock_args) + client.create_custom_metric(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/displayVideo360AdvertiserLinkProposals/*}" - % client.transport._host, + "%s/v1alpha/{parent=properties/*}/customMetrics" % client.transport._host, args[1], ) -def test_delete_display_video360_advertiser_link_proposal_rest_flattened_error( - transport: str = "rest", -): +def test_create_custom_metric_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -51896,13 +52957,14 @@ def test_delete_display_video360_advertiser_link_proposal_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_display_video360_advertiser_link_proposal( - analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest(), - name="name_value", + client.create_custom_metric( + analytics_admin.CreateCustomMetricRequest(), + parent="parent_value", + custom_metric=resources.CustomMetric(name="name_value"), ) -def test_delete_display_video360_advertiser_link_proposal_rest_error(): +def test_create_custom_metric_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -51911,11 +52973,11 @@ def test_delete_display_video360_advertiser_link_proposal_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, + analytics_admin.UpdateCustomMetricRequest, dict, ], ) -def test_approve_display_video360_advertiser_link_proposal_rest(request_type): +def test_update_custom_metric_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -51923,44 +52985,131 @@ def test_approve_display_video360_advertiser_link_proposal_rest(request_type): # send a request that will satisfy transcoding request_init = { - "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" + "custom_metric": {"name": "properties/sample1/customMetrics/sample2"} + } + request_init["custom_metric"] = { + "name": "properties/sample1/customMetrics/sample2", + "parameter_name": "parameter_name_value", + "display_name": "display_name_value", + "description": "description_value", + "measurement_unit": 1, + "scope": 1, + "restricted_metric_type": [1], } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateCustomMetricRequest.meta.fields["custom_metric"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["custom_metric"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["custom_metric"][field])): + del request_init["custom_metric"][field][i][subfield] + else: + del request_init["custom_metric"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = ( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() + return_value = resources.CustomMetric( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + restricted_metric_type=[ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ], ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = ( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse.pb( - return_value - ) - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.approve_display_video360_advertiser_link_proposal(request) + response = client.update_custom_metric(request) # Establish that the response is the type that we expect. - assert isinstance( - response, analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse - ) + assert isinstance(response, resources.CustomMetric) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert response.restricted_metric_type == [ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ] -def test_approve_display_video360_advertiser_link_proposal_rest_required_fields( - request_type=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, +def test_update_custom_metric_rest_required_fields( + request_type=analytics_admin.UpdateCustomMetricRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -51975,25 +53124,19 @@ def test_approve_display_video360_advertiser_link_proposal_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).approve_display_video360_advertiser_link_proposal._get_unset_required_fields( - jsonified_request - ) + ).update_custom_metric._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).approve_display_video360_advertiser_link_proposal._get_unset_required_fields( - jsonified_request - ) + ).update_custom_metric._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -52002,9 +53145,7 @@ def test_approve_display_video360_advertiser_link_proposal_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = ( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() - ) + return_value = resources.CustomMetric() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -52016,7 +53157,7 @@ def test_approve_display_video360_advertiser_link_proposal_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "patch", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -52025,38 +53166,31 @@ def test_approve_display_video360_advertiser_link_proposal_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = ( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse.pb( - return_value - ) - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.approve_display_video360_advertiser_link_proposal(request) + response = client.update_custom_metric(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_approve_display_video360_advertiser_link_proposal_rest_unset_required_fields(): +def test_update_custom_metric_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.approve_display_video360_advertiser_link_proposal._get_unset_required_fields( - {} - ) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.update_custom_metric._get_unset_required_fields({}) + assert set(unset_fields) == (set(("updateMask",)) & set(("updateMask",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_approve_display_video360_advertiser_link_proposal_rest_interceptors( - null_interceptor, -): +def test_update_custom_metric_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -52069,18 +53203,14 @@ def test_approve_display_video360_advertiser_link_proposal_rest_interceptors( ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_approve_display_video360_advertiser_link_proposal", + transports.AnalyticsAdminServiceRestInterceptor, "post_update_custom_metric" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_approve_display_video360_advertiser_link_proposal", + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_custom_metric" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = ( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest.pb( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() - ) + pb_message = analytics_admin.UpdateCustomMetricRequest.pb( + analytics_admin.UpdateCustomMetricRequest() ) transcode.return_value = { "method": "post", @@ -52092,21 +53222,19 @@ def test_approve_display_video360_advertiser_link_proposal_rest_interceptors( req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse.to_json( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() + req.return_value._content = resources.CustomMetric.to_json( + resources.CustomMetric() ) - request = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.UpdateCustomMetricRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = ( - analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() - ) + post.return_value = resources.CustomMetric() - client.approve_display_video360_advertiser_link_proposal( + client.update_custom_metric( request, metadata=[ ("key", "val"), @@ -52118,9 +53246,8 @@ def test_approve_display_video360_advertiser_link_proposal_rest_interceptors( post.assert_called_once() -def test_approve_display_video360_advertiser_link_proposal_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, +def test_update_custom_metric_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateCustomMetricRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -52129,7 +53256,7 @@ def test_approve_display_video360_advertiser_link_proposal_rest_bad_request( # send a request that will satisfy transcoding request_init = { - "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" + "custom_metric": {"name": "properties/sample1/customMetrics/sample2"} } request = request_type(**request_init) @@ -52142,10 +53269,71 @@ def test_approve_display_video360_advertiser_link_proposal_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.approve_display_video360_advertiser_link_proposal(request) + client.update_custom_metric(request) -def test_approve_display_video360_advertiser_link_proposal_rest_error(): +def test_update_custom_metric_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resources.CustomMetric() + + # get arguments that satisfy an http rule for this method + sample_request = { + "custom_metric": {"name": "properties/sample1/customMetrics/sample2"} + } + + # get truthy value for each flattened field + mock_args = dict( + custom_metric=resources.CustomMetric(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.update_custom_metric(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{custom_metric.name=properties/*/customMetrics/*}" + % client.transport._host, + args[1], + ) + + +def test_update_custom_metric_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_custom_metric( + analytics_admin.UpdateCustomMetricRequest(), + custom_metric=resources.CustomMetric(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +def test_update_custom_metric_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -52154,59 +53342,50 @@ def test_approve_display_video360_advertiser_link_proposal_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, + analytics_admin.ListCustomMetricsRequest, dict, ], ) -def test_cancel_display_video360_advertiser_link_proposal_rest(request_type): +def test_list_custom_metrics_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLinkProposal( - name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", - validation_email="validation_email_value", + return_value = analytics_admin.ListCustomMetricsResponse( + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListCustomMetricsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.cancel_display_video360_advertiser_link_proposal(request) + response = client.list_custom_metrics(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) - assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" - assert response.validation_email == "validation_email_value" + assert isinstance(response, pagers.ListCustomMetricsPager) + assert response.next_page_token == "next_page_token_value" -def test_cancel_display_video360_advertiser_link_proposal_rest_required_fields( - request_type=analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, +def test_list_custom_metrics_rest_required_fields( + request_type=analytics_admin.ListCustomMetricsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -52221,25 +53400,28 @@ def test_cancel_display_video360_advertiser_link_proposal_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).cancel_display_video360_advertiser_link_proposal._get_unset_required_fields( - jsonified_request - ) + ).list_custom_metrics._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).cancel_display_video360_advertiser_link_proposal._get_unset_required_fields( - jsonified_request + ).list_custom_metrics._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -52248,7 +53430,7 @@ def test_cancel_display_video360_advertiser_link_proposal_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.DisplayVideo360AdvertiserLinkProposal() + return_value = analytics_admin.ListCustomMetricsResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -52260,45 +53442,47 @@ def test_cancel_display_video360_advertiser_link_proposal_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DisplayVideo360AdvertiserLinkProposal.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListCustomMetricsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.cancel_display_video360_advertiser_link_proposal(request) + response = client.list_custom_metrics(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_cancel_display_video360_advertiser_link_proposal_rest_unset_required_fields(): +def test_list_custom_metrics_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.cancel_display_video360_advertiser_link_proposal._get_unset_required_fields( - {} + unset_fields = transport.list_custom_metrics._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "pageSize", + "pageToken", + ) + ) + & set(("parent",)) ) - assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_cancel_display_video360_advertiser_link_proposal_rest_interceptors( - null_interceptor, -): +def test_list_custom_metrics_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -52311,18 +53495,14 @@ def test_cancel_display_video360_advertiser_link_proposal_rest_interceptors( ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_cancel_display_video360_advertiser_link_proposal", + transports.AnalyticsAdminServiceRestInterceptor, "post_list_custom_metrics" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_cancel_display_video360_advertiser_link_proposal", + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_custom_metrics" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = ( - analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest.pb( - analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() - ) + pb_message = analytics_admin.ListCustomMetricsRequest.pb( + analytics_admin.ListCustomMetricsRequest() ) transcode.return_value = { "method": "post", @@ -52334,21 +53514,19 @@ def test_cancel_display_video360_advertiser_link_proposal_rest_interceptors( req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - resources.DisplayVideo360AdvertiserLinkProposal.to_json( - resources.DisplayVideo360AdvertiserLinkProposal() - ) + req.return_value._content = analytics_admin.ListCustomMetricsResponse.to_json( + analytics_admin.ListCustomMetricsResponse() ) - request = analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() + request = analytics_admin.ListCustomMetricsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + post.return_value = analytics_admin.ListCustomMetricsResponse() - client.cancel_display_video360_advertiser_link_proposal( + client.list_custom_metrics( request, metadata=[ ("key", "val"), @@ -52360,9 +53538,8 @@ def test_cancel_display_video360_advertiser_link_proposal_rest_interceptors( post.assert_called_once() -def test_cancel_display_video360_advertiser_link_proposal_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, +def test_list_custom_metrics_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListCustomMetricsRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -52370,9 +53547,7 @@ def test_cancel_display_video360_advertiser_link_proposal_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/displayVideo360AdvertiserLinkProposals/sample2" - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -52384,79 +53559,170 @@ def test_cancel_display_video360_advertiser_link_proposal_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.cancel_display_video360_advertiser_link_proposal(request) + client.list_custom_metrics(request) -def test_cancel_display_video360_advertiser_link_proposal_rest_error(): +def test_list_custom_metrics_rest_flattened(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = analytics_admin.ListCustomMetricsResponse() + + # get arguments that satisfy an http rule for this method + sample_request = {"parent": "properties/sample1"} + + # get truthy value for each flattened field + mock_args = dict( + parent="parent_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = analytics_admin.ListCustomMetricsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.list_custom_metrics(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{parent=properties/*}/customMetrics" % client.transport._host, + args[1], + ) + + +def test_list_custom_metrics_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_custom_metrics( + analytics_admin.ListCustomMetricsRequest(), + parent="parent_value", + ) + + +def test_list_custom_metrics_rest_pager(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + resources.CustomMetric(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[], + next_page_token="def", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + ], + next_page_token="ghi", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListCustomMetricsResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "properties/sample1"} + + pager = client.list_custom_metrics(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.CustomMetric) for i in results) + + pages = list(client.list_custom_metrics(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateCustomDimensionRequest, + analytics_admin.ArchiveCustomMetricRequest, dict, ], ) -def test_create_custom_dimension_rest(request_type): +def test_archive_custom_metric_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["custom_dimension"] = { - "name": "name_value", - "parameter_name": "parameter_name_value", - "display_name": "display_name_value", - "description": "description_value", - "scope": 1, - "disallow_ads_personalization": True, - } + request_init = {"name": "properties/sample1/customMetrics/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.CustomDimension( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_custom_dimension(request) + response = client.archive_custom_metric(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) - assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert response is None -def test_create_custom_dimension_rest_required_fields( - request_type=analytics_admin.CreateCustomDimensionRequest, +def test_archive_custom_metric_rest_required_fields( + request_type=analytics_admin.ArchiveCustomMetricRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -52471,21 +53737,21 @@ def test_create_custom_dimension_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_custom_dimension._get_unset_required_fields(jsonified_request) + ).archive_custom_metric._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_custom_dimension._get_unset_required_fields(jsonified_request) + ).archive_custom_metric._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -52494,7 +53760,7 @@ def test_create_custom_dimension_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.CustomDimension() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -52514,39 +53780,29 @@ def test_create_custom_dimension_rest_required_fields( response_value = Response() response_value.status_code = 200 - - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_custom_dimension(request) + response = client.archive_custom_metric(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_custom_dimension_rest_unset_required_fields(): +def test_archive_custom_metric_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_custom_dimension._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(()) - & set( - ( - "parent", - "customDimension", - ) - ) - ) + unset_fields = transport.archive_custom_metric._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_custom_dimension_rest_interceptors(null_interceptor): +def test_archive_custom_metric_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -52559,14 +53815,11 @@ def test_create_custom_dimension_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_custom_dimension" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_custom_dimension" + transports.AnalyticsAdminServiceRestInterceptor, "pre_archive_custom_metric" ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.CreateCustomDimensionRequest.pb( - analytics_admin.CreateCustomDimensionRequest() + pb_message = analytics_admin.ArchiveCustomMetricRequest.pb( + analytics_admin.ArchiveCustomMetricRequest() ) transcode.return_value = { "method": "post", @@ -52578,19 +53831,15 @@ def test_create_custom_dimension_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.CustomDimension.to_json( - resources.CustomDimension() - ) - request = analytics_admin.CreateCustomDimensionRequest() + request = analytics_admin.ArchiveCustomMetricRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.CustomDimension() - client.create_custom_dimension( + client.archive_custom_metric( request, metadata=[ ("key", "val"), @@ -52599,11 +53848,10 @@ def test_create_custom_dimension_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_create_custom_dimension_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateCustomDimensionRequest +def test_archive_custom_metric_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ArchiveCustomMetricRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -52611,15 +53859,7 @@ def test_create_custom_dimension_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["custom_dimension"] = { - "name": "name_value", - "parameter_name": "parameter_name_value", - "display_name": "display_name_value", - "description": "description_value", - "scope": 1, - "disallow_ads_personalization": True, - } + request_init = {"name": "properties/sample1/customMetrics/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -52631,10 +53871,10 @@ def test_create_custom_dimension_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_custom_dimension(request) + client.archive_custom_metric(request) -def test_create_custom_dimension_rest_flattened(): +def test_archive_custom_metric_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -52643,40 +53883,38 @@ def test_create_custom_dimension_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.CustomDimension() + return_value = None # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = {"name": "properties/sample1/customMetrics/sample2"} # get truthy value for each flattened field mock_args = dict( - parent="parent_value", - custom_dimension=resources.CustomDimension(name="name_value"), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_custom_dimension(**mock_args) + client.archive_custom_metric(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/customDimensions" + "%s/v1alpha/{name=properties/*/customMetrics/*}:archive" % client.transport._host, args[1], ) -def test_create_custom_dimension_rest_flattened_error(transport: str = "rest"): +def test_archive_custom_metric_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -52685,14 +53923,13 @@ def test_create_custom_dimension_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_custom_dimension( - analytics_admin.CreateCustomDimensionRequest(), - parent="parent_value", - custom_dimension=resources.CustomDimension(name="name_value"), + client.archive_custom_metric( + analytics_admin.ArchiveCustomMetricRequest(), + name="name_value", ) -def test_create_custom_dimension_rest_error(): +def test_archive_custom_metric_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -52701,68 +53938,66 @@ def test_create_custom_dimension_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateCustomDimensionRequest, + analytics_admin.GetCustomMetricRequest, dict, ], ) -def test_update_custom_dimension_rest(request_type): +def test_get_custom_metric_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "custom_dimension": {"name": "properties/sample1/customDimensions/sample2"} - } - request_init["custom_dimension"] = { - "name": "properties/sample1/customDimensions/sample2", - "parameter_name": "parameter_name_value", - "display_name": "display_name_value", - "description": "description_value", - "scope": 1, - "disallow_ads_personalization": True, - } + request_init = {"name": "properties/sample1/customMetrics/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.CustomDimension( + return_value = resources.CustomMetric( name="name_value", parameter_name="parameter_name_value", display_name="display_name_value", description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + restricted_metric_type=[ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ], ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_custom_dimension(request) + response = client.get_custom_metric(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) + assert isinstance(response, resources.CustomMetric) assert response.name == "name_value" assert response.parameter_name == "parameter_name_value" assert response.display_name == "display_name_value" assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert response.restricted_metric_type == [ + resources.CustomMetric.RestrictedMetricType.COST_DATA + ] -def test_update_custom_dimension_rest_required_fields( - request_type=analytics_admin.UpdateCustomDimensionRequest, +def test_get_custom_metric_rest_required_fields( + request_type=analytics_admin.GetCustomMetricRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -52777,19 +54012,21 @@ def test_update_custom_dimension_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_custom_dimension._get_unset_required_fields(jsonified_request) + ).get_custom_metric._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["name"] = "name_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_custom_dimension._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + ).get_custom_metric._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -52798,7 +54035,7 @@ def test_update_custom_dimension_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.CustomDimension() + return_value = resources.CustomMetric() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -52810,39 +54047,39 @@ def test_update_custom_dimension_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_custom_dimension(request) + response = client.get_custom_metric(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_custom_dimension_rest_unset_required_fields(): +def test_get_custom_metric_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_custom_dimension._get_unset_required_fields({}) - assert set(unset_fields) == (set(("updateMask",)) & set(("updateMask",))) + unset_fields = transport.get_custom_metric._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_custom_dimension_rest_interceptors(null_interceptor): +def test_get_custom_metric_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -52855,14 +54092,14 @@ def test_update_custom_dimension_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_custom_dimension" + transports.AnalyticsAdminServiceRestInterceptor, "post_get_custom_metric" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_custom_dimension" + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_custom_metric" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateCustomDimensionRequest.pb( - analytics_admin.UpdateCustomDimensionRequest() + pb_message = analytics_admin.GetCustomMetricRequest.pb( + analytics_admin.GetCustomMetricRequest() ) transcode.return_value = { "method": "post", @@ -52874,19 +54111,19 @@ def test_update_custom_dimension_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.CustomDimension.to_json( - resources.CustomDimension() + req.return_value._content = resources.CustomMetric.to_json( + resources.CustomMetric() ) - request = analytics_admin.UpdateCustomDimensionRequest() + request = analytics_admin.GetCustomMetricRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.CustomDimension() + post.return_value = resources.CustomMetric() - client.update_custom_dimension( + client.get_custom_metric( request, metadata=[ ("key", "val"), @@ -52898,8 +54135,8 @@ def test_update_custom_dimension_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_custom_dimension_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateCustomDimensionRequest +def test_get_custom_metric_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetCustomMetricRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -52907,17 +54144,7 @@ def test_update_custom_dimension_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "custom_dimension": {"name": "properties/sample1/customDimensions/sample2"} - } - request_init["custom_dimension"] = { - "name": "properties/sample1/customDimensions/sample2", - "parameter_name": "parameter_name_value", - "display_name": "display_name_value", - "description": "description_value", - "scope": 1, - "disallow_ads_personalization": True, - } + request_init = {"name": "properties/sample1/customMetrics/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -52929,10 +54156,10 @@ def test_update_custom_dimension_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_custom_dimension(request) + client.get_custom_metric(request) -def test_update_custom_dimension_rest_flattened(): +def test_get_custom_metric_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -52941,42 +54168,39 @@ def test_update_custom_dimension_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.CustomDimension() + return_value = resources.CustomMetric() # get arguments that satisfy an http rule for this method - sample_request = { - "custom_dimension": {"name": "properties/sample1/customDimensions/sample2"} - } + sample_request = {"name": "properties/sample1/customMetrics/sample2"} # get truthy value for each flattened field mock_args = dict( - custom_dimension=resources.CustomDimension(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_custom_dimension(**mock_args) + client.get_custom_metric(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{custom_dimension.name=properties/*/customDimensions/*}" - % client.transport._host, + "%s/v1alpha/{name=properties/*/customMetrics/*}" % client.transport._host, args[1], ) -def test_update_custom_dimension_rest_flattened_error(transport: str = "rest"): +def test_get_custom_metric_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -52985,14 +54209,13 @@ def test_update_custom_dimension_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_custom_dimension( - analytics_admin.UpdateCustomDimensionRequest(), - custom_dimension=resources.CustomDimension(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.get_custom_metric( + analytics_admin.GetCustomMetricRequest(), + name="name_value", ) -def test_update_custom_dimension_rest_error(): +def test_get_custom_metric_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -53001,49 +54224,57 @@ def test_update_custom_dimension_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListCustomDimensionsRequest, + analytics_admin.GetDataRetentionSettingsRequest, dict, ], ) -def test_list_custom_dimensions_rest(request_type): +def test_get_data_retention_settings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = {"name": "properties/sample1/dataRetentionSettings"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListCustomDimensionsResponse( - next_page_token="next_page_token_value", + return_value = resources.DataRetentionSettings( + name="name_value", + event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, + reset_user_data_on_new_activity=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListCustomDimensionsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataRetentionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_custom_dimensions(request) + response = client.get_data_retention_settings(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomDimensionsPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.DataRetentionSettings) + assert response.name == "name_value" + assert ( + response.event_data_retention + == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + ) + assert response.reset_user_data_on_new_activity is True -def test_list_custom_dimensions_rest_required_fields( - request_type=analytics_admin.ListCustomDimensionsRequest, +def test_get_data_retention_settings_rest_required_fields( + request_type=analytics_admin.GetDataRetentionSettingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -53058,28 +54289,21 @@ def test_list_custom_dimensions_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_custom_dimensions._get_unset_required_fields(jsonified_request) + ).get_data_retention_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_custom_dimensions._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) - ) + ).get_data_retention_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -53088,7 +54312,7 @@ def test_list_custom_dimensions_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListCustomDimensionsResponse() + return_value = resources.DataRetentionSettings() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -53108,40 +54332,31 @@ def test_list_custom_dimensions_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListCustomDimensionsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataRetentionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_custom_dimensions(request) + response = client.get_data_retention_settings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_custom_dimensions_rest_unset_required_fields(): +def test_get_data_retention_settings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_custom_dimensions._get_unset_required_fields({}) - assert set(unset_fields) == ( - set( - ( - "pageSize", - "pageToken", - ) - ) - & set(("parent",)) - ) + unset_fields = transport.get_data_retention_settings._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_custom_dimensions_rest_interceptors(null_interceptor): +def test_get_data_retention_settings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -53154,14 +54369,16 @@ def test_list_custom_dimensions_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_custom_dimensions" + transports.AnalyticsAdminServiceRestInterceptor, + "post_get_data_retention_settings", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_custom_dimensions" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_get_data_retention_settings", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListCustomDimensionsRequest.pb( - analytics_admin.ListCustomDimensionsRequest() + pb_message = analytics_admin.GetDataRetentionSettingsRequest.pb( + analytics_admin.GetDataRetentionSettingsRequest() ) transcode.return_value = { "method": "post", @@ -53173,21 +54390,19 @@ def test_list_custom_dimensions_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.ListCustomDimensionsResponse.to_json( - analytics_admin.ListCustomDimensionsResponse() - ) + req.return_value._content = resources.DataRetentionSettings.to_json( + resources.DataRetentionSettings() ) - request = analytics_admin.ListCustomDimensionsRequest() + request = analytics_admin.GetDataRetentionSettingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListCustomDimensionsResponse() + post.return_value = resources.DataRetentionSettings() - client.list_custom_dimensions( + client.get_data_retention_settings( request, metadata=[ ("key", "val"), @@ -53199,8 +54414,9 @@ def test_list_custom_dimensions_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_custom_dimensions_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListCustomDimensionsRequest +def test_get_data_retention_settings_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.GetDataRetentionSettingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -53208,7 +54424,7 @@ def test_list_custom_dimensions_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = {"name": "properties/sample1/dataRetentionSettings"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -53220,10 +54436,10 @@ def test_list_custom_dimensions_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_custom_dimensions(request) + client.get_data_retention_settings(request) -def test_list_custom_dimensions_rest_flattened(): +def test_get_data_retention_settings_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -53232,39 +54448,40 @@ def test_list_custom_dimensions_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListCustomDimensionsResponse() + return_value = resources.DataRetentionSettings() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = {"name": "properties/sample1/dataRetentionSettings"} # get truthy value for each flattened field mock_args = dict( - parent="parent_value", + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListCustomDimensionsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataRetentionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_custom_dimensions(**mock_args) + client.get_data_retention_settings(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/customDimensions" + "%s/v1alpha/{name=properties/*/dataRetentionSettings}" % client.transport._host, args[1], ) -def test_list_custom_dimensions_rest_flattened_error(transport: str = "rest"): +def test_get_data_retention_settings_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -53273,117 +54490,149 @@ def test_list_custom_dimensions_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_custom_dimensions( - analytics_admin.ListCustomDimensionsRequest(), - parent="parent_value", + client.get_data_retention_settings( + analytics_admin.GetDataRetentionSettingsRequest(), + name="name_value", ) -def test_list_custom_dimensions_rest_pager(transport: str = "rest"): +def test_get_data_retention_settings_rest_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - resources.CustomDimension(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[], - next_page_token="def", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - ], - next_page_token="ghi", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListCustomDimensionsResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "properties/sample1"} - - pager = client.list_custom_dimensions(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.CustomDimension) for i in results) - - pages = list(client.list_custom_dimensions(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - @pytest.mark.parametrize( "request_type", [ - analytics_admin.ArchiveCustomDimensionRequest, + analytics_admin.UpdateDataRetentionSettingsRequest, dict, ], ) -def test_archive_custom_dimension_rest(request_type): +def test_update_data_retention_settings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/customDimensions/sample2"} + request_init = { + "data_retention_settings": {"name": "properties/sample1/dataRetentionSettings"} + } + request_init["data_retention_settings"] = { + "name": "properties/sample1/dataRetentionSettings", + "event_data_retention": 1, + "reset_user_data_on_new_activity": True, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateDataRetentionSettingsRequest.meta.fields[ + "data_retention_settings" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "data_retention_settings" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["data_retention_settings"][field])): + del request_init["data_retention_settings"][field][i][subfield] + else: + del request_init["data_retention_settings"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.DataRetentionSettings( + name="name_value", + event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, + reset_user_data_on_new_activity=True, + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.DataRetentionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.archive_custom_dimension(request) + response = client.update_data_retention_settings(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.DataRetentionSettings) + assert response.name == "name_value" + assert ( + response.event_data_retention + == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + ) + assert response.reset_user_data_on_new_activity is True -def test_archive_custom_dimension_rest_required_fields( - request_type=analytics_admin.ArchiveCustomDimensionRequest, +def test_update_data_retention_settings_rest_required_fields( + request_type=analytics_admin.UpdateDataRetentionSettingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -53398,21 +54647,19 @@ def test_archive_custom_dimension_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).archive_custom_dimension._get_unset_required_fields(jsonified_request) + ).update_data_retention_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).archive_custom_dimension._get_unset_required_fields(jsonified_request) + ).update_data_retention_settings._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -53421,7 +54668,7 @@ def test_archive_custom_dimension_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.DataRetentionSettings() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -53433,7 +54680,7 @@ def test_archive_custom_dimension_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "patch", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -53441,29 +54688,42 @@ def test_archive_custom_dimension_rest_required_fields( response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = resources.DataRetentionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.archive_custom_dimension(request) + response = client.update_data_retention_settings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_archive_custom_dimension_rest_unset_required_fields(): +def test_update_data_retention_settings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.archive_custom_dimension._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.update_data_retention_settings._get_unset_required_fields( + {} + ) + assert set(unset_fields) == ( + set(("updateMask",)) + & set( + ( + "dataRetentionSettings", + "updateMask", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_archive_custom_dimension_rest_interceptors(null_interceptor): +def test_update_data_retention_settings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -53476,11 +54736,16 @@ def test_archive_custom_dimension_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_archive_custom_dimension" + transports.AnalyticsAdminServiceRestInterceptor, + "post_update_data_retention_settings", + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, + "pre_update_data_retention_settings", ) as pre: pre.assert_not_called() - pb_message = analytics_admin.ArchiveCustomDimensionRequest.pb( - analytics_admin.ArchiveCustomDimensionRequest() + post.assert_not_called() + pb_message = analytics_admin.UpdateDataRetentionSettingsRequest.pb( + analytics_admin.UpdateDataRetentionSettingsRequest() ) transcode.return_value = { "method": "post", @@ -53492,15 +54757,19 @@ def test_archive_custom_dimension_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = resources.DataRetentionSettings.to_json( + resources.DataRetentionSettings() + ) - request = analytics_admin.ArchiveCustomDimensionRequest() + request = analytics_admin.UpdateDataRetentionSettingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = resources.DataRetentionSettings() - client.archive_custom_dimension( + client.update_data_retention_settings( request, metadata=[ ("key", "val"), @@ -53509,10 +54778,12 @@ def test_archive_custom_dimension_rest_interceptors(null_interceptor): ) pre.assert_called_once() + post.assert_called_once() -def test_archive_custom_dimension_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ArchiveCustomDimensionRequest +def test_update_data_retention_settings_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.UpdateDataRetentionSettingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -53520,7 +54791,9 @@ def test_archive_custom_dimension_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/customDimensions/sample2"} + request_init = { + "data_retention_settings": {"name": "properties/sample1/dataRetentionSettings"} + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -53532,10 +54805,10 @@ def test_archive_custom_dimension_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.archive_custom_dimension(request) + client.update_data_retention_settings(request) -def test_archive_custom_dimension_rest_flattened(): +def test_update_data_retention_settings_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -53544,38 +54817,45 @@ def test_archive_custom_dimension_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.DataRetentionSettings() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/customDimensions/sample2"} + sample_request = { + "data_retention_settings": { + "name": "properties/sample1/dataRetentionSettings" + } + } # get truthy value for each flattened field mock_args = dict( - name="name_value", + data_retention_settings=resources.DataRetentionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.DataRetentionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.archive_custom_dimension(**mock_args) + client.update_data_retention_settings(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/customDimensions/*}:archive" + "%s/v1alpha/{data_retention_settings.name=properties/*/dataRetentionSettings}" % client.transport._host, args[1], ) -def test_archive_custom_dimension_rest_flattened_error(transport: str = "rest"): +def test_update_data_retention_settings_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -53584,13 +54864,14 @@ def test_archive_custom_dimension_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.archive_custom_dimension( - analytics_admin.ArchiveCustomDimensionRequest(), - name="name_value", + client.update_data_retention_settings( + analytics_admin.UpdateDataRetentionSettingsRequest(), + data_retention_settings=resources.DataRetentionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_archive_custom_dimension_rest_error(): +def test_update_data_retention_settings_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -53599,59 +54880,141 @@ def test_archive_custom_dimension_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetCustomDimensionRequest, + analytics_admin.CreateDataStreamRequest, dict, ], ) -def test_get_custom_dimension_rest(request_type): +def test_create_data_stream_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/customDimensions/sample2"} + request_init = {"parent": "properties/sample1"} + request_init["data_stream"] = { + "web_stream_data": { + "measurement_id": "measurement_id_value", + "firebase_app_id": "firebase_app_id_value", + "default_uri": "default_uri_value", + }, + "android_app_stream_data": { + "firebase_app_id": "firebase_app_id_value", + "package_name": "package_name_value", + }, + "ios_app_stream_data": { + "firebase_app_id": "firebase_app_id_value", + "bundle_id": "bundle_id_value", + }, + "name": "name_value", + "type_": 1, + "display_name": "display_name_value", + "create_time": {"seconds": 751, "nanos": 543}, + "update_time": {}, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateDataStreamRequest.meta.fields["data_stream"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["data_stream"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["data_stream"][field])): + del request_init["data_stream"][field][i][subfield] + else: + del request_init["data_stream"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.CustomDimension( + return_value = resources.DataStream( name="name_value", - parameter_name="parameter_name_value", + type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_custom_dimension(request) + response = client.create_data_stream(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) + assert isinstance(response, resources.DataStream) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" + assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True -def test_get_custom_dimension_rest_required_fields( - request_type=analytics_admin.GetCustomDimensionRequest, +def test_create_data_stream_rest_required_fields( + request_type=analytics_admin.CreateDataStreamRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -53666,21 +55029,21 @@ def test_get_custom_dimension_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_custom_dimension._get_unset_required_fields(jsonified_request) + ).create_data_stream._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_custom_dimension._get_unset_required_fields(jsonified_request) + ).create_data_stream._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -53689,7 +55052,7 @@ def test_get_custom_dimension_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.CustomDimension() + return_value = resources.DataStream() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -53701,38 +55064,48 @@ def test_get_custom_dimension_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_custom_dimension(request) + response = client.create_data_stream(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_custom_dimension_rest_unset_required_fields(): +def test_create_data_stream_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_custom_dimension._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.create_data_stream._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "dataStream", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_custom_dimension_rest_interceptors(null_interceptor): +def test_create_data_stream_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -53745,14 +55118,14 @@ def test_get_custom_dimension_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_custom_dimension" + transports.AnalyticsAdminServiceRestInterceptor, "post_create_data_stream" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_custom_dimension" + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_data_stream" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetCustomDimensionRequest.pb( - analytics_admin.GetCustomDimensionRequest() + pb_message = analytics_admin.CreateDataStreamRequest.pb( + analytics_admin.CreateDataStreamRequest() ) transcode.return_value = { "method": "post", @@ -53764,19 +55137,17 @@ def test_get_custom_dimension_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.CustomDimension.to_json( - resources.CustomDimension() - ) + req.return_value._content = resources.DataStream.to_json(resources.DataStream()) - request = analytics_admin.GetCustomDimensionRequest() + request = analytics_admin.CreateDataStreamRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.CustomDimension() + post.return_value = resources.DataStream() - client.get_custom_dimension( + client.create_data_stream( request, metadata=[ ("key", "val"), @@ -53788,8 +55159,8 @@ def test_get_custom_dimension_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_custom_dimension_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetCustomDimensionRequest +def test_create_data_stream_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateDataStreamRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -53797,7 +55168,7 @@ def test_get_custom_dimension_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/customDimensions/sample2"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -53809,10 +55180,10 @@ def test_get_custom_dimension_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_custom_dimension(request) + client.create_data_stream(request) -def test_get_custom_dimension_rest_flattened(): +def test_create_data_stream_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -53821,39 +55192,44 @@ def test_get_custom_dimension_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.CustomDimension() + return_value = resources.DataStream() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/customDimensions/sample2"} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", + data_stream=resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_custom_dimension(**mock_args) + client.create_data_stream(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/customDimensions/*}" - % client.transport._host, + "%s/v1alpha/{parent=properties/*}/dataStreams" % client.transport._host, args[1], ) -def test_get_custom_dimension_rest_flattened_error(transport: str = "rest"): +def test_create_data_stream_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -53862,13 +55238,18 @@ def test_get_custom_dimension_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_custom_dimension( - analytics_admin.GetCustomDimensionRequest(), - name="name_value", + client.create_data_stream( + analytics_admin.CreateDataStreamRequest(), + parent="parent_value", + data_stream=resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ), ) -def test_get_custom_dimension_rest_error(): +def test_create_data_stream_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -53877,74 +55258,45 @@ def test_get_custom_dimension_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateCustomMetricRequest, + analytics_admin.DeleteDataStreamRequest, dict, ], ) -def test_create_custom_metric_rest(request_type): +def test_delete_data_stream_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["custom_metric"] = { - "name": "name_value", - "parameter_name": "parameter_name_value", - "display_name": "display_name_value", - "description": "description_value", - "measurement_unit": 1, - "scope": 1, - "restricted_metric_type": [1], - } + request_init = {"name": "properties/sample1/dataStreams/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.CustomMetric( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, - restricted_metric_type=[ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ], - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_custom_metric(request) + response = client.delete_data_stream(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) - assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT - assert response.restricted_metric_type == [ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ] + assert response is None -def test_create_custom_metric_rest_required_fields( - request_type=analytics_admin.CreateCustomMetricRequest, +def test_delete_data_stream_rest_required_fields( + request_type=analytics_admin.DeleteDataStreamRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -53959,21 +55311,21 @@ def test_create_custom_metric_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_custom_metric._get_unset_required_fields(jsonified_request) + ).delete_data_stream._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_custom_metric._get_unset_required_fields(jsonified_request) + ).delete_data_stream._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -53982,7 +55334,7 @@ def test_create_custom_metric_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.CustomMetric() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -53994,47 +55346,36 @@ def test_create_custom_metric_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "delete", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_custom_metric(request) + response = client.delete_data_stream(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_custom_metric_rest_unset_required_fields(): +def test_delete_data_stream_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_custom_metric._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(()) - & set( - ( - "parent", - "customMetric", - ) - ) - ) + unset_fields = transport.delete_data_stream._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_custom_metric_rest_interceptors(null_interceptor): +def test_delete_data_stream_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -54047,14 +55388,11 @@ def test_create_custom_metric_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_custom_metric" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_custom_metric" + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_data_stream" ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.CreateCustomMetricRequest.pb( - analytics_admin.CreateCustomMetricRequest() + pb_message = analytics_admin.DeleteDataStreamRequest.pb( + analytics_admin.DeleteDataStreamRequest() ) transcode.return_value = { "method": "post", @@ -54066,19 +55404,15 @@ def test_create_custom_metric_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.CustomMetric.to_json( - resources.CustomMetric() - ) - request = analytics_admin.CreateCustomMetricRequest() + request = analytics_admin.DeleteDataStreamRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.CustomMetric() - client.create_custom_metric( + client.delete_data_stream( request, metadata=[ ("key", "val"), @@ -54087,11 +55421,10 @@ def test_create_custom_metric_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_create_custom_metric_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateCustomMetricRequest +def test_delete_data_stream_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeleteDataStreamRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -54099,16 +55432,7 @@ def test_create_custom_metric_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["custom_metric"] = { - "name": "name_value", - "parameter_name": "parameter_name_value", - "display_name": "display_name_value", - "description": "description_value", - "measurement_unit": 1, - "scope": 1, - "restricted_metric_type": [1], - } + request_init = {"name": "properties/sample1/dataStreams/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -54120,10 +55444,10 @@ def test_create_custom_metric_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_custom_metric(request) + client.delete_data_stream(request) -def test_create_custom_metric_rest_flattened(): +def test_delete_data_stream_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -54132,39 +55456,37 @@ def test_create_custom_metric_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.CustomMetric() + return_value = None # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = {"name": "properties/sample1/dataStreams/sample2"} # get truthy value for each flattened field mock_args = dict( - parent="parent_value", - custom_metric=resources.CustomMetric(name="name_value"), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_custom_metric(**mock_args) + client.delete_data_stream(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/customMetrics" % client.transport._host, + "%s/v1alpha/{name=properties/*/dataStreams/*}" % client.transport._host, args[1], ) -def test_create_custom_metric_rest_flattened_error(transport: str = "rest"): +def test_delete_data_stream_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -54173,14 +55495,13 @@ def test_create_custom_metric_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_custom_metric( - analytics_admin.CreateCustomMetricRequest(), - parent="parent_value", - custom_metric=resources.CustomMetric(name="name_value"), + client.delete_data_stream( + analytics_admin.DeleteDataStreamRequest(), + name="name_value", ) -def test_create_custom_metric_rest_error(): +def test_delete_data_stream_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -54189,71 +55510,136 @@ def test_create_custom_metric_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateCustomMetricRequest, + analytics_admin.UpdateDataStreamRequest, dict, ], ) -def test_update_custom_metric_rest(request_type): +def test_update_data_stream_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "custom_metric": {"name": "properties/sample1/customMetrics/sample2"} - } - request_init["custom_metric"] = { - "name": "properties/sample1/customMetrics/sample2", - "parameter_name": "parameter_name_value", + request_init = {"data_stream": {"name": "properties/sample1/dataStreams/sample2"}} + request_init["data_stream"] = { + "web_stream_data": { + "measurement_id": "measurement_id_value", + "firebase_app_id": "firebase_app_id_value", + "default_uri": "default_uri_value", + }, + "android_app_stream_data": { + "firebase_app_id": "firebase_app_id_value", + "package_name": "package_name_value", + }, + "ios_app_stream_data": { + "firebase_app_id": "firebase_app_id_value", + "bundle_id": "bundle_id_value", + }, + "name": "properties/sample1/dataStreams/sample2", + "type_": 1, "display_name": "display_name_value", - "description": "description_value", - "measurement_unit": 1, - "scope": 1, - "restricted_metric_type": [1], + "create_time": {"seconds": 751, "nanos": 543}, + "update_time": {}, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateDataStreamRequest.meta.fields["data_stream"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["data_stream"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["data_stream"][field])): + del request_init["data_stream"][field][i][subfield] + else: + del request_init["data_stream"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.CustomMetric( + return_value = resources.DataStream( name="name_value", - parameter_name="parameter_name_value", + type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, - restricted_metric_type=[ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ], ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_custom_metric(request) + response = client.update_data_stream(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) + assert isinstance(response, resources.DataStream) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" + assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT - assert response.restricted_metric_type == [ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ] -def test_update_custom_metric_rest_required_fields( - request_type=analytics_admin.UpdateCustomMetricRequest, +def test_update_data_stream_rest_required_fields( + request_type=analytics_admin.UpdateDataStreamRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -54272,14 +55658,14 @@ def test_update_custom_metric_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_custom_metric._get_unset_required_fields(jsonified_request) + ).update_data_stream._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_custom_metric._get_unset_required_fields(jsonified_request) + ).update_data_stream._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) @@ -54293,7 +55679,7 @@ def test_update_custom_metric_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.CustomMetric() + return_value = resources.DataStream() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -54314,30 +55700,31 @@ def test_update_custom_metric_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_custom_metric(request) + response = client.update_data_stream(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_custom_metric_rest_unset_required_fields(): +def test_update_data_stream_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_custom_metric._get_unset_required_fields({}) + unset_fields = transport.update_data_stream._get_unset_required_fields({}) assert set(unset_fields) == (set(("updateMask",)) & set(("updateMask",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_custom_metric_rest_interceptors(null_interceptor): +def test_update_data_stream_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -54350,14 +55737,14 @@ def test_update_custom_metric_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_custom_metric" + transports.AnalyticsAdminServiceRestInterceptor, "post_update_data_stream" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_custom_metric" + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_data_stream" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateCustomMetricRequest.pb( - analytics_admin.UpdateCustomMetricRequest() + pb_message = analytics_admin.UpdateDataStreamRequest.pb( + analytics_admin.UpdateDataStreamRequest() ) transcode.return_value = { "method": "post", @@ -54369,19 +55756,17 @@ def test_update_custom_metric_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.CustomMetric.to_json( - resources.CustomMetric() - ) + req.return_value._content = resources.DataStream.to_json(resources.DataStream()) - request = analytics_admin.UpdateCustomMetricRequest() + request = analytics_admin.UpdateDataStreamRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.CustomMetric() + post.return_value = resources.DataStream() - client.update_custom_metric( + client.update_data_stream( request, metadata=[ ("key", "val"), @@ -54393,8 +55778,8 @@ def test_update_custom_metric_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_custom_metric_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateCustomMetricRequest +def test_update_data_stream_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateDataStreamRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -54402,18 +55787,7 @@ def test_update_custom_metric_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "custom_metric": {"name": "properties/sample1/customMetrics/sample2"} - } - request_init["custom_metric"] = { - "name": "properties/sample1/customMetrics/sample2", - "parameter_name": "parameter_name_value", - "display_name": "display_name_value", - "description": "description_value", - "measurement_unit": 1, - "scope": 1, - "restricted_metric_type": [1], - } + request_init = {"data_stream": {"name": "properties/sample1/dataStreams/sample2"}} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -54425,10 +55799,10 @@ def test_update_custom_metric_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_custom_metric(request) + client.update_data_stream(request) -def test_update_custom_metric_rest_flattened(): +def test_update_data_stream_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -54437,16 +55811,20 @@ def test_update_custom_metric_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.CustomMetric() + return_value = resources.DataStream() # get arguments that satisfy an http rule for this method sample_request = { - "custom_metric": {"name": "properties/sample1/customMetrics/sample2"} + "data_stream": {"name": "properties/sample1/dataStreams/sample2"} } # get truthy value for each flattened field mock_args = dict( - custom_metric=resources.CustomMetric(name="name_value"), + data_stream=resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) @@ -54454,25 +55832,26 @@ def test_update_custom_metric_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_custom_metric(**mock_args) + client.update_data_stream(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{custom_metric.name=properties/*/customMetrics/*}" + "%s/v1alpha/{data_stream.name=properties/*/dataStreams/*}" % client.transport._host, args[1], ) -def test_update_custom_metric_rest_flattened_error(transport: str = "rest"): +def test_update_data_stream_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -54481,14 +55860,18 @@ def test_update_custom_metric_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_custom_metric( - analytics_admin.UpdateCustomMetricRequest(), - custom_metric=resources.CustomMetric(name="name_value"), + client.update_data_stream( + analytics_admin.UpdateDataStreamRequest(), + data_stream=resources.DataStream( + web_stream_data=resources.DataStream.WebStreamData( + measurement_id="measurement_id_value" + ) + ), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_update_custom_metric_rest_error(): +def test_update_data_stream_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -54497,11 +55880,11 @@ def test_update_custom_metric_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListCustomMetricsRequest, + analytics_admin.ListDataStreamsRequest, dict, ], ) -def test_list_custom_metrics_rest(request_type): +def test_list_data_streams_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -54514,27 +55897,28 @@ def test_list_custom_metrics_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListCustomMetricsResponse( + return_value = analytics_admin.ListDataStreamsResponse( next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListCustomMetricsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListDataStreamsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_custom_metrics(request) + response = client.list_data_streams(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomMetricsPager) + assert isinstance(response, pagers.ListDataStreamsPager) assert response.next_page_token == "next_page_token_value" -def test_list_custom_metrics_rest_required_fields( - request_type=analytics_admin.ListCustomMetricsRequest, +def test_list_data_streams_rest_required_fields( + request_type=analytics_admin.ListDataStreamsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -54554,7 +55938,7 @@ def test_list_custom_metrics_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_custom_metrics._get_unset_required_fields(jsonified_request) + ).list_data_streams._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -54563,7 +55947,7 @@ def test_list_custom_metrics_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_custom_metrics._get_unset_required_fields(jsonified_request) + ).list_data_streams._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( ( @@ -54584,7 +55968,7 @@ def test_list_custom_metrics_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListCustomMetricsResponse() + return_value = analytics_admin.ListDataStreamsResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -54604,25 +55988,26 @@ def test_list_custom_metrics_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListCustomMetricsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListDataStreamsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_custom_metrics(request) + response = client.list_data_streams(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_custom_metrics_rest_unset_required_fields(): +def test_list_data_streams_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_custom_metrics._get_unset_required_fields({}) + unset_fields = transport.list_data_streams._get_unset_required_fields({}) assert set(unset_fields) == ( set( ( @@ -54635,7 +56020,7 @@ def test_list_custom_metrics_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_custom_metrics_rest_interceptors(null_interceptor): +def test_list_data_streams_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -54648,14 +56033,14 @@ def test_list_custom_metrics_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_custom_metrics" + transports.AnalyticsAdminServiceRestInterceptor, "post_list_data_streams" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_custom_metrics" + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_data_streams" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListCustomMetricsRequest.pb( - analytics_admin.ListCustomMetricsRequest() + pb_message = analytics_admin.ListDataStreamsRequest.pb( + analytics_admin.ListDataStreamsRequest() ) transcode.return_value = { "method": "post", @@ -54667,19 +56052,19 @@ def test_list_custom_metrics_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ListCustomMetricsResponse.to_json( - analytics_admin.ListCustomMetricsResponse() + req.return_value._content = analytics_admin.ListDataStreamsResponse.to_json( + analytics_admin.ListDataStreamsResponse() ) - request = analytics_admin.ListCustomMetricsRequest() + request = analytics_admin.ListDataStreamsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListCustomMetricsResponse() + post.return_value = analytics_admin.ListDataStreamsResponse() - client.list_custom_metrics( + client.list_data_streams( request, metadata=[ ("key", "val"), @@ -54691,8 +56076,8 @@ def test_list_custom_metrics_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_custom_metrics_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListCustomMetricsRequest +def test_list_data_streams_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListDataStreamsRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -54712,10 +56097,10 @@ def test_list_custom_metrics_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_custom_metrics(request) + client.list_data_streams(request) -def test_list_custom_metrics_rest_flattened(): +def test_list_data_streams_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -54724,7 +56109,7 @@ def test_list_custom_metrics_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListCustomMetricsResponse() + return_value = analytics_admin.ListDataStreamsResponse() # get arguments that satisfy an http rule for this method sample_request = {"parent": "properties/sample1"} @@ -54738,24 +56123,25 @@ def test_list_custom_metrics_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListCustomMetricsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListDataStreamsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_custom_metrics(**mock_args) + client.list_data_streams(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/customMetrics" % client.transport._host, + "%s/v1alpha/{parent=properties/*}/dataStreams" % client.transport._host, args[1], ) -def test_list_custom_metrics_rest_flattened_error(transport: str = "rest"): +def test_list_data_streams_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -54764,13 +56150,13 @@ def test_list_custom_metrics_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_custom_metrics( - analytics_admin.ListCustomMetricsRequest(), + client.list_data_streams( + analytics_admin.ListDataStreamsRequest(), parent="parent_value", ) -def test_list_custom_metrics_rest_pager(transport: str = "rest"): +def test_list_data_streams_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -54782,28 +56168,28 @@ def test_list_custom_metrics_rest_pager(transport: str = "rest"): # with mock.patch.object(path_template, 'transcode') as transcode: # Set the response as a series of pages response = ( - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - resources.CustomMetric(), + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + resources.DataStream(), + resources.DataStream(), ], next_page_token="abc", ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[], + analytics_admin.ListDataStreamsResponse( + data_streams=[], next_page_token="def", ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), ], next_page_token="ghi", ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), + analytics_admin.ListDataStreamsResponse( + data_streams=[ + resources.DataStream(), + resources.DataStream(), ], ), ) @@ -54812,7 +56198,7 @@ def test_list_custom_metrics_rest_pager(transport: str = "rest"): # Wrap the values into proper Response objs response = tuple( - analytics_admin.ListCustomMetricsResponse.to_json(x) for x in response + analytics_admin.ListDataStreamsResponse.to_json(x) for x in response ) return_values = tuple(Response() for i in response) for return_val, response_val in zip(return_values, response): @@ -54822,13 +56208,13 @@ def test_list_custom_metrics_rest_pager(transport: str = "rest"): sample_request = {"parent": "properties/sample1"} - pager = client.list_custom_metrics(request=sample_request) + pager = client.list_data_streams(request=sample_request) results = list(pager) assert len(results) == 6 - assert all(isinstance(i, resources.CustomMetric) for i in results) + assert all(isinstance(i, resources.DataStream) for i in results) - pages = list(client.list_custom_metrics(request=sample_request).pages) + pages = list(client.list_data_streams(request=sample_request).pages) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -54836,40 +56222,49 @@ def test_list_custom_metrics_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ArchiveCustomMetricRequest, + analytics_admin.GetDataStreamRequest, dict, ], ) -def test_archive_custom_metric_rest(request_type): +def test_get_data_stream_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/customMetrics/sample2"} + request_init = {"name": "properties/sample1/dataStreams/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.DataStream( + name="name_value", + type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, + display_name="display_name_value", + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.archive_custom_metric(request) + response = client.get_data_stream(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.DataStream) + assert response.name == "name_value" + assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM + assert response.display_name == "display_name_value" -def test_archive_custom_metric_rest_required_fields( - request_type=analytics_admin.ArchiveCustomMetricRequest, +def test_get_data_stream_rest_required_fields( + request_type=analytics_admin.GetDataStreamRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -54889,7 +56284,7 @@ def test_archive_custom_metric_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).archive_custom_metric._get_unset_required_fields(jsonified_request) + ).get_data_stream._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -54898,7 +56293,7 @@ def test_archive_custom_metric_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).archive_custom_metric._get_unset_required_fields(jsonified_request) + ).get_data_stream._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -54912,7 +56307,7 @@ def test_archive_custom_metric_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.DataStream() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -54924,37 +56319,39 @@ def test_archive_custom_metric_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.archive_custom_metric(request) + response = client.get_data_stream(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_archive_custom_metric_rest_unset_required_fields(): +def test_get_data_stream_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.archive_custom_metric._get_unset_required_fields({}) + unset_fields = transport.get_data_stream._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_archive_custom_metric_rest_interceptors(null_interceptor): +def test_get_data_stream_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -54967,11 +56364,14 @@ def test_archive_custom_metric_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_archive_custom_metric" + transports.AnalyticsAdminServiceRestInterceptor, "post_get_data_stream" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_data_stream" ) as pre: pre.assert_not_called() - pb_message = analytics_admin.ArchiveCustomMetricRequest.pb( - analytics_admin.ArchiveCustomMetricRequest() + post.assert_not_called() + pb_message = analytics_admin.GetDataStreamRequest.pb( + analytics_admin.GetDataStreamRequest() ) transcode.return_value = { "method": "post", @@ -54983,15 +56383,17 @@ def test_archive_custom_metric_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = resources.DataStream.to_json(resources.DataStream()) - request = analytics_admin.ArchiveCustomMetricRequest() + request = analytics_admin.GetDataStreamRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = resources.DataStream() - client.archive_custom_metric( + client.get_data_stream( request, metadata=[ ("key", "val"), @@ -55000,10 +56402,11 @@ def test_archive_custom_metric_rest_interceptors(null_interceptor): ) pre.assert_called_once() + post.assert_called_once() -def test_archive_custom_metric_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ArchiveCustomMetricRequest +def test_get_data_stream_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetDataStreamRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -55011,7 +56414,7 @@ def test_archive_custom_metric_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/customMetrics/sample2"} + request_init = {"name": "properties/sample1/dataStreams/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -55023,10 +56426,10 @@ def test_archive_custom_metric_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.archive_custom_metric(request) + client.get_data_stream(request) -def test_archive_custom_metric_rest_flattened(): +def test_get_data_stream_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -55035,10 +56438,10 @@ def test_archive_custom_metric_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.DataStream() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/customMetrics/sample2"} + sample_request = {"name": "properties/sample1/dataStreams/sample2"} # get truthy value for each flattened field mock_args = dict( @@ -55049,24 +56452,25 @@ def test_archive_custom_metric_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.archive_custom_metric(**mock_args) + client.get_data_stream(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/customMetrics/*}:archive" - % client.transport._host, + "%s/v1alpha/{name=properties/*/dataStreams/*}" % client.transport._host, args[1], ) -def test_archive_custom_metric_rest_flattened_error(transport: str = "rest"): +def test_get_data_stream_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -55075,13 +56479,13 @@ def test_archive_custom_metric_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.archive_custom_metric( - analytics_admin.ArchiveCustomMetricRequest(), + client.get_data_stream( + analytics_admin.GetDataStreamRequest(), name="name_value", ) -def test_archive_custom_metric_rest_error(): +def test_get_data_stream_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -55090,60 +56494,58 @@ def test_archive_custom_metric_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetCustomMetricRequest, + analytics_admin.GetAudienceRequest, dict, ], ) -def test_get_custom_metric_rest(request_type): +def test_get_audience_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/customMetrics/sample2"} + request_init = {"name": "properties/sample1/audiences/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.CustomMetric( + return_value = audience.Audience( name="name_value", - parameter_name="parameter_name_value", display_name="display_name_value", description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, - restricted_metric_type=[ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ], + membership_duration_days=2561, + ads_personalization_enabled=True, + exclusion_duration_mode=audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = audience.Audience.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_custom_metric(request) + response = client.get_audience(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) + assert isinstance(response, audience.Audience) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" assert response.display_name == "display_name_value" assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT - assert response.restricted_metric_type == [ - resources.CustomMetric.RestrictedMetricType.COST_DATA - ] + assert response.membership_duration_days == 2561 + assert response.ads_personalization_enabled is True + assert ( + response.exclusion_duration_mode + == audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY + ) -def test_get_custom_metric_rest_required_fields( - request_type=analytics_admin.GetCustomMetricRequest, +def test_get_audience_rest_required_fields( + request_type=analytics_admin.GetAudienceRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -55163,7 +56565,7 @@ def test_get_custom_metric_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_custom_metric._get_unset_required_fields(jsonified_request) + ).get_audience._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -55172,7 +56574,7 @@ def test_get_custom_metric_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_custom_metric._get_unset_required_fields(jsonified_request) + ).get_audience._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -55186,7 +56588,7 @@ def test_get_custom_metric_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.CustomMetric() + return_value = audience.Audience() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -55206,30 +56608,31 @@ def test_get_custom_metric_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = audience.Audience.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_custom_metric(request) + response = client.get_audience(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_custom_metric_rest_unset_required_fields(): +def test_get_audience_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_custom_metric._get_unset_required_fields({}) + unset_fields = transport.get_audience._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_custom_metric_rest_interceptors(null_interceptor): +def test_get_audience_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -55242,14 +56645,14 @@ def test_get_custom_metric_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_custom_metric" + transports.AnalyticsAdminServiceRestInterceptor, "post_get_audience" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_custom_metric" + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_audience" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetCustomMetricRequest.pb( - analytics_admin.GetCustomMetricRequest() + pb_message = analytics_admin.GetAudienceRequest.pb( + analytics_admin.GetAudienceRequest() ) transcode.return_value = { "method": "post", @@ -55261,19 +56664,17 @@ def test_get_custom_metric_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.CustomMetric.to_json( - resources.CustomMetric() - ) + req.return_value._content = audience.Audience.to_json(audience.Audience()) - request = analytics_admin.GetCustomMetricRequest() + request = analytics_admin.GetAudienceRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.CustomMetric() + post.return_value = audience.Audience() - client.get_custom_metric( + client.get_audience( request, metadata=[ ("key", "val"), @@ -55285,8 +56686,8 @@ def test_get_custom_metric_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_custom_metric_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetCustomMetricRequest +def test_get_audience_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetAudienceRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -55294,7 +56695,7 @@ def test_get_custom_metric_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/customMetrics/sample2"} + request_init = {"name": "properties/sample1/audiences/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -55306,10 +56707,10 @@ def test_get_custom_metric_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_custom_metric(request) + client.get_audience(request) -def test_get_custom_metric_rest_flattened(): +def test_get_audience_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -55318,10 +56719,10 @@ def test_get_custom_metric_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.CustomMetric() + return_value = audience.Audience() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/customMetrics/sample2"} + sample_request = {"name": "properties/sample1/audiences/sample2"} # get truthy value for each flattened field mock_args = dict( @@ -55332,24 +56733,25 @@ def test_get_custom_metric_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = audience.Audience.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_custom_metric(**mock_args) + client.get_audience(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/customMetrics/*}" % client.transport._host, + "%s/v1alpha/{name=properties/*/audiences/*}" % client.transport._host, args[1], ) -def test_get_custom_metric_rest_flattened_error(transport: str = "rest"): +def test_get_audience_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -55358,13 +56760,13 @@ def test_get_custom_metric_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_custom_metric( - analytics_admin.GetCustomMetricRequest(), + client.get_audience( + analytics_admin.GetAudienceRequest(), name="name_value", ) -def test_get_custom_metric_rest_error(): +def test_get_audience_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -55373,56 +56775,50 @@ def test_get_custom_metric_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataRetentionSettingsRequest, + analytics_admin.ListAudiencesRequest, dict, ], ) -def test_get_data_retention_settings_rest(request_type): +def test_list_audiences_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/dataRetentionSettings"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DataRetentionSettings( - name="name_value", - event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, - reset_user_data_on_new_activity=True, + return_value = analytics_admin.ListAudiencesResponse( + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataRetentionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListAudiencesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_data_retention_settings(request) + response = client.list_audiences(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataRetentionSettings) - assert response.name == "name_value" - assert ( - response.event_data_retention - == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS - ) - assert response.reset_user_data_on_new_activity is True + assert isinstance(response, pagers.ListAudiencesPager) + assert response.next_page_token == "next_page_token_value" -def test_get_data_retention_settings_rest_required_fields( - request_type=analytics_admin.GetDataRetentionSettingsRequest, +def test_list_audiences_rest_required_fields( + request_type=analytics_admin.ListAudiencesRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -55437,21 +56833,28 @@ def test_get_data_retention_settings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_data_retention_settings._get_unset_required_fields(jsonified_request) + ).list_audiences._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_data_retention_settings._get_unset_required_fields(jsonified_request) + ).list_audiences._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -55460,7 +56863,7 @@ def test_get_data_retention_settings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.DataRetentionSettings() + return_value = analytics_admin.ListAudiencesResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -55480,30 +56883,39 @@ def test_get_data_retention_settings_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataRetentionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListAudiencesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_data_retention_settings(request) + response = client.list_audiences(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_data_retention_settings_rest_unset_required_fields(): +def test_list_audiences_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_data_retention_settings._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.list_audiences._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "pageSize", + "pageToken", + ) + ) + & set(("parent",)) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_data_retention_settings_rest_interceptors(null_interceptor): +def test_list_audiences_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -55516,16 +56928,14 @@ def test_get_data_retention_settings_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_get_data_retention_settings", + transports.AnalyticsAdminServiceRestInterceptor, "post_list_audiences" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_get_data_retention_settings", + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_audiences" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetDataRetentionSettingsRequest.pb( - analytics_admin.GetDataRetentionSettingsRequest() + pb_message = analytics_admin.ListAudiencesRequest.pb( + analytics_admin.ListAudiencesRequest() ) transcode.return_value = { "method": "post", @@ -55537,19 +56947,19 @@ def test_get_data_retention_settings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.DataRetentionSettings.to_json( - resources.DataRetentionSettings() + req.return_value._content = analytics_admin.ListAudiencesResponse.to_json( + analytics_admin.ListAudiencesResponse() ) - request = analytics_admin.GetDataRetentionSettingsRequest() + request = analytics_admin.ListAudiencesRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.DataRetentionSettings() + post.return_value = analytics_admin.ListAudiencesResponse() - client.get_data_retention_settings( + client.list_audiences( request, metadata=[ ("key", "val"), @@ -55561,9 +56971,8 @@ def test_get_data_retention_settings_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_data_retention_settings_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.GetDataRetentionSettingsRequest, +def test_list_audiences_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListAudiencesRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -55571,7 +56980,7 @@ def test_get_data_retention_settings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/dataRetentionSettings"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -55583,10 +56992,10 @@ def test_get_data_retention_settings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_data_retention_settings(request) + client.list_audiences(request) -def test_get_data_retention_settings_rest_flattened(): +def test_list_audiences_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -55595,39 +57004,39 @@ def test_get_data_retention_settings_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DataRetentionSettings() + return_value = analytics_admin.ListAudiencesResponse() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/dataRetentionSettings"} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataRetentionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListAudiencesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_data_retention_settings(**mock_args) + client.list_audiences(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/dataRetentionSettings}" - % client.transport._host, + "%s/v1alpha/{parent=properties/*}/audiences" % client.transport._host, args[1], ) -def test_get_data_retention_settings_rest_flattened_error(transport: str = "rest"): +def test_list_audiences_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -55636,77 +57045,262 @@ def test_get_data_retention_settings_rest_flattened_error(transport: str = "rest # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_data_retention_settings( - analytics_admin.GetDataRetentionSettingsRequest(), - name="name_value", + client.list_audiences( + analytics_admin.ListAudiencesRequest(), + parent="parent_value", ) -def test_get_data_retention_settings_rest_error(): +def test_list_audiences_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + audience.Audience(), + audience.Audience(), + ], + next_page_token="abc", + ), + analytics_admin.ListAudiencesResponse( + audiences=[], + next_page_token="def", + ), + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAudiencesResponse( + audiences=[ + audience.Audience(), + audience.Audience(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListAudiencesResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "properties/sample1"} + + pager = client.list_audiences(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, audience.Audience) for i in results) + + pages = list(client.list_audiences(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateDataRetentionSettingsRequest, + analytics_admin.CreateAudienceRequest, dict, ], ) -def test_update_data_retention_settings_rest(request_type): +def test_create_audience_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "data_retention_settings": {"name": "properties/sample1/dataRetentionSettings"} - } - request_init["data_retention_settings"] = { - "name": "properties/sample1/dataRetentionSettings", - "event_data_retention": 1, - "reset_user_data_on_new_activity": True, + request_init = {"parent": "properties/sample1"} + request_init["audience"] = { + "name": "name_value", + "display_name": "display_name_value", + "description": "description_value", + "membership_duration_days": 2561, + "ads_personalization_enabled": True, + "event_trigger": {"event_name": "event_name_value", "log_condition": 1}, + "exclusion_duration_mode": 1, + "filter_clauses": [ + { + "simple_filter": { + "scope": 1, + "filter_expression": { + "and_group": {"filter_expressions": {}}, + "or_group": {}, + "not_expression": {}, + "dimension_or_metric_filter": { + "string_filter": { + "match_type": 1, + "value": "value_value", + "case_sensitive": True, + }, + "in_list_filter": { + "values": ["values_value1", "values_value2"], + "case_sensitive": True, + }, + "numeric_filter": { + "operation": 1, + "value": { + "int64_value": 1073, + "double_value": 0.12710000000000002, + }, + }, + "between_filter": {"from_value": {}, "to_value": {}}, + "field_name": "field_name_value", + "at_any_point_in_time": True, + "in_any_n_day_period": 1994, + }, + "event_filter": { + "event_name": "event_name_value", + "event_parameter_filter_expression": {}, + }, + }, + }, + "sequence_filter": { + "scope": 1, + "sequence_maximum_duration": {"seconds": 751, "nanos": 543}, + "sequence_steps": [ + { + "scope": 1, + "immediately_follows": True, + "constraint_duration": {}, + "filter_expression": {}, + } + ], + }, + "clause_type": 1, + } + ], } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateAudienceRequest.meta.fields["audience"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["audience"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["audience"][field])): + del request_init["audience"][field][i][subfield] + else: + del request_init["audience"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DataRetentionSettings( + return_value = gaa_audience.Audience( name="name_value", - event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, - reset_user_data_on_new_activity=True, + display_name="display_name_value", + description="description_value", + membership_duration_days=2561, + ads_personalization_enabled=True, + exclusion_duration_mode=gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataRetentionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = gaa_audience.Audience.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_data_retention_settings(request) + response = client.create_audience(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataRetentionSettings) + assert isinstance(response, gaa_audience.Audience) assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.membership_duration_days == 2561 + assert response.ads_personalization_enabled is True assert ( - response.event_data_retention - == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + response.exclusion_duration_mode + == gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY ) - assert response.reset_user_data_on_new_activity is True -def test_update_data_retention_settings_rest_required_fields( - request_type=analytics_admin.UpdateDataRetentionSettingsRequest, +def test_create_audience_rest_required_fields( + request_type=analytics_admin.CreateAudienceRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -55721,19 +57315,21 @@ def test_update_data_retention_settings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_data_retention_settings._get_unset_required_fields(jsonified_request) + ).create_audience._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["parent"] = "parent_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_data_retention_settings._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + ).create_audience._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -55742,7 +57338,7 @@ def test_update_data_retention_settings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.DataRetentionSettings() + return_value = gaa_audience.Audience() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -55754,7 +57350,7 @@ def test_update_data_retention_settings_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "post", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -55763,40 +57359,39 @@ def test_update_data_retention_settings_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataRetentionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = gaa_audience.Audience.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_data_retention_settings(request) + response = client.create_audience(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_data_retention_settings_rest_unset_required_fields(): +def test_create_audience_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_data_retention_settings._get_unset_required_fields( - {} - ) + unset_fields = transport.create_audience._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("updateMask",)) + set(()) & set( ( - "dataRetentionSettings", - "updateMask", + "parent", + "audience", ) ) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_data_retention_settings_rest_interceptors(null_interceptor): +def test_create_audience_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -55809,16 +57404,14 @@ def test_update_data_retention_settings_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_update_data_retention_settings", + transports.AnalyticsAdminServiceRestInterceptor, "post_create_audience" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_update_data_retention_settings", + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_audience" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateDataRetentionSettingsRequest.pb( - analytics_admin.UpdateDataRetentionSettingsRequest() + pb_message = analytics_admin.CreateAudienceRequest.pb( + analytics_admin.CreateAudienceRequest() ) transcode.return_value = { "method": "post", @@ -55830,19 +57423,19 @@ def test_update_data_retention_settings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.DataRetentionSettings.to_json( - resources.DataRetentionSettings() + req.return_value._content = gaa_audience.Audience.to_json( + gaa_audience.Audience() ) - request = analytics_admin.UpdateDataRetentionSettingsRequest() + request = analytics_admin.CreateAudienceRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.DataRetentionSettings() + post.return_value = gaa_audience.Audience() - client.update_data_retention_settings( + client.create_audience( request, metadata=[ ("key", "val"), @@ -55854,9 +57447,8 @@ def test_update_data_retention_settings_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_data_retention_settings_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.UpdateDataRetentionSettingsRequest, +def test_create_audience_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateAudienceRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -55864,14 +57456,7 @@ def test_update_data_retention_settings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "data_retention_settings": {"name": "properties/sample1/dataRetentionSettings"} - } - request_init["data_retention_settings"] = { - "name": "properties/sample1/dataRetentionSettings", - "event_data_retention": 1, - "reset_user_data_on_new_activity": True, - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -55883,10 +57468,10 @@ def test_update_data_retention_settings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_data_retention_settings(request) + client.create_audience(request) -def test_update_data_retention_settings_rest_flattened(): +def test_create_audience_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -55895,44 +57480,40 @@ def test_update_data_retention_settings_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DataRetentionSettings() + return_value = gaa_audience.Audience() # get arguments that satisfy an http rule for this method - sample_request = { - "data_retention_settings": { - "name": "properties/sample1/dataRetentionSettings" - } - } + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - data_retention_settings=resources.DataRetentionSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + parent="parent_value", + audience=gaa_audience.Audience(name="name_value"), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataRetentionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = gaa_audience.Audience.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_data_retention_settings(**mock_args) + client.create_audience(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{data_retention_settings.name=properties/*/dataRetentionSettings}" - % client.transport._host, + "%s/v1alpha/{parent=properties/*}/audiences" % client.transport._host, args[1], ) -def test_update_data_retention_settings_rest_flattened_error(transport: str = "rest"): +def test_create_audience_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -55941,14 +57522,14 @@ def test_update_data_retention_settings_rest_flattened_error(transport: str = "r # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_data_retention_settings( - analytics_admin.UpdateDataRetentionSettingsRequest(), - data_retention_settings=resources.DataRetentionSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.create_audience( + analytics_admin.CreateAudienceRequest(), + parent="parent_value", + audience=gaa_audience.Audience(name="name_value"), ) -def test_update_data_retention_settings_rest_error(): +def test_create_audience_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -55957,73 +57538,189 @@ def test_update_data_retention_settings_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateDataStreamRequest, + analytics_admin.UpdateAudienceRequest, dict, ], ) -def test_create_data_stream_rest(request_type): +def test_update_audience_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["data_stream"] = { - "web_stream_data": { - "measurement_id": "measurement_id_value", - "firebase_app_id": "firebase_app_id_value", - "default_uri": "default_uri_value", - }, - "android_app_stream_data": { - "firebase_app_id": "firebase_app_id_value", - "package_name": "package_name_value", - }, - "ios_app_stream_data": { - "firebase_app_id": "firebase_app_id_value", - "bundle_id": "bundle_id_value", - }, - "name": "name_value", - "type_": 1, + request_init = {"audience": {"name": "properties/sample1/audiences/sample2"}} + request_init["audience"] = { + "name": "properties/sample1/audiences/sample2", "display_name": "display_name_value", - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, + "description": "description_value", + "membership_duration_days": 2561, + "ads_personalization_enabled": True, + "event_trigger": {"event_name": "event_name_value", "log_condition": 1}, + "exclusion_duration_mode": 1, + "filter_clauses": [ + { + "simple_filter": { + "scope": 1, + "filter_expression": { + "and_group": {"filter_expressions": {}}, + "or_group": {}, + "not_expression": {}, + "dimension_or_metric_filter": { + "string_filter": { + "match_type": 1, + "value": "value_value", + "case_sensitive": True, + }, + "in_list_filter": { + "values": ["values_value1", "values_value2"], + "case_sensitive": True, + }, + "numeric_filter": { + "operation": 1, + "value": { + "int64_value": 1073, + "double_value": 0.12710000000000002, + }, + }, + "between_filter": {"from_value": {}, "to_value": {}}, + "field_name": "field_name_value", + "at_any_point_in_time": True, + "in_any_n_day_period": 1994, + }, + "event_filter": { + "event_name": "event_name_value", + "event_parameter_filter_expression": {}, + }, + }, + }, + "sequence_filter": { + "scope": 1, + "sequence_maximum_duration": {"seconds": 751, "nanos": 543}, + "sequence_steps": [ + { + "scope": 1, + "immediately_follows": True, + "constraint_duration": {}, + "filter_expression": {}, + } + ], + }, + "clause_type": 1, + } + ], } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateAudienceRequest.meta.fields["audience"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["audience"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["audience"][field])): + del request_init["audience"][field][i][subfield] + else: + del request_init["audience"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DataStream( + return_value = gaa_audience.Audience( name="name_value", - type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, display_name="display_name_value", + description="description_value", + membership_duration_days=2561, + ads_personalization_enabled=True, + exclusion_duration_mode=gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = gaa_audience.Audience.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_data_stream(request) + response = client.update_audience(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataStream) + assert isinstance(response, gaa_audience.Audience) assert response.name == "name_value" - assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.membership_duration_days == 2561 + assert response.ads_personalization_enabled is True + assert ( + response.exclusion_duration_mode + == gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY + ) -def test_create_data_stream_rest_required_fields( - request_type=analytics_admin.CreateDataStreamRequest, +def test_update_audience_rest_required_fields( + request_type=analytics_admin.UpdateAudienceRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -56038,21 +57735,19 @@ def test_create_data_stream_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_data_stream._get_unset_required_fields(jsonified_request) + ).update_audience._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_data_stream._get_unset_required_fields(jsonified_request) + ).update_audience._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -56061,7 +57756,7 @@ def test_create_data_stream_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.DataStream() + return_value = gaa_audience.Audience() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -56073,7 +57768,7 @@ def test_create_data_stream_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "patch", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -56082,38 +57777,39 @@ def test_create_data_stream_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = gaa_audience.Audience.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_data_stream(request) + response = client.update_audience(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_data_stream_rest_unset_required_fields(): +def test_update_audience_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_data_stream._get_unset_required_fields({}) + unset_fields = transport.update_audience._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) + set(("updateMask",)) & set( ( - "parent", - "dataStream", + "audience", + "updateMask", ) ) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_data_stream_rest_interceptors(null_interceptor): +def test_update_audience_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -56126,14 +57822,14 @@ def test_create_data_stream_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_data_stream" + transports.AnalyticsAdminServiceRestInterceptor, "post_update_audience" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_data_stream" + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_audience" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateDataStreamRequest.pb( - analytics_admin.CreateDataStreamRequest() + pb_message = analytics_admin.UpdateAudienceRequest.pb( + analytics_admin.UpdateAudienceRequest() ) transcode.return_value = { "method": "post", @@ -56145,17 +57841,19 @@ def test_create_data_stream_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.DataStream.to_json(resources.DataStream()) + req.return_value._content = gaa_audience.Audience.to_json( + gaa_audience.Audience() + ) - request = analytics_admin.CreateDataStreamRequest() + request = analytics_admin.UpdateAudienceRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.DataStream() + post.return_value = gaa_audience.Audience() - client.create_data_stream( + client.update_audience( request, metadata=[ ("key", "val"), @@ -56167,8 +57865,8 @@ def test_create_data_stream_rest_interceptors(null_interceptor): post.assert_called_once() -def test_create_data_stream_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateDataStreamRequest +def test_update_audience_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateAudienceRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -56176,27 +57874,7 @@ def test_create_data_stream_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["data_stream"] = { - "web_stream_data": { - "measurement_id": "measurement_id_value", - "firebase_app_id": "firebase_app_id_value", - "default_uri": "default_uri_value", - }, - "android_app_stream_data": { - "firebase_app_id": "firebase_app_id_value", - "package_name": "package_name_value", - }, - "ios_app_stream_data": { - "firebase_app_id": "firebase_app_id_value", - "bundle_id": "bundle_id_value", - }, - "name": "name_value", - "type_": 1, - "display_name": "display_name_value", - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - } + request_init = {"audience": {"name": "properties/sample1/audiences/sample2"}} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -56208,10 +57886,10 @@ def test_create_data_stream_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_data_stream(request) + client.update_audience(request) -def test_create_data_stream_rest_flattened(): +def test_update_audience_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -56220,43 +57898,41 @@ def test_create_data_stream_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DataStream() + return_value = gaa_audience.Audience() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = {"audience": {"name": "properties/sample1/audiences/sample2"}} # get truthy value for each flattened field mock_args = dict( - parent="parent_value", - data_stream=resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ), + audience=gaa_audience.Audience(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = gaa_audience.Audience.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_data_stream(**mock_args) + client.update_audience(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/dataStreams" % client.transport._host, + "%s/v1alpha/{audience.name=properties/*/audiences/*}" + % client.transport._host, args[1], ) -def test_create_data_stream_rest_flattened_error(transport: str = "rest"): +def test_update_audience_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -56265,18 +57941,14 @@ def test_create_data_stream_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_data_stream( - analytics_admin.CreateDataStreamRequest(), - parent="parent_value", - data_stream=resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ), + client.update_audience( + analytics_admin.UpdateAudienceRequest(), + audience=gaa_audience.Audience(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_create_data_stream_rest_error(): +def test_update_audience_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -56285,18 +57957,18 @@ def test_create_data_stream_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteDataStreamRequest, + analytics_admin.ArchiveAudienceRequest, dict, ], ) -def test_delete_data_stream_rest(request_type): +def test_archive_audience_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/dataStreams/sample2"} + request_init = {"name": "properties/sample1/audiences/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -56311,14 +57983,14 @@ def test_delete_data_stream_rest(request_type): response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_data_stream(request) + response = client.archive_audience(request) # Establish that the response is the type that we expect. assert response is None -def test_delete_data_stream_rest_required_fields( - request_type=analytics_admin.DeleteDataStreamRequest, +def test_archive_audience_rest_required_fields( + request_type=analytics_admin.ArchiveAudienceRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -56338,7 +58010,7 @@ def test_delete_data_stream_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_data_stream._get_unset_required_fields(jsonified_request) + ).archive_audience._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -56347,7 +58019,7 @@ def test_delete_data_stream_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_data_stream._get_unset_required_fields(jsonified_request) + ).archive_audience._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -56373,9 +58045,10 @@ def test_delete_data_stream_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() @@ -56385,24 +58058,24 @@ def test_delete_data_stream_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_data_stream(request) + response = client.archive_audience(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_data_stream_rest_unset_required_fields(): +def test_archive_audience_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_data_stream._get_unset_required_fields({}) + unset_fields = transport.archive_audience._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_data_stream_rest_interceptors(null_interceptor): +def test_archive_audience_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -56415,11 +58088,11 @@ def test_delete_data_stream_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_data_stream" + transports.AnalyticsAdminServiceRestInterceptor, "pre_archive_audience" ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteDataStreamRequest.pb( - analytics_admin.DeleteDataStreamRequest() + pb_message = analytics_admin.ArchiveAudienceRequest.pb( + analytics_admin.ArchiveAudienceRequest() ) transcode.return_value = { "method": "post", @@ -56432,14 +58105,14 @@ def test_delete_data_stream_rest_interceptors(null_interceptor): req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - request = analytics_admin.DeleteDataStreamRequest() + request = analytics_admin.ArchiveAudienceRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - client.delete_data_stream( + client.archive_audience( request, metadata=[ ("key", "val"), @@ -56450,8 +58123,8 @@ def test_delete_data_stream_rest_interceptors(null_interceptor): pre.assert_called_once() -def test_delete_data_stream_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteDataStreamRequest +def test_archive_audience_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ArchiveAudienceRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -56459,7 +58132,7 @@ def test_delete_data_stream_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/dataStreams/sample2"} + request_init = {"name": "properties/sample1/audiences/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -56471,64 +58144,10 @@ def test_delete_data_stream_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_data_stream(request) - - -def test_delete_data_stream_rest_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = None - - # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/dataStreams/sample2"} - - # get truthy value for each flattened field - mock_args = dict( - name="name_value", - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = "" - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.delete_data_stream(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{name=properties/*/dataStreams/*}" % client.transport._host, - args[1], - ) - - -def test_delete_data_stream_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_data_stream( - analytics_admin.DeleteDataStreamRequest(), - name="name_value", - ) + client.archive_audience(request) -def test_delete_data_stream_rest_error(): +def test_archive_audience_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -56537,72 +58156,54 @@ def test_delete_data_stream_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateDataStreamRequest, + analytics_admin.GetSearchAds360LinkRequest, dict, ], ) -def test_update_data_stream_rest(request_type): +def test_get_search_ads360_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"data_stream": {"name": "properties/sample1/dataStreams/sample2"}} - request_init["data_stream"] = { - "web_stream_data": { - "measurement_id": "measurement_id_value", - "firebase_app_id": "firebase_app_id_value", - "default_uri": "default_uri_value", - }, - "android_app_stream_data": { - "firebase_app_id": "firebase_app_id_value", - "package_name": "package_name_value", - }, - "ios_app_stream_data": { - "firebase_app_id": "firebase_app_id_value", - "bundle_id": "bundle_id_value", - }, - "name": "properties/sample1/dataStreams/sample2", - "type_": 1, - "display_name": "display_name_value", - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - } + request_init = {"name": "properties/sample1/searchAds360Links/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DataStream( + return_value = resources.SearchAds360Link( name="name_value", - type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, - display_name="display_name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SearchAds360Link.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_data_stream(request) + response = client.get_search_ads360_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataStream) + assert isinstance(response, resources.SearchAds360Link) assert response.name == "name_value" - assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM - assert response.display_name == "display_name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_update_data_stream_rest_required_fields( - request_type=analytics_admin.UpdateDataStreamRequest, +def test_get_search_ads360_link_rest_required_fields( + request_type=analytics_admin.GetSearchAds360LinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -56617,19 +58218,21 @@ def test_update_data_stream_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_data_stream._get_unset_required_fields(jsonified_request) + ).get_search_ads360_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["name"] = "name_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_data_stream._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + ).get_search_ads360_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -56638,7 +58241,7 @@ def test_update_data_stream_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.DataStream() + return_value = resources.SearchAds360Link() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -56650,39 +58253,39 @@ def test_update_data_stream_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SearchAds360Link.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_data_stream(request) + response = client.get_search_ads360_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_data_stream_rest_unset_required_fields(): +def test_get_search_ads360_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_data_stream._get_unset_required_fields({}) - assert set(unset_fields) == (set(("updateMask",)) & set(("updateMask",))) + unset_fields = transport.get_search_ads360_link._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_data_stream_rest_interceptors(null_interceptor): +def test_get_search_ads360_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -56695,14 +58298,14 @@ def test_update_data_stream_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_data_stream" + transports.AnalyticsAdminServiceRestInterceptor, "post_get_search_ads360_link" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_data_stream" + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_search_ads360_link" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateDataStreamRequest.pb( - analytics_admin.UpdateDataStreamRequest() + pb_message = analytics_admin.GetSearchAds360LinkRequest.pb( + analytics_admin.GetSearchAds360LinkRequest() ) transcode.return_value = { "method": "post", @@ -56714,17 +58317,19 @@ def test_update_data_stream_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.DataStream.to_json(resources.DataStream()) + req.return_value._content = resources.SearchAds360Link.to_json( + resources.SearchAds360Link() + ) - request = analytics_admin.UpdateDataStreamRequest() + request = analytics_admin.GetSearchAds360LinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.DataStream() + post.return_value = resources.SearchAds360Link() - client.update_data_stream( + client.get_search_ads360_link( request, metadata=[ ("key", "val"), @@ -56736,8 +58341,8 @@ def test_update_data_stream_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_data_stream_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateDataStreamRequest +def test_get_search_ads360_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetSearchAds360LinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -56745,27 +58350,7 @@ def test_update_data_stream_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"data_stream": {"name": "properties/sample1/dataStreams/sample2"}} - request_init["data_stream"] = { - "web_stream_data": { - "measurement_id": "measurement_id_value", - "firebase_app_id": "firebase_app_id_value", - "default_uri": "default_uri_value", - }, - "android_app_stream_data": { - "firebase_app_id": "firebase_app_id_value", - "package_name": "package_name_value", - }, - "ios_app_stream_data": { - "firebase_app_id": "firebase_app_id_value", - "bundle_id": "bundle_id_value", - }, - "name": "properties/sample1/dataStreams/sample2", - "type_": 1, - "display_name": "display_name_value", - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - } + request_init = {"name": "properties/sample1/searchAds360Links/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -56777,10 +58362,10 @@ def test_update_data_stream_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_data_stream(request) + client.get_search_ads360_link(request) -def test_update_data_stream_rest_flattened(): +def test_get_search_ads360_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -56789,46 +58374,40 @@ def test_update_data_stream_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DataStream() + return_value = resources.SearchAds360Link() # get arguments that satisfy an http rule for this method - sample_request = { - "data_stream": {"name": "properties/sample1/dataStreams/sample2"} - } + sample_request = {"name": "properties/sample1/searchAds360Links/sample2"} # get truthy value for each flattened field mock_args = dict( - data_stream=resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SearchAds360Link.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_data_stream(**mock_args) + client.get_search_ads360_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{data_stream.name=properties/*/dataStreams/*}" + "%s/v1alpha/{name=properties/*/searchAds360Links/*}" % client.transport._host, args[1], ) -def test_update_data_stream_rest_flattened_error(transport: str = "rest"): +def test_get_search_ads360_link_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -56837,18 +58416,13 @@ def test_update_data_stream_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_data_stream( - analytics_admin.UpdateDataStreamRequest(), - data_stream=resources.DataStream( - web_stream_data=resources.DataStream.WebStreamData( - measurement_id="measurement_id_value" - ) - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.get_search_ads360_link( + analytics_admin.GetSearchAds360LinkRequest(), + name="name_value", ) -def test_update_data_stream_rest_error(): +def test_get_search_ads360_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -56857,11 +58431,11 @@ def test_update_data_stream_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListDataStreamsRequest, + analytics_admin.ListSearchAds360LinksRequest, dict, ], ) -def test_list_data_streams_rest(request_type): +def test_list_search_ads360_links_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -56874,27 +58448,28 @@ def test_list_data_streams_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListDataStreamsResponse( + return_value = analytics_admin.ListSearchAds360LinksResponse( next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListDataStreamsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListSearchAds360LinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_data_streams(request) + response = client.list_search_ads360_links(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListDataStreamsPager) + assert isinstance(response, pagers.ListSearchAds360LinksPager) assert response.next_page_token == "next_page_token_value" -def test_list_data_streams_rest_required_fields( - request_type=analytics_admin.ListDataStreamsRequest, +def test_list_search_ads360_links_rest_required_fields( + request_type=analytics_admin.ListSearchAds360LinksRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -56914,7 +58489,7 @@ def test_list_data_streams_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_data_streams._get_unset_required_fields(jsonified_request) + ).list_search_ads360_links._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -56923,7 +58498,7 @@ def test_list_data_streams_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_data_streams._get_unset_required_fields(jsonified_request) + ).list_search_ads360_links._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( ( @@ -56944,7 +58519,7 @@ def test_list_data_streams_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListDataStreamsResponse() + return_value = analytics_admin.ListSearchAds360LinksResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -56964,25 +58539,28 @@ def test_list_data_streams_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListDataStreamsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListSearchAds360LinksResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_data_streams(request) + response = client.list_search_ads360_links(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_data_streams_rest_unset_required_fields(): +def test_list_search_ads360_links_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_data_streams._get_unset_required_fields({}) + unset_fields = transport.list_search_ads360_links._get_unset_required_fields({}) assert set(unset_fields) == ( set( ( @@ -56995,7 +58573,7 @@ def test_list_data_streams_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_data_streams_rest_interceptors(null_interceptor): +def test_list_search_ads360_links_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -57008,14 +58586,14 @@ def test_list_data_streams_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_data_streams" + transports.AnalyticsAdminServiceRestInterceptor, "post_list_search_ads360_links" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_data_streams" + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_search_ads360_links" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListDataStreamsRequest.pb( - analytics_admin.ListDataStreamsRequest() + pb_message = analytics_admin.ListSearchAds360LinksRequest.pb( + analytics_admin.ListSearchAds360LinksRequest() ) transcode.return_value = { "method": "post", @@ -57027,19 +58605,21 @@ def test_list_data_streams_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ListDataStreamsResponse.to_json( - analytics_admin.ListDataStreamsResponse() + req.return_value._content = ( + analytics_admin.ListSearchAds360LinksResponse.to_json( + analytics_admin.ListSearchAds360LinksResponse() + ) ) - request = analytics_admin.ListDataStreamsRequest() + request = analytics_admin.ListSearchAds360LinksRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListDataStreamsResponse() + post.return_value = analytics_admin.ListSearchAds360LinksResponse() - client.list_data_streams( + client.list_search_ads360_links( request, metadata=[ ("key", "val"), @@ -57051,8 +58631,8 @@ def test_list_data_streams_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_data_streams_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListDataStreamsRequest +def test_list_search_ads360_links_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListSearchAds360LinksRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -57072,10 +58652,10 @@ def test_list_data_streams_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_data_streams(request) + client.list_search_ads360_links(request) -def test_list_data_streams_rest_flattened(): +def test_list_search_ads360_links_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -57084,7 +58664,7 @@ def test_list_data_streams_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListDataStreamsResponse() + return_value = analytics_admin.ListSearchAds360LinksResponse() # get arguments that satisfy an http rule for this method sample_request = {"parent": "properties/sample1"} @@ -57098,24 +58678,26 @@ def test_list_data_streams_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListDataStreamsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListSearchAds360LinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_data_streams(**mock_args) + client.list_search_ads360_links(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/dataStreams" % client.transport._host, + "%s/v1alpha/{parent=properties/*}/searchAds360Links" + % client.transport._host, args[1], ) -def test_list_data_streams_rest_flattened_error(transport: str = "rest"): +def test_list_search_ads360_links_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -57124,13 +58706,13 @@ def test_list_data_streams_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_data_streams( - analytics_admin.ListDataStreamsRequest(), + client.list_search_ads360_links( + analytics_admin.ListSearchAds360LinksRequest(), parent="parent_value", ) -def test_list_data_streams_rest_pager(transport: str = "rest"): +def test_list_search_ads360_links_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -57142,28 +58724,28 @@ def test_list_data_streams_rest_pager(transport: str = "rest"): # with mock.patch.object(path_template, 'transcode') as transcode: # Set the response as a series of pages response = ( - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), - resources.DataStream(), - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), + resources.SearchAds360Link(), + resources.SearchAds360Link(), ], next_page_token="abc", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[], + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[], next_page_token="def", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), ], next_page_token="ghi", ), - analytics_admin.ListDataStreamsResponse( - data_streams=[ - resources.DataStream(), - resources.DataStream(), + analytics_admin.ListSearchAds360LinksResponse( + search_ads_360_links=[ + resources.SearchAds360Link(), + resources.SearchAds360Link(), ], ), ) @@ -57172,7 +58754,7 @@ def test_list_data_streams_rest_pager(transport: str = "rest"): # Wrap the values into proper Response objs response = tuple( - analytics_admin.ListDataStreamsResponse.to_json(x) for x in response + analytics_admin.ListSearchAds360LinksResponse.to_json(x) for x in response ) return_values = tuple(Response() for i in response) for return_val, response_val in zip(return_values, response): @@ -57182,13 +58764,13 @@ def test_list_data_streams_rest_pager(transport: str = "rest"): sample_request = {"parent": "properties/sample1"} - pager = client.list_data_streams(request=sample_request) + pager = client.list_search_ads360_links(request=sample_request) results = list(pager) assert len(results) == 6 - assert all(isinstance(i, resources.DataStream) for i in results) + assert all(isinstance(i, resources.SearchAds360Link) for i in results) - pages = list(client.list_data_streams(request=sample_request).pages) + pages = list(client.list_search_ads360_links(request=sample_request).pages) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -57196,53 +58778,132 @@ def test_list_data_streams_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetDataStreamRequest, + analytics_admin.CreateSearchAds360LinkRequest, dict, ], ) -def test_get_data_stream_rest(request_type): +def test_create_search_ads360_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/dataStreams/sample2"} + request_init = {"parent": "properties/sample1"} + request_init["search_ads_360_link"] = { + "name": "name_value", + "advertiser_id": "advertiser_id_value", + "campaign_data_sharing_enabled": {"value": True}, + "cost_data_sharing_enabled": {}, + "advertiser_display_name": "advertiser_display_name_value", + "ads_personalization_enabled": {}, + "site_stats_sharing_enabled": {}, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateSearchAds360LinkRequest.meta.fields[ + "search_ads_360_link" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["search_ads_360_link"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["search_ads_360_link"][field])): + del request_init["search_ads_360_link"][field][i][subfield] + else: + del request_init["search_ads_360_link"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DataStream( + return_value = resources.SearchAds360Link( name="name_value", - type_=resources.DataStream.DataStreamType.WEB_DATA_STREAM, - display_name="display_name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SearchAds360Link.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_data_stream(request) + response = client.create_search_ads360_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.DataStream) + assert isinstance(response, resources.SearchAds360Link) assert response.name == "name_value" - assert response.type_ == resources.DataStream.DataStreamType.WEB_DATA_STREAM - assert response.display_name == "display_name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_get_data_stream_rest_required_fields( - request_type=analytics_admin.GetDataStreamRequest, +def test_create_search_ads360_link_rest_required_fields( + request_type=analytics_admin.CreateSearchAds360LinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -57257,21 +58918,21 @@ def test_get_data_stream_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_data_stream._get_unset_required_fields(jsonified_request) + ).create_search_ads360_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_data_stream._get_unset_required_fields(jsonified_request) + ).create_search_ads360_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -57280,7 +58941,7 @@ def test_get_data_stream_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.DataStream() + return_value = resources.SearchAds360Link() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -57292,38 +58953,48 @@ def test_get_data_stream_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SearchAds360Link.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_data_stream(request) + response = client.create_search_ads360_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_data_stream_rest_unset_required_fields(): +def test_create_search_ads360_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_data_stream._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.create_search_ads360_link._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "searchAds360Link", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_data_stream_rest_interceptors(null_interceptor): +def test_create_search_ads360_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -57336,14 +59007,15 @@ def test_get_data_stream_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_data_stream" + transports.AnalyticsAdminServiceRestInterceptor, + "post_create_search_ads360_link", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_data_stream" + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_search_ads360_link" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetDataStreamRequest.pb( - analytics_admin.GetDataStreamRequest() + pb_message = analytics_admin.CreateSearchAds360LinkRequest.pb( + analytics_admin.CreateSearchAds360LinkRequest() ) transcode.return_value = { "method": "post", @@ -57355,17 +59027,19 @@ def test_get_data_stream_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.DataStream.to_json(resources.DataStream()) + req.return_value._content = resources.SearchAds360Link.to_json( + resources.SearchAds360Link() + ) - request = analytics_admin.GetDataStreamRequest() + request = analytics_admin.CreateSearchAds360LinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.DataStream() + post.return_value = resources.SearchAds360Link() - client.get_data_stream( + client.create_search_ads360_link( request, metadata=[ ("key", "val"), @@ -57377,8 +59051,8 @@ def test_get_data_stream_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_data_stream_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetDataStreamRequest +def test_create_search_ads360_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateSearchAds360LinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -57386,7 +59060,7 @@ def test_get_data_stream_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/dataStreams/sample2"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -57398,10 +59072,10 @@ def test_get_data_stream_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_data_stream(request) + client.create_search_ads360_link(request) -def test_get_data_stream_rest_flattened(): +def test_create_search_ads360_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -57410,38 +59084,41 @@ def test_get_data_stream_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.DataStream() + return_value = resources.SearchAds360Link() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/dataStreams/sample2"} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", + search_ads_360_link=resources.SearchAds360Link(name="name_value"), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SearchAds360Link.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_data_stream(**mock_args) + client.create_search_ads360_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/dataStreams/*}" % client.transport._host, + "%s/v1alpha/{parent=properties/*}/searchAds360Links" + % client.transport._host, args[1], ) -def test_get_data_stream_rest_flattened_error(transport: str = "rest"): +def test_create_search_ads360_link_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -57450,13 +59127,14 @@ def test_get_data_stream_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_data_stream( - analytics_admin.GetDataStreamRequest(), - name="name_value", + client.create_search_ads360_link( + analytics_admin.CreateSearchAds360LinkRequest(), + parent="parent_value", + search_ads_360_link=resources.SearchAds360Link(name="name_value"), ) -def test_get_data_stream_rest_error(): +def test_create_search_ads360_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -57465,57 +59143,40 @@ def test_get_data_stream_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAudienceRequest, + analytics_admin.DeleteSearchAds360LinkRequest, dict, ], ) -def test_get_audience_rest(request_type): +def test_delete_search_ads360_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/audiences/sample2"} + request_init = {"name": "properties/sample1/searchAds360Links/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = audience.Audience( - name="name_value", - display_name="display_name_value", - description="description_value", - membership_duration_days=2561, - ads_personalization_enabled=True, - exclusion_duration_mode=audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = audience.Audience.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_audience(request) + response = client.delete_search_ads360_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, audience.Audience) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.membership_duration_days == 2561 - assert response.ads_personalization_enabled is True - assert ( - response.exclusion_duration_mode - == audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY - ) + assert response is None -def test_get_audience_rest_required_fields( - request_type=analytics_admin.GetAudienceRequest, +def test_delete_search_ads360_link_rest_required_fields( + request_type=analytics_admin.DeleteSearchAds360LinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -57535,7 +59196,7 @@ def test_get_audience_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_audience._get_unset_required_fields(jsonified_request) + ).delete_search_ads360_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -57544,7 +59205,7 @@ def test_get_audience_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_audience._get_unset_required_fields(jsonified_request) + ).delete_search_ads360_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -57558,7 +59219,7 @@ def test_get_audience_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = audience.Audience() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -57570,38 +59231,36 @@ def test_get_audience_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "delete", "query_params": pb_request, } transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = audience.Audience.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_audience(request) + response = client.delete_search_ads360_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_audience_rest_unset_required_fields(): +def test_delete_search_ads360_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_audience._get_unset_required_fields({}) + unset_fields = transport.delete_search_ads360_link._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_audience_rest_interceptors(null_interceptor): +def test_delete_search_ads360_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -57614,14 +59273,11 @@ def test_get_audience_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_audience" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_audience" + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_search_ads360_link" ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.GetAudienceRequest.pb( - analytics_admin.GetAudienceRequest() + pb_message = analytics_admin.DeleteSearchAds360LinkRequest.pb( + analytics_admin.DeleteSearchAds360LinkRequest() ) transcode.return_value = { "method": "post", @@ -57633,17 +59289,15 @@ def test_get_audience_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = audience.Audience.to_json(audience.Audience()) - request = analytics_admin.GetAudienceRequest() + request = analytics_admin.DeleteSearchAds360LinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = audience.Audience() - client.get_audience( + client.delete_search_ads360_link( request, metadata=[ ("key", "val"), @@ -57652,11 +59306,10 @@ def test_get_audience_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_get_audience_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetAudienceRequest +def test_delete_search_ads360_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeleteSearchAds360LinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -57664,7 +59317,7 @@ def test_get_audience_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/audiences/sample2"} + request_init = {"name": "properties/sample1/searchAds360Links/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -57676,10 +59329,10 @@ def test_get_audience_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_audience(request) + client.delete_search_ads360_link(request) -def test_get_audience_rest_flattened(): +def test_delete_search_ads360_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -57688,10 +59341,10 @@ def test_get_audience_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = audience.Audience() + return_value = None # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/audiences/sample2"} + sample_request = {"name": "properties/sample1/searchAds360Links/sample2"} # get truthy value for each flattened field mock_args = dict( @@ -57702,24 +59355,24 @@ def test_get_audience_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = audience.Audience.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_audience(**mock_args) + client.delete_search_ads360_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/audiences/*}" % client.transport._host, + "%s/v1alpha/{name=properties/*/searchAds360Links/*}" + % client.transport._host, args[1], ) -def test_get_audience_rest_flattened_error(transport: str = "rest"): +def test_delete_search_ads360_link_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -57728,13 +59381,13 @@ def test_get_audience_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_audience( - analytics_admin.GetAudienceRequest(), + client.delete_search_ads360_link( + analytics_admin.DeleteSearchAds360LinkRequest(), name="name_value", ) -def test_get_audience_rest_error(): +def test_delete_search_ads360_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -57743,49 +59396,133 @@ def test_get_audience_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAudiencesRequest, + analytics_admin.UpdateSearchAds360LinkRequest, dict, ], ) -def test_list_audiences_rest(request_type): +def test_update_search_ads360_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = { + "search_ads_360_link": {"name": "properties/sample1/searchAds360Links/sample2"} + } + request_init["search_ads_360_link"] = { + "name": "properties/sample1/searchAds360Links/sample2", + "advertiser_id": "advertiser_id_value", + "campaign_data_sharing_enabled": {"value": True}, + "cost_data_sharing_enabled": {}, + "advertiser_display_name": "advertiser_display_name_value", + "ads_personalization_enabled": {}, + "site_stats_sharing_enabled": {}, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateSearchAds360LinkRequest.meta.fields[ + "search_ads_360_link" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["search_ads_360_link"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["search_ads_360_link"][field])): + del request_init["search_ads_360_link"][field][i][subfield] + else: + del request_init["search_ads_360_link"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListAudiencesResponse( - next_page_token="next_page_token_value", + return_value = resources.SearchAds360Link( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListAudiencesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SearchAds360Link.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_audiences(request) + response = client.update_search_ads360_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAudiencesPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.SearchAds360Link) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_list_audiences_rest_required_fields( - request_type=analytics_admin.ListAudiencesRequest, +def test_update_search_ads360_link_rest_required_fields( + request_type=analytics_admin.UpdateSearchAds360LinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -57800,28 +59537,19 @@ def test_list_audiences_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_audiences._get_unset_required_fields(jsonified_request) + ).update_search_ads360_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_audiences._get_unset_required_fields(jsonified_request) + ).update_search_ads360_link._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) - ) + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -57830,7 +59558,7 @@ def test_list_audiences_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListAudiencesResponse() + return_value = resources.SearchAds360Link() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -57842,46 +59570,40 @@ def test_list_audiences_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "patch", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListAudiencesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SearchAds360Link.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_audiences(request) + response = client.update_search_ads360_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_audiences_rest_unset_required_fields(): +def test_update_search_ads360_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_audiences._get_unset_required_fields({}) - assert set(unset_fields) == ( - set( - ( - "pageSize", - "pageToken", - ) - ) - & set(("parent",)) - ) + unset_fields = transport.update_search_ads360_link._get_unset_required_fields({}) + assert set(unset_fields) == (set(("updateMask",)) & set(("updateMask",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_audiences_rest_interceptors(null_interceptor): +def test_update_search_ads360_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -57894,14 +59616,15 @@ def test_list_audiences_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_audiences" + transports.AnalyticsAdminServiceRestInterceptor, + "post_update_search_ads360_link", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_audiences" + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_search_ads360_link" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListAudiencesRequest.pb( - analytics_admin.ListAudiencesRequest() + pb_message = analytics_admin.UpdateSearchAds360LinkRequest.pb( + analytics_admin.UpdateSearchAds360LinkRequest() ) transcode.return_value = { "method": "post", @@ -57913,19 +59636,19 @@ def test_list_audiences_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ListAudiencesResponse.to_json( - analytics_admin.ListAudiencesResponse() + req.return_value._content = resources.SearchAds360Link.to_json( + resources.SearchAds360Link() ) - request = analytics_admin.ListAudiencesRequest() + request = analytics_admin.UpdateSearchAds360LinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListAudiencesResponse() + post.return_value = resources.SearchAds360Link() - client.list_audiences( + client.update_search_ads360_link( request, metadata=[ ("key", "val"), @@ -57937,8 +59660,8 @@ def test_list_audiences_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_audiences_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListAudiencesRequest +def test_update_search_ads360_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateSearchAds360LinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -57946,7 +59669,9 @@ def test_list_audiences_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = { + "search_ads_360_link": {"name": "properties/sample1/searchAds360Links/sample2"} + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -57958,10 +59683,10 @@ def test_list_audiences_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_audiences(request) + client.update_search_ads360_link(request) -def test_list_audiences_rest_flattened(): +def test_update_search_ads360_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -57970,38 +59695,45 @@ def test_list_audiences_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListAudiencesResponse() + return_value = resources.SearchAds360Link() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = { + "search_ads_360_link": { + "name": "properties/sample1/searchAds360Links/sample2" + } + } # get truthy value for each flattened field mock_args = dict( - parent="parent_value", + search_ads_360_link=resources.SearchAds360Link(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListAudiencesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.SearchAds360Link.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_audiences(**mock_args) + client.update_search_ads360_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/audiences" % client.transport._host, + "%s/v1alpha/{search_ads_360_link.name=properties/*/searchAds360Links/*}" + % client.transport._host, args[1], ) -def test_list_audiences_rest_flattened_error(transport: str = "rest"): +def test_update_search_ads360_link_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -58010,194 +59742,86 @@ def test_list_audiences_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_audiences( - analytics_admin.ListAudiencesRequest(), - parent="parent_value", + client.update_search_ads360_link( + analytics_admin.UpdateSearchAds360LinkRequest(), + search_ads_360_link=resources.SearchAds360Link(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_list_audiences_rest_pager(transport: str = "rest"): +def test_update_search_ads360_link_rest_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - audience.Audience(), - audience.Audience(), - ], - next_page_token="abc", - ), - analytics_admin.ListAudiencesResponse( - audiences=[], - next_page_token="def", - ), - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAudiencesResponse( - audiences=[ - audience.Audience(), - audience.Audience(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListAudiencesResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "properties/sample1"} - - pager = client.list_audiences(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, audience.Audience) for i in results) - - pages = list(client.list_audiences(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateAudienceRequest, + analytics_admin.GetAttributionSettingsRequest, dict, ], ) -def test_create_audience_rest(request_type): +def test_get_attribution_settings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["audience"] = { - "name": "name_value", - "display_name": "display_name_value", - "description": "description_value", - "membership_duration_days": 2561, - "ads_personalization_enabled": True, - "event_trigger": {"event_name": "event_name_value", "log_condition": 1}, - "exclusion_duration_mode": 1, - "filter_clauses": [ - { - "simple_filter": { - "scope": 1, - "filter_expression": { - "and_group": {"filter_expressions": {}}, - "or_group": {}, - "not_expression": {}, - "dimension_or_metric_filter": { - "string_filter": { - "match_type": 1, - "value": "value_value", - "case_sensitive": True, - }, - "in_list_filter": { - "values": ["values_value1", "values_value2"], - "case_sensitive": True, - }, - "numeric_filter": { - "operation": 1, - "value": { - "int64_value": 1073, - "double_value": 0.12710000000000002, - }, - }, - "between_filter": {"from_value": {}, "to_value": {}}, - "field_name": "field_name_value", - "at_any_point_in_time": True, - "in_any_n_day_period": 1994, - }, - "event_filter": { - "event_name": "event_name_value", - "event_parameter_filter_expression": {}, - }, - }, - }, - "sequence_filter": { - "scope": 1, - "sequence_maximum_duration": {"seconds": 751, "nanos": 543}, - "sequence_steps": [ - { - "scope": 1, - "immediately_follows": True, - "constraint_duration": {}, - "filter_expression": {}, - } - ], - }, - "clause_type": 1, - } - ], - } + request_init = {"name": "properties/sample1/attributionSettings"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = gaa_audience.Audience( + return_value = resources.AttributionSettings( name="name_value", - display_name="display_name_value", - description="description_value", - membership_duration_days=2561, - ads_personalization_enabled=True, - exclusion_duration_mode=gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, + acquisition_conversion_event_lookback_window=resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS, + other_conversion_event_lookback_window=resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS, + reporting_attribution_model=resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN, + ads_web_conversion_data_export_scope=resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_audience.Audience.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AttributionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_audience(request) + response = client.get_attribution_settings(request) # Establish that the response is the type that we expect. - assert isinstance(response, gaa_audience.Audience) + assert isinstance(response, resources.AttributionSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.membership_duration_days == 2561 - assert response.ads_personalization_enabled is True assert ( - response.exclusion_duration_mode - == gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY + response.acquisition_conversion_event_lookback_window + == resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS + ) + assert ( + response.other_conversion_event_lookback_window + == resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS + ) + assert ( + response.reporting_attribution_model + == resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN + ) + assert ( + response.ads_web_conversion_data_export_scope + == resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET ) -def test_create_audience_rest_required_fields( - request_type=analytics_admin.CreateAudienceRequest, +def test_get_attribution_settings_rest_required_fields( + request_type=analytics_admin.GetAttributionSettingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -58212,21 +59836,21 @@ def test_create_audience_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_audience._get_unset_required_fields(jsonified_request) + ).get_attribution_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_audience._get_unset_required_fields(jsonified_request) + ).get_attribution_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -58235,7 +59859,7 @@ def test_create_audience_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = gaa_audience.Audience() + return_value = resources.AttributionSettings() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -58247,47 +59871,39 @@ def test_create_audience_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_audience.Audience.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AttributionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_audience(request) + response = client.get_attribution_settings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_audience_rest_unset_required_fields(): +def test_get_attribution_settings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_audience._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(()) - & set( - ( - "parent", - "audience", - ) - ) - ) + unset_fields = transport.get_attribution_settings._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_audience_rest_interceptors(null_interceptor): +def test_get_attribution_settings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -58300,14 +59916,14 @@ def test_create_audience_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_audience" + transports.AnalyticsAdminServiceRestInterceptor, "post_get_attribution_settings" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_audience" + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_attribution_settings" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateAudienceRequest.pb( - analytics_admin.CreateAudienceRequest() + pb_message = analytics_admin.GetAttributionSettingsRequest.pb( + analytics_admin.GetAttributionSettingsRequest() ) transcode.return_value = { "method": "post", @@ -58319,19 +59935,19 @@ def test_create_audience_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = gaa_audience.Audience.to_json( - gaa_audience.Audience() + req.return_value._content = resources.AttributionSettings.to_json( + resources.AttributionSettings() ) - request = analytics_admin.CreateAudienceRequest() + request = analytics_admin.GetAttributionSettingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = gaa_audience.Audience() + post.return_value = resources.AttributionSettings() - client.create_audience( + client.get_attribution_settings( request, metadata=[ ("key", "val"), @@ -58343,8 +59959,8 @@ def test_create_audience_rest_interceptors(null_interceptor): post.assert_called_once() -def test_create_audience_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateAudienceRequest +def test_get_attribution_settings_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetAttributionSettingsRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -58352,67 +59968,7 @@ def test_create_audience_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["audience"] = { - "name": "name_value", - "display_name": "display_name_value", - "description": "description_value", - "membership_duration_days": 2561, - "ads_personalization_enabled": True, - "event_trigger": {"event_name": "event_name_value", "log_condition": 1}, - "exclusion_duration_mode": 1, - "filter_clauses": [ - { - "simple_filter": { - "scope": 1, - "filter_expression": { - "and_group": {"filter_expressions": {}}, - "or_group": {}, - "not_expression": {}, - "dimension_or_metric_filter": { - "string_filter": { - "match_type": 1, - "value": "value_value", - "case_sensitive": True, - }, - "in_list_filter": { - "values": ["values_value1", "values_value2"], - "case_sensitive": True, - }, - "numeric_filter": { - "operation": 1, - "value": { - "int64_value": 1073, - "double_value": 0.12710000000000002, - }, - }, - "between_filter": {"from_value": {}, "to_value": {}}, - "field_name": "field_name_value", - "at_any_point_in_time": True, - "in_any_n_day_period": 1994, - }, - "event_filter": { - "event_name": "event_name_value", - "event_parameter_filter_expression": {}, - }, - }, - }, - "sequence_filter": { - "scope": 1, - "sequence_maximum_duration": {"seconds": 751, "nanos": 543}, - "sequence_steps": [ - { - "scope": 1, - "immediately_follows": True, - "constraint_duration": {}, - "filter_expression": {}, - } - ], - }, - "clause_type": 1, - } - ], - } + request_init = {"name": "properties/sample1/attributionSettings"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -58424,10 +59980,10 @@ def test_create_audience_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_audience(request) + client.get_attribution_settings(request) -def test_create_audience_rest_flattened(): +def test_get_attribution_settings_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -58436,39 +59992,40 @@ def test_create_audience_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = gaa_audience.Audience() + return_value = resources.AttributionSettings() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = {"name": "properties/sample1/attributionSettings"} # get truthy value for each flattened field mock_args = dict( - parent="parent_value", - audience=gaa_audience.Audience(name="name_value"), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_audience.Audience.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AttributionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_audience(**mock_args) + client.get_attribution_settings(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/audiences" % client.transport._host, + "%s/v1alpha/{name=properties/*/attributionSettings}" + % client.transport._host, args[1], ) -def test_create_audience_rest_flattened_error(transport: str = "rest"): +def test_get_attribution_settings_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -58477,14 +60034,13 @@ def test_create_audience_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_audience( - analytics_admin.CreateAudienceRequest(), - parent="parent_value", - audience=gaa_audience.Audience(name="name_value"), + client.get_attribution_settings( + analytics_admin.GetAttributionSettingsRequest(), + name="name_value", ) -def test_create_audience_rest_error(): +def test_get_attribution_settings_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -58493,117 +60049,145 @@ def test_create_audience_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateAudienceRequest, + analytics_admin.UpdateAttributionSettingsRequest, dict, ], ) -def test_update_audience_rest(request_type): +def test_update_attribution_settings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"audience": {"name": "properties/sample1/audiences/sample2"}} - request_init["audience"] = { - "name": "properties/sample1/audiences/sample2", - "display_name": "display_name_value", - "description": "description_value", - "membership_duration_days": 2561, - "ads_personalization_enabled": True, - "event_trigger": {"event_name": "event_name_value", "log_condition": 1}, - "exclusion_duration_mode": 1, - "filter_clauses": [ - { - "simple_filter": { - "scope": 1, - "filter_expression": { - "and_group": {"filter_expressions": {}}, - "or_group": {}, - "not_expression": {}, - "dimension_or_metric_filter": { - "string_filter": { - "match_type": 1, - "value": "value_value", - "case_sensitive": True, - }, - "in_list_filter": { - "values": ["values_value1", "values_value2"], - "case_sensitive": True, - }, - "numeric_filter": { - "operation": 1, - "value": { - "int64_value": 1073, - "double_value": 0.12710000000000002, - }, - }, - "between_filter": {"from_value": {}, "to_value": {}}, - "field_name": "field_name_value", - "at_any_point_in_time": True, - "in_any_n_day_period": 1994, - }, - "event_filter": { - "event_name": "event_name_value", - "event_parameter_filter_expression": {}, - }, - }, - }, - "sequence_filter": { - "scope": 1, - "sequence_maximum_duration": {"seconds": 751, "nanos": 543}, - "sequence_steps": [ + request_init = { + "attribution_settings": {"name": "properties/sample1/attributionSettings"} + } + request_init["attribution_settings"] = { + "name": "properties/sample1/attributionSettings", + "acquisition_conversion_event_lookback_window": 1, + "other_conversion_event_lookback_window": 1, + "reporting_attribution_model": 1, + "ads_web_conversion_data_export_scope": 1, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateAttributionSettingsRequest.meta.fields[ + "attribution_settings" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "attribution_settings" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( { - "scope": 1, - "immediately_follows": True, - "constraint_duration": {}, - "filter_expression": {}, + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, } - ], - }, - "clause_type": 1, - } - ], - } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["attribution_settings"][field])): + del request_init["attribution_settings"][field][i][subfield] + else: + del request_init["attribution_settings"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = gaa_audience.Audience( + return_value = resources.AttributionSettings( name="name_value", - display_name="display_name_value", - description="description_value", - membership_duration_days=2561, - ads_personalization_enabled=True, - exclusion_duration_mode=gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY, + acquisition_conversion_event_lookback_window=resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS, + other_conversion_event_lookback_window=resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS, + reporting_attribution_model=resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN, + ads_web_conversion_data_export_scope=resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_audience.Audience.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AttributionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_audience(request) + response = client.update_attribution_settings(request) # Establish that the response is the type that we expect. - assert isinstance(response, gaa_audience.Audience) + assert isinstance(response, resources.AttributionSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.membership_duration_days == 2561 - assert response.ads_personalization_enabled is True assert ( - response.exclusion_duration_mode - == gaa_audience.Audience.AudienceExclusionDurationMode.EXCLUDE_TEMPORARILY + response.acquisition_conversion_event_lookback_window + == resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS + ) + assert ( + response.other_conversion_event_lookback_window + == resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS + ) + assert ( + response.reporting_attribution_model + == resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN + ) + assert ( + response.ads_web_conversion_data_export_scope + == resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET ) -def test_update_audience_rest_required_fields( - request_type=analytics_admin.UpdateAudienceRequest, +def test_update_attribution_settings_rest_required_fields( + request_type=analytics_admin.UpdateAttributionSettingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -58622,14 +60206,14 @@ def test_update_audience_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_audience._get_unset_required_fields(jsonified_request) + ).update_attribution_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_audience._get_unset_required_fields(jsonified_request) + ).update_attribution_settings._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) @@ -58643,7 +60227,7 @@ def test_update_audience_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = gaa_audience.Audience() + return_value = resources.AttributionSettings() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -58664,30 +60248,31 @@ def test_update_audience_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_audience.Audience.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AttributionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_audience(request) + response = client.update_attribution_settings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_audience_rest_unset_required_fields(): +def test_update_attribution_settings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_audience._get_unset_required_fields({}) + unset_fields = transport.update_attribution_settings._get_unset_required_fields({}) assert set(unset_fields) == ( set(("updateMask",)) & set( ( - "audience", + "attributionSettings", "updateMask", ) ) @@ -58695,7 +60280,7 @@ def test_update_audience_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_audience_rest_interceptors(null_interceptor): +def test_update_attribution_settings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -58708,14 +60293,16 @@ def test_update_audience_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_audience" + transports.AnalyticsAdminServiceRestInterceptor, + "post_update_attribution_settings", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_audience" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_update_attribution_settings", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateAudienceRequest.pb( - analytics_admin.UpdateAudienceRequest() + pb_message = analytics_admin.UpdateAttributionSettingsRequest.pb( + analytics_admin.UpdateAttributionSettingsRequest() ) transcode.return_value = { "method": "post", @@ -58727,19 +60314,19 @@ def test_update_audience_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = gaa_audience.Audience.to_json( - gaa_audience.Audience() + req.return_value._content = resources.AttributionSettings.to_json( + resources.AttributionSettings() ) - request = analytics_admin.UpdateAudienceRequest() + request = analytics_admin.UpdateAttributionSettingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = gaa_audience.Audience() + post.return_value = resources.AttributionSettings() - client.update_audience( + client.update_attribution_settings( request, metadata=[ ("key", "val"), @@ -58751,8 +60338,9 @@ def test_update_audience_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_audience_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateAudienceRequest +def test_update_attribution_settings_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.UpdateAttributionSettingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -58760,66 +60348,8 @@ def test_update_audience_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"audience": {"name": "properties/sample1/audiences/sample2"}} - request_init["audience"] = { - "name": "properties/sample1/audiences/sample2", - "display_name": "display_name_value", - "description": "description_value", - "membership_duration_days": 2561, - "ads_personalization_enabled": True, - "event_trigger": {"event_name": "event_name_value", "log_condition": 1}, - "exclusion_duration_mode": 1, - "filter_clauses": [ - { - "simple_filter": { - "scope": 1, - "filter_expression": { - "and_group": {"filter_expressions": {}}, - "or_group": {}, - "not_expression": {}, - "dimension_or_metric_filter": { - "string_filter": { - "match_type": 1, - "value": "value_value", - "case_sensitive": True, - }, - "in_list_filter": { - "values": ["values_value1", "values_value2"], - "case_sensitive": True, - }, - "numeric_filter": { - "operation": 1, - "value": { - "int64_value": 1073, - "double_value": 0.12710000000000002, - }, - }, - "between_filter": {"from_value": {}, "to_value": {}}, - "field_name": "field_name_value", - "at_any_point_in_time": True, - "in_any_n_day_period": 1994, - }, - "event_filter": { - "event_name": "event_name_value", - "event_parameter_filter_expression": {}, - }, - }, - }, - "sequence_filter": { - "scope": 1, - "sequence_maximum_duration": {"seconds": 751, "nanos": 543}, - "sequence_steps": [ - { - "scope": 1, - "immediately_follows": True, - "constraint_duration": {}, - "filter_expression": {}, - } - ], - }, - "clause_type": 1, - } - ], + request_init = { + "attribution_settings": {"name": "properties/sample1/attributionSettings"} } request = request_type(**request_init) @@ -58832,10 +60362,10 @@ def test_update_audience_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_audience(request) + client.update_attribution_settings(request) -def test_update_audience_rest_flattened(): +def test_update_attribution_settings_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -58844,14 +60374,16 @@ def test_update_audience_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = gaa_audience.Audience() + return_value = resources.AttributionSettings() # get arguments that satisfy an http rule for this method - sample_request = {"audience": {"name": "properties/sample1/audiences/sample2"}} + sample_request = { + "attribution_settings": {"name": "properties/sample1/attributionSettings"} + } # get truthy value for each flattened field mock_args = dict( - audience=gaa_audience.Audience(name="name_value"), + attribution_settings=resources.AttributionSettings(name="name_value"), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) @@ -58859,25 +60391,26 @@ def test_update_audience_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_audience.Audience.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AttributionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_audience(**mock_args) + client.update_attribution_settings(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{audience.name=properties/*/audiences/*}" + "%s/v1alpha/{attribution_settings.name=properties/*/attributionSettings}" % client.transport._host, args[1], ) -def test_update_audience_rest_flattened_error(transport: str = "rest"): +def test_update_attribution_settings_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -58886,141 +60419,61 @@ def test_update_audience_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_audience( - analytics_admin.UpdateAudienceRequest(), - audience=gaa_audience.Audience(name="name_value"), + client.update_attribution_settings( + analytics_admin.UpdateAttributionSettingsRequest(), + attribution_settings=resources.AttributionSettings(name="name_value"), update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_update_audience_rest_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) - - -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.ArchiveAudienceRequest, - dict, - ], -) -def test_archive_audience_rest(request_type): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/audiences/sample2"} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = None - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = "" - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.archive_audience(request) - - # Establish that the response is the type that we expect. - assert response is None - - -def test_archive_audience_rest_required_fields( - request_type=analytics_admin.ArchiveAudienceRequest, -): - transport_class = transports.AnalyticsAdminServiceRestTransport - - request_init = {} - request_init["name"] = "" - request = request_type(**request_init) - pb_request = request_type.pb(request) - jsonified_request = json.loads( - json_format.MessageToJson( - pb_request, - including_default_value_fields=False, - use_integers_for_enums=False, - ) - ) - - # verify fields with default values are dropped - - unset_fields = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ).archive_audience._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with default values are now present - - jsonified_request["name"] = "name_value" - - unset_fields = transport_class( - credentials=ga_credentials.AnonymousCredentials() - ).archive_audience._get_unset_required_fields(jsonified_request) - jsonified_request.update(unset_fields) - - # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" - - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - request = request_type(**request_init) - - # Designate an appropriate value for the returned response. - return_value = None - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # We need to mock transcode() because providing default values - # for required fields will fail the real version if the http_options - # expect actual values for those fields. - with mock.patch.object(path_template, "transcode") as transcode: - # A uri without fields and an empty body will force all the - # request fields to show up in the query_params. - pb_request = request_type.pb(request) - transcode_result = { - "uri": "v1/sample_method", - "method": "post", - "query_params": pb_request, - } - transcode_result["body"] = pb_request - transcode.return_value = transcode_result +def test_update_attribution_settings_rest_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) - response_value = Response() - response_value.status_code = 200 - json_return_value = "" - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.RunAccessReportRequest, + dict, + ], +) +def test_run_access_report_rest(request_type): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) - response = client.archive_audience(request) + # send a request that will satisfy transcoding + request_init = {"entity": "properties/sample1"} + request = request_type(**request_init) - expected_params = [("$alt", "json;enum-encoding=int")] - actual_params = req.call_args.kwargs["params"] - assert expected_params == actual_params + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = analytics_admin.RunAccessReportResponse( + row_count=992, + ) + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = analytics_admin.RunAccessReportResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) -def test_archive_audience_rest_unset_required_fields(): - transport = transports.AnalyticsAdminServiceRestTransport( - credentials=ga_credentials.AnonymousCredentials - ) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.run_access_report(request) - unset_fields = transport.archive_audience._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + # Establish that the response is the type that we expect. + assert isinstance(response, analytics_admin.RunAccessReportResponse) + assert response.row_count == 992 @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_archive_audience_rest_interceptors(null_interceptor): +def test_run_access_report_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -59033,11 +60486,14 @@ def test_archive_audience_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_archive_audience" + transports.AnalyticsAdminServiceRestInterceptor, "post_run_access_report" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_run_access_report" ) as pre: pre.assert_not_called() - pb_message = analytics_admin.ArchiveAudienceRequest.pb( - analytics_admin.ArchiveAudienceRequest() + post.assert_not_called() + pb_message = analytics_admin.RunAccessReportRequest.pb( + analytics_admin.RunAccessReportRequest() ) transcode.return_value = { "method": "post", @@ -59049,15 +60505,19 @@ def test_archive_audience_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = analytics_admin.RunAccessReportResponse.to_json( + analytics_admin.RunAccessReportResponse() + ) - request = analytics_admin.ArchiveAudienceRequest() + request = analytics_admin.RunAccessReportRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = analytics_admin.RunAccessReportResponse() - client.archive_audience( + client.run_access_report( request, metadata=[ ("key", "val"), @@ -59066,10 +60526,11 @@ def test_archive_audience_rest_interceptors(null_interceptor): ) pre.assert_called_once() + post.assert_called_once() -def test_archive_audience_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ArchiveAudienceRequest +def test_run_access_report_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.RunAccessReportRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -59077,7 +60538,7 @@ def test_archive_audience_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/audiences/sample2"} + request_init = {"entity": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -59089,10 +60550,10 @@ def test_archive_audience_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.archive_audience(request) + client.run_access_report(request) -def test_archive_audience_rest_error(): +def test_run_access_report_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -59101,53 +60562,127 @@ def test_archive_audience_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetSearchAds360LinkRequest, + analytics_admin.CreateAccessBindingRequest, dict, ], ) -def test_get_search_ads360_link_rest(request_type): +def test_create_access_binding_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/searchAds360Links/sample2"} + request_init = {"parent": "accounts/sample1"} + request_init["access_binding"] = { + "user": "user_value", + "name": "name_value", + "roles": ["roles_value1", "roles_value2"], + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateAccessBindingRequest.meta.fields[ + "access_binding" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["access_binding"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["access_binding"][field])): + del request_init["access_binding"][field][i][subfield] + else: + del request_init["access_binding"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.SearchAds360Link( + return_value = resources.AccessBinding( name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", + roles=["roles_value"], + user="user_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SearchAds360Link.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AccessBinding.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_search_ads360_link(request) + response = client.create_access_binding(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.SearchAds360Link) + assert isinstance(response, resources.AccessBinding) assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.roles == ["roles_value"] -def test_get_search_ads360_link_rest_required_fields( - request_type=analytics_admin.GetSearchAds360LinkRequest, +def test_create_access_binding_rest_required_fields( + request_type=analytics_admin.CreateAccessBindingRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -59162,21 +60697,21 @@ def test_get_search_ads360_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_search_ads360_link._get_unset_required_fields(jsonified_request) + ).create_access_binding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_search_ads360_link._get_unset_required_fields(jsonified_request) + ).create_access_binding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -59185,7 +60720,7 @@ def test_get_search_ads360_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.SearchAds360Link() + return_value = resources.AccessBinding() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -59197,38 +60732,48 @@ def test_get_search_ads360_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SearchAds360Link.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AccessBinding.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_search_ads360_link(request) + response = client.create_access_binding(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_search_ads360_link_rest_unset_required_fields(): +def test_create_access_binding_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_search_ads360_link._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.create_access_binding._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "accessBinding", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_search_ads360_link_rest_interceptors(null_interceptor): +def test_create_access_binding_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -59241,14 +60786,14 @@ def test_get_search_ads360_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_search_ads360_link" + transports.AnalyticsAdminServiceRestInterceptor, "post_create_access_binding" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_search_ads360_link" + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_access_binding" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetSearchAds360LinkRequest.pb( - analytics_admin.GetSearchAds360LinkRequest() + pb_message = analytics_admin.CreateAccessBindingRequest.pb( + analytics_admin.CreateAccessBindingRequest() ) transcode.return_value = { "method": "post", @@ -59260,19 +60805,19 @@ def test_get_search_ads360_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.SearchAds360Link.to_json( - resources.SearchAds360Link() + req.return_value._content = resources.AccessBinding.to_json( + resources.AccessBinding() ) - request = analytics_admin.GetSearchAds360LinkRequest() + request = analytics_admin.CreateAccessBindingRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.SearchAds360Link() + post.return_value = resources.AccessBinding() - client.get_search_ads360_link( + client.create_access_binding( request, metadata=[ ("key", "val"), @@ -59284,8 +60829,8 @@ def test_get_search_ads360_link_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_search_ads360_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetSearchAds360LinkRequest +def test_create_access_binding_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateAccessBindingRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -59293,7 +60838,7 @@ def test_get_search_ads360_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/searchAds360Links/sample2"} + request_init = {"parent": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -59305,10 +60850,10 @@ def test_get_search_ads360_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_search_ads360_link(request) + client.create_access_binding(request) -def test_get_search_ads360_link_rest_flattened(): +def test_create_access_binding_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -59317,39 +60862,40 @@ def test_get_search_ads360_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.SearchAds360Link() + return_value = resources.AccessBinding() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/searchAds360Links/sample2"} + sample_request = {"parent": "accounts/sample1"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", + access_binding=resources.AccessBinding(user="user_value"), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SearchAds360Link.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AccessBinding.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_search_ads360_link(**mock_args) + client.create_access_binding(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/searchAds360Links/*}" - % client.transport._host, + "%s/v1alpha/{parent=accounts/*}/accessBindings" % client.transport._host, args[1], ) -def test_get_search_ads360_link_rest_flattened_error(transport: str = "rest"): +def test_create_access_binding_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -59358,13 +60904,14 @@ def test_get_search_ads360_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_search_ads360_link( - analytics_admin.GetSearchAds360LinkRequest(), - name="name_value", + client.create_access_binding( + analytics_admin.CreateAccessBindingRequest(), + parent="parent_value", + access_binding=resources.AccessBinding(user="user_value"), ) -def test_get_search_ads360_link_rest_error(): +def test_create_access_binding_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -59373,49 +60920,53 @@ def test_get_search_ads360_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListSearchAds360LinksRequest, + analytics_admin.GetAccessBindingRequest, dict, ], ) -def test_list_search_ads360_links_rest(request_type): +def test_get_access_binding_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = {"name": "accounts/sample1/accessBindings/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListSearchAds360LinksResponse( - next_page_token="next_page_token_value", + return_value = resources.AccessBinding( + name="name_value", + roles=["roles_value"], + user="user_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListSearchAds360LinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AccessBinding.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_search_ads360_links(request) + response = client.get_access_binding(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListSearchAds360LinksPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.AccessBinding) + assert response.name == "name_value" + assert response.roles == ["roles_value"] -def test_list_search_ads360_links_rest_required_fields( - request_type=analytics_admin.ListSearchAds360LinksRequest, +def test_get_access_binding_rest_required_fields( + request_type=analytics_admin.GetAccessBindingRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -59430,28 +60981,21 @@ def test_list_search_ads360_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_search_ads360_links._get_unset_required_fields(jsonified_request) + ).get_access_binding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_search_ads360_links._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) - ) + ).get_access_binding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -59460,7 +61004,7 @@ def test_list_search_ads360_links_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListSearchAds360LinksResponse() + return_value = resources.AccessBinding() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -59480,40 +61024,31 @@ def test_list_search_ads360_links_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListSearchAds360LinksResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AccessBinding.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_search_ads360_links(request) + response = client.get_access_binding(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_search_ads360_links_rest_unset_required_fields(): +def test_get_access_binding_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_search_ads360_links._get_unset_required_fields({}) - assert set(unset_fields) == ( - set( - ( - "pageSize", - "pageToken", - ) - ) - & set(("parent",)) - ) + unset_fields = transport.get_access_binding._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_search_ads360_links_rest_interceptors(null_interceptor): +def test_get_access_binding_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -59526,14 +61061,14 @@ def test_list_search_ads360_links_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_search_ads360_links" + transports.AnalyticsAdminServiceRestInterceptor, "post_get_access_binding" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_search_ads360_links" + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_access_binding" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListSearchAds360LinksRequest.pb( - analytics_admin.ListSearchAds360LinksRequest() + pb_message = analytics_admin.GetAccessBindingRequest.pb( + analytics_admin.GetAccessBindingRequest() ) transcode.return_value = { "method": "post", @@ -59545,21 +61080,19 @@ def test_list_search_ads360_links_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.ListSearchAds360LinksResponse.to_json( - analytics_admin.ListSearchAds360LinksResponse() - ) + req.return_value._content = resources.AccessBinding.to_json( + resources.AccessBinding() ) - request = analytics_admin.ListSearchAds360LinksRequest() + request = analytics_admin.GetAccessBindingRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListSearchAds360LinksResponse() + post.return_value = resources.AccessBinding() - client.list_search_ads360_links( + client.get_access_binding( request, metadata=[ ("key", "val"), @@ -59571,8 +61104,8 @@ def test_list_search_ads360_links_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_search_ads360_links_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListSearchAds360LinksRequest +def test_get_access_binding_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetAccessBindingRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -59580,7 +61113,7 @@ def test_list_search_ads360_links_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = {"name": "accounts/sample1/accessBindings/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -59592,10 +61125,10 @@ def test_list_search_ads360_links_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_search_ads360_links(request) + client.get_access_binding(request) -def test_list_search_ads360_links_rest_flattened(): +def test_get_access_binding_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -59604,39 +61137,39 @@ def test_list_search_ads360_links_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListSearchAds360LinksResponse() + return_value = resources.AccessBinding() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = {"name": "accounts/sample1/accessBindings/sample2"} # get truthy value for each flattened field mock_args = dict( - parent="parent_value", + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListSearchAds360LinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AccessBinding.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_search_ads360_links(**mock_args) + client.get_access_binding(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/searchAds360Links" - % client.transport._host, + "%s/v1alpha/{name=accounts/*/accessBindings/*}" % client.transport._host, args[1], ) -def test_list_search_ads360_links_rest_flattened_error(transport: str = "rest"): +def test_get_access_binding_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -59645,134 +61178,143 @@ def test_list_search_ads360_links_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_search_ads360_links( - analytics_admin.ListSearchAds360LinksRequest(), - parent="parent_value", + client.get_access_binding( + analytics_admin.GetAccessBindingRequest(), + name="name_value", ) -def test_list_search_ads360_links_rest_pager(transport: str = "rest"): +def test_get_access_binding_rest_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - resources.SearchAds360Link(), - resources.SearchAds360Link(), - ], - next_page_token="abc", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[], - next_page_token="def", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - ], - next_page_token="ghi", - ), - analytics_admin.ListSearchAds360LinksResponse( - search_ads_360_links=[ - resources.SearchAds360Link(), - resources.SearchAds360Link(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListSearchAds360LinksResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "properties/sample1"} - - pager = client.list_search_ads360_links(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.SearchAds360Link) for i in results) - - pages = list(client.list_search_ads360_links(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateSearchAds360LinkRequest, + analytics_admin.UpdateAccessBindingRequest, dict, ], ) -def test_create_search_ads360_link_rest(request_type): +def test_update_access_binding_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["search_ads_360_link"] = { - "name": "name_value", - "advertiser_id": "advertiser_id_value", - "campaign_data_sharing_enabled": {"value": True}, - "cost_data_sharing_enabled": {}, - "advertiser_display_name": "advertiser_display_name_value", - "ads_personalization_enabled": {}, - "site_stats_sharing_enabled": {}, + request_init = { + "access_binding": {"name": "accounts/sample1/accessBindings/sample2"} + } + request_init["access_binding"] = { + "user": "user_value", + "name": "accounts/sample1/accessBindings/sample2", + "roles": ["roles_value1", "roles_value2"], } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateAccessBindingRequest.meta.fields[ + "access_binding" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["access_binding"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["access_binding"][field])): + del request_init["access_binding"][field][i][subfield] + else: + del request_init["access_binding"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.SearchAds360Link( + return_value = resources.AccessBinding( name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", + roles=["roles_value"], + user="user_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SearchAds360Link.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AccessBinding.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_search_ads360_link(request) + response = client.update_access_binding(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.SearchAds360Link) + assert isinstance(response, resources.AccessBinding) assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.roles == ["roles_value"] -def test_create_search_ads360_link_rest_required_fields( - request_type=analytics_admin.CreateSearchAds360LinkRequest, +def test_update_access_binding_rest_required_fields( + request_type=analytics_admin.UpdateAccessBindingRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -59787,21 +61329,17 @@ def test_create_search_ads360_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_search_ads360_link._get_unset_required_fields(jsonified_request) + ).update_access_binding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_search_ads360_link._get_unset_required_fields(jsonified_request) + ).update_access_binding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -59810,7 +61348,7 @@ def test_create_search_ads360_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.SearchAds360Link() + return_value = resources.AccessBinding() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -59822,7 +61360,7 @@ def test_create_search_ads360_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "patch", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -59831,38 +61369,31 @@ def test_create_search_ads360_link_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SearchAds360Link.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AccessBinding.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_search_ads360_link(request) + response = client.update_access_binding(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_search_ads360_link_rest_unset_required_fields(): +def test_update_access_binding_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_search_ads360_link._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(()) - & set( - ( - "parent", - "searchAds360Link", - ) - ) - ) + unset_fields = transport.update_access_binding._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("accessBinding",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_search_ads360_link_rest_interceptors(null_interceptor): +def test_update_access_binding_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -59875,15 +61406,14 @@ def test_create_search_ads360_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_create_search_ads360_link", + transports.AnalyticsAdminServiceRestInterceptor, "post_update_access_binding" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_search_ads360_link" + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_access_binding" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateSearchAds360LinkRequest.pb( - analytics_admin.CreateSearchAds360LinkRequest() + pb_message = analytics_admin.UpdateAccessBindingRequest.pb( + analytics_admin.UpdateAccessBindingRequest() ) transcode.return_value = { "method": "post", @@ -59895,19 +61425,19 @@ def test_create_search_ads360_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.SearchAds360Link.to_json( - resources.SearchAds360Link() + req.return_value._content = resources.AccessBinding.to_json( + resources.AccessBinding() ) - request = analytics_admin.CreateSearchAds360LinkRequest() + request = analytics_admin.UpdateAccessBindingRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.SearchAds360Link() + post.return_value = resources.AccessBinding() - client.create_search_ads360_link( + client.update_access_binding( request, metadata=[ ("key", "val"), @@ -59919,8 +61449,8 @@ def test_create_search_ads360_link_rest_interceptors(null_interceptor): post.assert_called_once() -def test_create_search_ads360_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateSearchAds360LinkRequest +def test_update_access_binding_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateAccessBindingRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -59928,15 +61458,8 @@ def test_create_search_ads360_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["search_ads_360_link"] = { - "name": "name_value", - "advertiser_id": "advertiser_id_value", - "campaign_data_sharing_enabled": {"value": True}, - "cost_data_sharing_enabled": {}, - "advertiser_display_name": "advertiser_display_name_value", - "ads_personalization_enabled": {}, - "site_stats_sharing_enabled": {}, + request_init = { + "access_binding": {"name": "accounts/sample1/accessBindings/sample2"} } request = request_type(**request_init) @@ -59949,10 +61472,10 @@ def test_create_search_ads360_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_search_ads360_link(request) + client.update_access_binding(request) -def test_create_search_ads360_link_rest_flattened(): +def test_update_access_binding_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -59961,40 +61484,42 @@ def test_create_search_ads360_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.SearchAds360Link() + return_value = resources.AccessBinding() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = { + "access_binding": {"name": "accounts/sample1/accessBindings/sample2"} + } # get truthy value for each flattened field mock_args = dict( - parent="parent_value", - search_ads_360_link=resources.SearchAds360Link(name="name_value"), + access_binding=resources.AccessBinding(user="user_value"), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SearchAds360Link.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AccessBinding.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_search_ads360_link(**mock_args) + client.update_access_binding(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/searchAds360Links" + "%s/v1alpha/{access_binding.name=accounts/*/accessBindings/*}" % client.transport._host, args[1], ) -def test_create_search_ads360_link_rest_flattened_error(transport: str = "rest"): +def test_update_access_binding_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -60003,14 +61528,13 @@ def test_create_search_ads360_link_rest_flattened_error(transport: str = "rest") # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_search_ads360_link( - analytics_admin.CreateSearchAds360LinkRequest(), - parent="parent_value", - search_ads_360_link=resources.SearchAds360Link(name="name_value"), + client.update_access_binding( + analytics_admin.UpdateAccessBindingRequest(), + access_binding=resources.AccessBinding(user="user_value"), ) -def test_create_search_ads360_link_rest_error(): +def test_update_access_binding_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -60019,18 +61543,18 @@ def test_create_search_ads360_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteSearchAds360LinkRequest, + analytics_admin.DeleteAccessBindingRequest, dict, ], ) -def test_delete_search_ads360_link_rest(request_type): +def test_delete_access_binding_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/searchAds360Links/sample2"} + request_init = {"name": "accounts/sample1/accessBindings/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -60045,14 +61569,14 @@ def test_delete_search_ads360_link_rest(request_type): response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_search_ads360_link(request) + response = client.delete_access_binding(request) # Establish that the response is the type that we expect. assert response is None -def test_delete_search_ads360_link_rest_required_fields( - request_type=analytics_admin.DeleteSearchAds360LinkRequest, +def test_delete_access_binding_rest_required_fields( + request_type=analytics_admin.DeleteAccessBindingRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -60072,7 +61596,7 @@ def test_delete_search_ads360_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_search_ads360_link._get_unset_required_fields(jsonified_request) + ).delete_access_binding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -60081,7 +61605,7 @@ def test_delete_search_ads360_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_search_ads360_link._get_unset_required_fields(jsonified_request) + ).delete_access_binding._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -60119,24 +61643,24 @@ def test_delete_search_ads360_link_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_search_ads360_link(request) + response = client.delete_access_binding(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_search_ads360_link_rest_unset_required_fields(): +def test_delete_access_binding_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_search_ads360_link._get_unset_required_fields({}) + unset_fields = transport.delete_access_binding._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_search_ads360_link_rest_interceptors(null_interceptor): +def test_delete_access_binding_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -60149,11 +61673,11 @@ def test_delete_search_ads360_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_search_ads360_link" + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_access_binding" ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteSearchAds360LinkRequest.pb( - analytics_admin.DeleteSearchAds360LinkRequest() + pb_message = analytics_admin.DeleteAccessBindingRequest.pb( + analytics_admin.DeleteAccessBindingRequest() ) transcode.return_value = { "method": "post", @@ -60166,14 +61690,14 @@ def test_delete_search_ads360_link_rest_interceptors(null_interceptor): req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - request = analytics_admin.DeleteSearchAds360LinkRequest() + request = analytics_admin.DeleteAccessBindingRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - client.delete_search_ads360_link( + client.delete_access_binding( request, metadata=[ ("key", "val"), @@ -60184,8 +61708,8 @@ def test_delete_search_ads360_link_rest_interceptors(null_interceptor): pre.assert_called_once() -def test_delete_search_ads360_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteSearchAds360LinkRequest +def test_delete_access_binding_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeleteAccessBindingRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -60193,7 +61717,7 @@ def test_delete_search_ads360_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/searchAds360Links/sample2"} + request_init = {"name": "accounts/sample1/accessBindings/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -60205,10 +61729,10 @@ def test_delete_search_ads360_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_search_ads360_link(request) + client.delete_access_binding(request) -def test_delete_search_ads360_link_rest_flattened(): +def test_delete_access_binding_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -60220,7 +61744,7 @@ def test_delete_search_ads360_link_rest_flattened(): return_value = None # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/searchAds360Links/sample2"} + sample_request = {"name": "accounts/sample1/accessBindings/sample2"} # get truthy value for each flattened field mock_args = dict( @@ -60235,20 +61759,19 @@ def test_delete_search_ads360_link_rest_flattened(): response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.delete_search_ads360_link(**mock_args) + client.delete_access_binding(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/searchAds360Links/*}" - % client.transport._host, + "%s/v1alpha/{name=accounts/*/accessBindings/*}" % client.transport._host, args[1], ) -def test_delete_search_ads360_link_rest_flattened_error(transport: str = "rest"): +def test_delete_access_binding_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -60257,13 +61780,13 @@ def test_delete_search_ads360_link_rest_flattened_error(transport: str = "rest") # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_search_ads360_link( - analytics_admin.DeleteSearchAds360LinkRequest(), + client.delete_access_binding( + analytics_admin.DeleteAccessBindingRequest(), name="name_value", ) -def test_delete_search_ads360_link_rest_error(): +def test_delete_access_binding_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -60272,63 +61795,50 @@ def test_delete_search_ads360_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateSearchAds360LinkRequest, + analytics_admin.ListAccessBindingsRequest, dict, ], ) -def test_update_search_ads360_link_rest(request_type): +def test_list_access_bindings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "search_ads_360_link": {"name": "properties/sample1/searchAds360Links/sample2"} - } - request_init["search_ads_360_link"] = { - "name": "properties/sample1/searchAds360Links/sample2", - "advertiser_id": "advertiser_id_value", - "campaign_data_sharing_enabled": {"value": True}, - "cost_data_sharing_enabled": {}, - "advertiser_display_name": "advertiser_display_name_value", - "ads_personalization_enabled": {}, - "site_stats_sharing_enabled": {}, - } + request_init = {"parent": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.SearchAds360Link( - name="name_value", - advertiser_id="advertiser_id_value", - advertiser_display_name="advertiser_display_name_value", + return_value = analytics_admin.ListAccessBindingsResponse( + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SearchAds360Link.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListAccessBindingsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_search_ads360_link(request) + response = client.list_access_bindings(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.SearchAds360Link) - assert response.name == "name_value" - assert response.advertiser_id == "advertiser_id_value" - assert response.advertiser_display_name == "advertiser_display_name_value" + assert isinstance(response, pagers.ListAccessBindingsPager) + assert response.next_page_token == "next_page_token_value" -def test_update_search_ads360_link_rest_required_fields( - request_type=analytics_admin.UpdateSearchAds360LinkRequest, +def test_list_access_bindings_rest_required_fields( + request_type=analytics_admin.ListAccessBindingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -60343,19 +61853,28 @@ def test_update_search_ads360_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_search_ads360_link._get_unset_required_fields(jsonified_request) + ).list_access_bindings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["parent"] = "parent_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_search_ads360_link._get_unset_required_fields(jsonified_request) + ).list_access_bindings._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -60364,7 +61883,7 @@ def test_update_search_ads360_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.SearchAds360Link() + return_value = analytics_admin.ListAccessBindingsResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -60376,39 +61895,47 @@ def test_update_search_ads360_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SearchAds360Link.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListAccessBindingsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_search_ads360_link(request) + response = client.list_access_bindings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_search_ads360_link_rest_unset_required_fields(): +def test_list_access_bindings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_search_ads360_link._get_unset_required_fields({}) - assert set(unset_fields) == (set(("updateMask",)) & set(("updateMask",))) + unset_fields = transport.list_access_bindings._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "pageSize", + "pageToken", + ) + ) + & set(("parent",)) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_search_ads360_link_rest_interceptors(null_interceptor): +def test_list_access_bindings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -60421,15 +61948,14 @@ def test_update_search_ads360_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_update_search_ads360_link", + transports.AnalyticsAdminServiceRestInterceptor, "post_list_access_bindings" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_search_ads360_link" + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_access_bindings" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateSearchAds360LinkRequest.pb( - analytics_admin.UpdateSearchAds360LinkRequest() + pb_message = analytics_admin.ListAccessBindingsRequest.pb( + analytics_admin.ListAccessBindingsRequest() ) transcode.return_value = { "method": "post", @@ -60441,19 +61967,19 @@ def test_update_search_ads360_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.SearchAds360Link.to_json( - resources.SearchAds360Link() + req.return_value._content = analytics_admin.ListAccessBindingsResponse.to_json( + analytics_admin.ListAccessBindingsResponse() ) - request = analytics_admin.UpdateSearchAds360LinkRequest() + request = analytics_admin.ListAccessBindingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.SearchAds360Link() + post.return_value = analytics_admin.ListAccessBindingsResponse() - client.update_search_ads360_link( + client.list_access_bindings( request, metadata=[ ("key", "val"), @@ -60465,8 +61991,8 @@ def test_update_search_ads360_link_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_search_ads360_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateSearchAds360LinkRequest +def test_list_access_bindings_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListAccessBindingsRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -60474,18 +62000,7 @@ def test_update_search_ads360_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "search_ads_360_link": {"name": "properties/sample1/searchAds360Links/sample2"} - } - request_init["search_ads_360_link"] = { - "name": "properties/sample1/searchAds360Links/sample2", - "advertiser_id": "advertiser_id_value", - "campaign_data_sharing_enabled": {"value": True}, - "cost_data_sharing_enabled": {}, - "advertiser_display_name": "advertiser_display_name_value", - "ads_personalization_enabled": {}, - "site_stats_sharing_enabled": {}, - } + request_init = {"parent": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -60497,10 +62012,10 @@ def test_update_search_ads360_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_search_ads360_link(request) + client.list_access_bindings(request) -def test_update_search_ads360_link_rest_flattened(): +def test_list_access_bindings_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -60509,44 +62024,39 @@ def test_update_search_ads360_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.SearchAds360Link() + return_value = analytics_admin.ListAccessBindingsResponse() # get arguments that satisfy an http rule for this method - sample_request = { - "search_ads_360_link": { - "name": "properties/sample1/searchAds360Links/sample2" - } - } + sample_request = {"parent": "accounts/sample1"} # get truthy value for each flattened field mock_args = dict( - search_ads_360_link=resources.SearchAds360Link(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + parent="parent_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.SearchAds360Link.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListAccessBindingsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_search_ads360_link(**mock_args) + client.list_access_bindings(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{search_ads_360_link.name=properties/*/searchAds360Links/*}" - % client.transport._host, + "%s/v1alpha/{parent=accounts/*}/accessBindings" % client.transport._host, args[1], ) -def test_update_search_ads360_link_rest_flattened_error(transport: str = "rest"): +def test_list_access_bindings_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -60555,85 +62065,121 @@ def test_update_search_ads360_link_rest_flattened_error(transport: str = "rest") # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_search_ads360_link( - analytics_admin.UpdateSearchAds360LinkRequest(), - search_ads_360_link=resources.SearchAds360Link(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.list_access_bindings( + analytics_admin.ListAccessBindingsRequest(), + parent="parent_value", ) -def test_update_search_ads360_link_rest_error(): +def test_list_access_bindings_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + resources.AccessBinding(), + resources.AccessBinding(), + ], + next_page_token="abc", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[], + next_page_token="def", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + ], + next_page_token="ghi", + ), + analytics_admin.ListAccessBindingsResponse( + access_bindings=[ + resources.AccessBinding(), + resources.AccessBinding(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListAccessBindingsResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "accounts/sample1"} + + pager = client.list_access_bindings(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.AccessBinding) for i in results) + + pages = list(client.list_access_bindings(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAttributionSettingsRequest, + analytics_admin.BatchCreateAccessBindingsRequest, dict, ], ) -def test_get_attribution_settings_rest(request_type): +def test_batch_create_access_bindings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/attributionSettings"} + request_init = {"parent": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.AttributionSettings( - name="name_value", - acquisition_conversion_event_lookback_window=resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS, - other_conversion_event_lookback_window=resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS, - reporting_attribution_model=resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN, - ads_web_conversion_data_export_scope=resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET, - ) + return_value = analytics_admin.BatchCreateAccessBindingsResponse() # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AttributionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.BatchCreateAccessBindingsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_attribution_settings(request) + response = client.batch_create_access_bindings(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.AttributionSettings) - assert response.name == "name_value" - assert ( - response.acquisition_conversion_event_lookback_window - == resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS - ) - assert ( - response.other_conversion_event_lookback_window - == resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS - ) - assert ( - response.reporting_attribution_model - == resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN - ) - assert ( - response.ads_web_conversion_data_export_scope - == resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET - ) + assert isinstance(response, analytics_admin.BatchCreateAccessBindingsResponse) -def test_get_attribution_settings_rest_required_fields( - request_type=analytics_admin.GetAttributionSettingsRequest, +def test_batch_create_access_bindings_rest_required_fields( + request_type=analytics_admin.BatchCreateAccessBindingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -60648,21 +62194,21 @@ def test_get_attribution_settings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_attribution_settings._get_unset_required_fields(jsonified_request) + ).batch_create_access_bindings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_attribution_settings._get_unset_required_fields(jsonified_request) + ).batch_create_access_bindings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -60671,7 +62217,7 @@ def test_get_attribution_settings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.AttributionSettings() + return_value = analytics_admin.BatchCreateAccessBindingsResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -60683,38 +62229,50 @@ def test_get_attribution_settings_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AttributionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.BatchCreateAccessBindingsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_attribution_settings(request) + response = client.batch_create_access_bindings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_attribution_settings_rest_unset_required_fields(): +def test_batch_create_access_bindings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_attribution_settings._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.batch_create_access_bindings._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "requests", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_attribution_settings_rest_interceptors(null_interceptor): +def test_batch_create_access_bindings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -60727,14 +62285,16 @@ def test_get_attribution_settings_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_attribution_settings" + transports.AnalyticsAdminServiceRestInterceptor, + "post_batch_create_access_bindings", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_attribution_settings" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_batch_create_access_bindings", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetAttributionSettingsRequest.pb( - analytics_admin.GetAttributionSettingsRequest() + pb_message = analytics_admin.BatchCreateAccessBindingsRequest.pb( + analytics_admin.BatchCreateAccessBindingsRequest() ) transcode.return_value = { "method": "post", @@ -60746,19 +62306,21 @@ def test_get_attribution_settings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.AttributionSettings.to_json( - resources.AttributionSettings() + req.return_value._content = ( + analytics_admin.BatchCreateAccessBindingsResponse.to_json( + analytics_admin.BatchCreateAccessBindingsResponse() + ) ) - request = analytics_admin.GetAttributionSettingsRequest() + request = analytics_admin.BatchCreateAccessBindingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.AttributionSettings() + post.return_value = analytics_admin.BatchCreateAccessBindingsResponse() - client.get_attribution_settings( + client.batch_create_access_bindings( request, metadata=[ ("key", "val"), @@ -60770,8 +62332,9 @@ def test_get_attribution_settings_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_attribution_settings_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetAttributionSettingsRequest +def test_batch_create_access_bindings_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.BatchCreateAccessBindingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -60779,7 +62342,7 @@ def test_get_attribution_settings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/attributionSettings"} + request_init = {"parent": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -60791,66 +62354,10 @@ def test_get_attribution_settings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_attribution_settings(request) - - -def test_get_attribution_settings_rest_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = resources.AttributionSettings() - - # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/attributionSettings"} - - # get truthy value for each flattened field - mock_args = dict( - name="name_value", - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = resources.AttributionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.get_attribution_settings(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{name=properties/*/attributionSettings}" - % client.transport._host, - args[1], - ) - - -def test_get_attribution_settings_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.get_attribution_settings( - analytics_admin.GetAttributionSettingsRequest(), - name="name_value", - ) + client.batch_create_access_bindings(request) -def test_get_attribution_settings_rest_error(): +def test_batch_create_access_bindings_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -60859,77 +62366,48 @@ def test_get_attribution_settings_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateAttributionSettingsRequest, + analytics_admin.BatchGetAccessBindingsRequest, dict, ], ) -def test_update_attribution_settings_rest(request_type): +def test_batch_get_access_bindings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "attribution_settings": {"name": "properties/sample1/attributionSettings"} - } - request_init["attribution_settings"] = { - "name": "properties/sample1/attributionSettings", - "acquisition_conversion_event_lookback_window": 1, - "other_conversion_event_lookback_window": 1, - "reporting_attribution_model": 1, - "ads_web_conversion_data_export_scope": 1, - } + request_init = {"parent": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.AttributionSettings( - name="name_value", - acquisition_conversion_event_lookback_window=resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS, - other_conversion_event_lookback_window=resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS, - reporting_attribution_model=resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN, - ads_web_conversion_data_export_scope=resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET, - ) + return_value = analytics_admin.BatchGetAccessBindingsResponse() # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AttributionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.BatchGetAccessBindingsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_attribution_settings(request) + response = client.batch_get_access_bindings(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.AttributionSettings) - assert response.name == "name_value" - assert ( - response.acquisition_conversion_event_lookback_window - == resources.AttributionSettings.AcquisitionConversionEventLookbackWindow.ACQUISITION_CONVERSION_EVENT_LOOKBACK_WINDOW_7_DAYS - ) - assert ( - response.other_conversion_event_lookback_window - == resources.AttributionSettings.OtherConversionEventLookbackWindow.OTHER_CONVERSION_EVENT_LOOKBACK_WINDOW_30_DAYS - ) - assert ( - response.reporting_attribution_model - == resources.AttributionSettings.ReportingAttributionModel.PAID_AND_ORGANIC_CHANNELS_DATA_DRIVEN - ) - assert ( - response.ads_web_conversion_data_export_scope - == resources.AttributionSettings.AdsWebConversionDataExportScope.NOT_SELECTED_YET - ) + assert isinstance(response, analytics_admin.BatchGetAccessBindingsResponse) -def test_update_attribution_settings_rest_required_fields( - request_type=analytics_admin.UpdateAttributionSettingsRequest, +def test_batch_get_access_bindings_rest_required_fields( + request_type=analytics_admin.BatchGetAccessBindingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["parent"] = "" + request_init["names"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -60941,22 +62419,32 @@ def test_update_attribution_settings_rest_required_fields( ) # verify fields with default values are dropped + assert "names" not in jsonified_request unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_attribution_settings._get_unset_required_fields(jsonified_request) + ).batch_get_access_bindings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + assert "names" in jsonified_request + assert jsonified_request["names"] == request_init["names"] + + jsonified_request["parent"] = "parent_value" + jsonified_request["names"] = "names_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_attribution_settings._get_unset_required_fields(jsonified_request) + ).batch_get_access_bindings._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + assert not set(unset_fields) - set(("names",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" + assert "names" in jsonified_request + assert jsonified_request["names"] == "names_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -60965,7 +62453,7 @@ def test_update_attribution_settings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.AttributionSettings() + return_value = analytics_admin.BatchGetAccessBindingsResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -60977,47 +62465,55 @@ def test_update_attribution_settings_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AttributionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.BatchGetAccessBindingsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_attribution_settings(request) + response = client.batch_get_access_bindings(request) - expected_params = [("$alt", "json;enum-encoding=int")] + expected_params = [ + ( + "names", + "", + ), + ("$alt", "json;enum-encoding=int"), + ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_attribution_settings_rest_unset_required_fields(): +def test_batch_get_access_bindings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_attribution_settings._get_unset_required_fields({}) + unset_fields = transport.batch_get_access_bindings._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("updateMask",)) + set(("names",)) & set( ( - "attributionSettings", - "updateMask", + "parent", + "names", ) ) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_attribution_settings_rest_interceptors(null_interceptor): +def test_batch_get_access_bindings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -61031,15 +62527,14 @@ def test_update_attribution_settings_rest_interceptors(null_interceptor): path_template, "transcode" ) as transcode, mock.patch.object( transports.AnalyticsAdminServiceRestInterceptor, - "post_update_attribution_settings", + "post_batch_get_access_bindings", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_update_attribution_settings", + transports.AnalyticsAdminServiceRestInterceptor, "pre_batch_get_access_bindings" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateAttributionSettingsRequest.pb( - analytics_admin.UpdateAttributionSettingsRequest() + pb_message = analytics_admin.BatchGetAccessBindingsRequest.pb( + analytics_admin.BatchGetAccessBindingsRequest() ) transcode.return_value = { "method": "post", @@ -61051,19 +62546,21 @@ def test_update_attribution_settings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.AttributionSettings.to_json( - resources.AttributionSettings() + req.return_value._content = ( + analytics_admin.BatchGetAccessBindingsResponse.to_json( + analytics_admin.BatchGetAccessBindingsResponse() + ) ) - request = analytics_admin.UpdateAttributionSettingsRequest() + request = analytics_admin.BatchGetAccessBindingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.AttributionSettings() + post.return_value = analytics_admin.BatchGetAccessBindingsResponse() - client.update_attribution_settings( + client.batch_get_access_bindings( request, metadata=[ ("key", "val"), @@ -61075,9 +62572,8 @@ def test_update_attribution_settings_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_attribution_settings_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.UpdateAttributionSettingsRequest, +def test_batch_get_access_bindings_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.BatchGetAccessBindingsRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -61085,16 +62581,7 @@ def test_update_attribution_settings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "attribution_settings": {"name": "properties/sample1/attributionSettings"} - } - request_init["attribution_settings"] = { - "name": "properties/sample1/attributionSettings", - "acquisition_conversion_event_lookback_window": 1, - "other_conversion_event_lookback_window": 1, - "reporting_attribution_model": 1, - "ads_web_conversion_data_export_scope": 1, - } + request_init = {"parent": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -61106,116 +62593,154 @@ def test_update_attribution_settings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_attribution_settings(request) + client.batch_get_access_bindings(request) -def test_update_attribution_settings_rest_flattened(): +def test_batch_get_access_bindings_rest_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.BatchUpdateAccessBindingsRequest, + dict, + ], +) +def test_batch_update_access_bindings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) + # send a request that will satisfy transcoding + request_init = {"parent": "accounts/sample1"} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.AttributionSettings() - - # get arguments that satisfy an http rule for this method - sample_request = { - "attribution_settings": {"name": "properties/sample1/attributionSettings"} - } - - # get truthy value for each flattened field - mock_args = dict( - attribution_settings=resources.AttributionSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) - mock_args.update(sample_request) + return_value = analytics_admin.BatchUpdateAccessBindingsResponse() # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AttributionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.BatchUpdateAccessBindingsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + response = client.batch_update_access_bindings(request) - client.update_attribution_settings(**mock_args) + # Establish that the response is the type that we expect. + assert isinstance(response, analytics_admin.BatchUpdateAccessBindingsResponse) - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{attribution_settings.name=properties/*/attributionSettings}" - % client.transport._host, - args[1], - ) +def test_batch_update_access_bindings_rest_required_fields( + request_type=analytics_admin.BatchUpdateAccessBindingsRequest, +): + transport_class = transports.AnalyticsAdminServiceRestTransport -def test_update_attribution_settings_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + request_init = {} + request_init["parent"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson( + pb_request, + including_default_value_fields=False, + use_integers_for_enums=False, + ) ) - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_attribution_settings( - analytics_admin.UpdateAttributionSettingsRequest(), - attribution_settings=resources.AttributionSettings(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).batch_update_access_bindings._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + # verify required fields with default values are now present -def test_update_attribution_settings_rest_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) + jsonified_request["parent"] = "parent_value" + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).batch_update_access_bindings._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.RunAccessReportRequest, - dict, - ], -) -def test_run_access_report_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) - - # send a request that will satisfy transcoding - request_init = {"entity": "properties/sample1"} request = request_type(**request_init) + # Designate an appropriate value for the returned response. + return_value = analytics_admin.BatchUpdateAccessBindingsResponse() # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = analytics_admin.RunAccessReportResponse( - row_count=992, - ) + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": pb_request, + } + transcode_result["body"] = pb_request + transcode.return_value = transcode_result - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = analytics_admin.RunAccessReportResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + response_value = Response() + response_value.status_code = 200 - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.run_access_report(request) + # Convert return value to protobuf type + return_value = analytics_admin.BatchUpdateAccessBindingsResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) - # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.RunAccessReportResponse) - assert response.row_count == 992 + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.batch_update_access_bindings(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_batch_update_access_bindings_rest_unset_required_fields(): + transport = transports.AnalyticsAdminServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.batch_update_access_bindings._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "requests", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_run_access_report_rest_interceptors(null_interceptor): +def test_batch_update_access_bindings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -61228,14 +62753,16 @@ def test_run_access_report_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_run_access_report" + transports.AnalyticsAdminServiceRestInterceptor, + "post_batch_update_access_bindings", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_run_access_report" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_batch_update_access_bindings", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.RunAccessReportRequest.pb( - analytics_admin.RunAccessReportRequest() + pb_message = analytics_admin.BatchUpdateAccessBindingsRequest.pb( + analytics_admin.BatchUpdateAccessBindingsRequest() ) transcode.return_value = { "method": "post", @@ -61247,19 +62774,21 @@ def test_run_access_report_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.RunAccessReportResponse.to_json( - analytics_admin.RunAccessReportResponse() + req.return_value._content = ( + analytics_admin.BatchUpdateAccessBindingsResponse.to_json( + analytics_admin.BatchUpdateAccessBindingsResponse() + ) ) - request = analytics_admin.RunAccessReportRequest() + request = analytics_admin.BatchUpdateAccessBindingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.RunAccessReportResponse() + post.return_value = analytics_admin.BatchUpdateAccessBindingsResponse() - client.run_access_report( + client.batch_update_access_bindings( request, metadata=[ ("key", "val"), @@ -61271,8 +62800,9 @@ def test_run_access_report_rest_interceptors(null_interceptor): post.assert_called_once() -def test_run_access_report_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.RunAccessReportRequest +def test_batch_update_access_bindings_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.BatchUpdateAccessBindingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -61280,7 +62810,7 @@ def test_run_access_report_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"entity": "properties/sample1"} + request_init = {"parent": "accounts/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -61292,10 +62822,10 @@ def test_run_access_report_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.run_access_report(request) + client.batch_update_access_bindings(request) -def test_run_access_report_rest_error(): +def test_batch_update_access_bindings_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -61304,11 +62834,11 @@ def test_run_access_report_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateAccessBindingRequest, + analytics_admin.BatchDeleteAccessBindingsRequest, dict, ], ) -def test_create_access_binding_rest(request_type): +def test_batch_delete_access_bindings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -61316,40 +62846,28 @@ def test_create_access_binding_rest(request_type): # send a request that will satisfy transcoding request_init = {"parent": "accounts/sample1"} - request_init["access_binding"] = { - "user": "user_value", - "name": "name_value", - "roles": ["roles_value1", "roles_value2"], - } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.AccessBinding( - name="name_value", - roles=["roles_value"], - user="user_value", - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AccessBinding.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_access_binding(request) + response = client.batch_delete_access_bindings(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.AccessBinding) - assert response.name == "name_value" - assert response.roles == ["roles_value"] + assert response is None -def test_create_access_binding_rest_required_fields( - request_type=analytics_admin.CreateAccessBindingRequest, +def test_batch_delete_access_bindings_rest_required_fields( + request_type=analytics_admin.BatchDeleteAccessBindingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -61369,7 +62887,7 @@ def test_create_access_binding_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_access_binding._get_unset_required_fields(jsonified_request) + ).batch_delete_access_bindings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -61378,7 +62896,7 @@ def test_create_access_binding_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_access_binding._get_unset_required_fields(jsonified_request) + ).batch_delete_access_bindings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -61392,7 +62910,7 @@ def test_create_access_binding_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.AccessBinding() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -61412,39 +62930,37 @@ def test_create_access_binding_rest_required_fields( response_value = Response() response_value.status_code = 200 - - pb_return_value = resources.AccessBinding.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_access_binding(request) + response = client.batch_delete_access_bindings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_access_binding_rest_unset_required_fields(): +def test_batch_delete_access_bindings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_access_binding._get_unset_required_fields({}) + unset_fields = transport.batch_delete_access_bindings._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) & set( ( "parent", - "accessBinding", + "requests", ) ) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_access_binding_rest_interceptors(null_interceptor): +def test_batch_delete_access_bindings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -61457,14 +62973,12 @@ def test_create_access_binding_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_access_binding" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_access_binding" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_batch_delete_access_bindings", ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.CreateAccessBindingRequest.pb( - analytics_admin.CreateAccessBindingRequest() + pb_message = analytics_admin.BatchDeleteAccessBindingsRequest.pb( + analytics_admin.BatchDeleteAccessBindingsRequest() ) transcode.return_value = { "method": "post", @@ -61476,19 +62990,15 @@ def test_create_access_binding_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.AccessBinding.to_json( - resources.AccessBinding() - ) - request = analytics_admin.CreateAccessBindingRequest() + request = analytics_admin.BatchDeleteAccessBindingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.AccessBinding() - client.create_access_binding( + client.batch_delete_access_bindings( request, metadata=[ ("key", "val"), @@ -61497,11 +63007,11 @@ def test_create_access_binding_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_create_access_binding_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateAccessBindingRequest +def test_batch_delete_access_bindings_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.BatchDeleteAccessBindingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -61510,11 +63020,6 @@ def test_create_access_binding_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "accounts/sample1"} - request_init["access_binding"] = { - "user": "user_value", - "name": "name_value", - "roles": ["roles_value1", "roles_value2"], - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -61526,67 +63031,10 @@ def test_create_access_binding_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_access_binding(request) - - -def test_create_access_binding_rest_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = resources.AccessBinding() - - # get arguments that satisfy an http rule for this method - sample_request = {"parent": "accounts/sample1"} - - # get truthy value for each flattened field - mock_args = dict( - parent="parent_value", - access_binding=resources.AccessBinding(user="user_value"), - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = resources.AccessBinding.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.create_access_binding(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{parent=accounts/*}/accessBindings" % client.transport._host, - args[1], - ) - - -def test_create_access_binding_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_access_binding( - analytics_admin.CreateAccessBindingRequest(), - parent="parent_value", - access_binding=resources.AccessBinding(user="user_value"), - ) + client.batch_delete_access_bindings(request) -def test_create_access_binding_rest_error(): +def test_batch_delete_access_bindings_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -61595,47 +63043,53 @@ def test_create_access_binding_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAccessBindingRequest, + analytics_admin.GetExpandedDataSetRequest, dict, ], ) -def test_get_access_binding_rest(request_type): +def test_get_expanded_data_set_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1/accessBindings/sample2"} + request_init = {"name": "properties/sample1/expandedDataSets/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.AccessBinding( + return_value = expanded_data_set.ExpandedDataSet( name="name_value", - roles=["roles_value"], - user="user_value", + display_name="display_name_value", + description="description_value", + dimension_names=["dimension_names_value"], + metric_names=["metric_names_value"], ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AccessBinding.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = expanded_data_set.ExpandedDataSet.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_access_binding(request) + response = client.get_expanded_data_set(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.AccessBinding) + assert isinstance(response, expanded_data_set.ExpandedDataSet) assert response.name == "name_value" - assert response.roles == ["roles_value"] + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.dimension_names == ["dimension_names_value"] + assert response.metric_names == ["metric_names_value"] -def test_get_access_binding_rest_required_fields( - request_type=analytics_admin.GetAccessBindingRequest, +def test_get_expanded_data_set_rest_required_fields( + request_type=analytics_admin.GetExpandedDataSetRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -61655,7 +63109,7 @@ def test_get_access_binding_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_access_binding._get_unset_required_fields(jsonified_request) + ).get_expanded_data_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -61664,7 +63118,7 @@ def test_get_access_binding_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_access_binding._get_unset_required_fields(jsonified_request) + ).get_expanded_data_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -61678,7 +63132,7 @@ def test_get_access_binding_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.AccessBinding() + return_value = expanded_data_set.ExpandedDataSet() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -61698,30 +63152,31 @@ def test_get_access_binding_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AccessBinding.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = expanded_data_set.ExpandedDataSet.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_access_binding(request) + response = client.get_expanded_data_set(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_access_binding_rest_unset_required_fields(): +def test_get_expanded_data_set_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_access_binding._get_unset_required_fields({}) + unset_fields = transport.get_expanded_data_set._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_access_binding_rest_interceptors(null_interceptor): +def test_get_expanded_data_set_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -61734,14 +63189,14 @@ def test_get_access_binding_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_access_binding" + transports.AnalyticsAdminServiceRestInterceptor, "post_get_expanded_data_set" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_access_binding" + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_expanded_data_set" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetAccessBindingRequest.pb( - analytics_admin.GetAccessBindingRequest() + pb_message = analytics_admin.GetExpandedDataSetRequest.pb( + analytics_admin.GetExpandedDataSetRequest() ) transcode.return_value = { "method": "post", @@ -61753,19 +63208,19 @@ def test_get_access_binding_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.AccessBinding.to_json( - resources.AccessBinding() + req.return_value._content = expanded_data_set.ExpandedDataSet.to_json( + expanded_data_set.ExpandedDataSet() ) - request = analytics_admin.GetAccessBindingRequest() + request = analytics_admin.GetExpandedDataSetRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.AccessBinding() + post.return_value = expanded_data_set.ExpandedDataSet() - client.get_access_binding( + client.get_expanded_data_set( request, metadata=[ ("key", "val"), @@ -61777,8 +63232,8 @@ def test_get_access_binding_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_access_binding_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetAccessBindingRequest +def test_get_expanded_data_set_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetExpandedDataSetRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -61786,7 +63241,7 @@ def test_get_access_binding_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1/accessBindings/sample2"} + request_init = {"name": "properties/sample1/expandedDataSets/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -61798,10 +63253,10 @@ def test_get_access_binding_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_access_binding(request) + client.get_expanded_data_set(request) -def test_get_access_binding_rest_flattened(): +def test_get_expanded_data_set_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -61810,10 +63265,10 @@ def test_get_access_binding_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.AccessBinding() + return_value = expanded_data_set.ExpandedDataSet() # get arguments that satisfy an http rule for this method - sample_request = {"name": "accounts/sample1/accessBindings/sample2"} + sample_request = {"name": "properties/sample1/expandedDataSets/sample2"} # get truthy value for each flattened field mock_args = dict( @@ -61824,24 +63279,26 @@ def test_get_access_binding_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AccessBinding.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = expanded_data_set.ExpandedDataSet.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_access_binding(**mock_args) + client.get_expanded_data_set(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=accounts/*/accessBindings/*}" % client.transport._host, + "%s/v1alpha/{name=properties/*/expandedDataSets/*}" + % client.transport._host, args[1], ) -def test_get_access_binding_rest_flattened_error(transport: str = "rest"): +def test_get_expanded_data_set_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -61850,13 +63307,13 @@ def test_get_access_binding_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_access_binding( - analytics_admin.GetAccessBindingRequest(), + client.get_expanded_data_set( + analytics_admin.GetExpandedDataSetRequest(), name="name_value", ) -def test_get_access_binding_rest_error(): +def test_get_expanded_data_set_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -61865,58 +63322,50 @@ def test_get_access_binding_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateAccessBindingRequest, + analytics_admin.ListExpandedDataSetsRequest, dict, ], ) -def test_update_access_binding_rest(request_type): +def test_list_expanded_data_sets_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "access_binding": {"name": "accounts/sample1/accessBindings/sample2"} - } - request_init["access_binding"] = { - "user": "user_value", - "name": "accounts/sample1/accessBindings/sample2", - "roles": ["roles_value1", "roles_value2"], - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.AccessBinding( - name="name_value", - roles=["roles_value"], - user="user_value", + return_value = analytics_admin.ListExpandedDataSetsResponse( + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AccessBinding.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListExpandedDataSetsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_access_binding(request) + response = client.list_expanded_data_sets(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.AccessBinding) - assert response.name == "name_value" - assert response.roles == ["roles_value"] + assert isinstance(response, pagers.ListExpandedDataSetsPager) + assert response.next_page_token == "next_page_token_value" -def test_update_access_binding_rest_required_fields( - request_type=analytics_admin.UpdateAccessBindingRequest, +def test_list_expanded_data_sets_rest_required_fields( + request_type=analytics_admin.ListExpandedDataSetsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -61931,17 +63380,28 @@ def test_update_access_binding_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_access_binding._get_unset_required_fields(jsonified_request) + ).list_expanded_data_sets._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["parent"] = "parent_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_access_binding._get_unset_required_fields(jsonified_request) + ).list_expanded_data_sets._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -61950,7 +63410,7 @@ def test_update_access_binding_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.AccessBinding() + return_value = analytics_admin.ListExpandedDataSetsResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -61962,39 +63422,47 @@ def test_update_access_binding_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AccessBinding.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListExpandedDataSetsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_access_binding(request) + response = client.list_expanded_data_sets(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_access_binding_rest_unset_required_fields(): +def test_list_expanded_data_sets_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_access_binding._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("accessBinding",))) + unset_fields = transport.list_expanded_data_sets._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "pageSize", + "pageToken", + ) + ) + & set(("parent",)) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_access_binding_rest_interceptors(null_interceptor): +def test_list_expanded_data_sets_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -62007,14 +63475,14 @@ def test_update_access_binding_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_access_binding" + transports.AnalyticsAdminServiceRestInterceptor, "post_list_expanded_data_sets" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_access_binding" + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_expanded_data_sets" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateAccessBindingRequest.pb( - analytics_admin.UpdateAccessBindingRequest() + pb_message = analytics_admin.ListExpandedDataSetsRequest.pb( + analytics_admin.ListExpandedDataSetsRequest() ) transcode.return_value = { "method": "post", @@ -62026,19 +63494,21 @@ def test_update_access_binding_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.AccessBinding.to_json( - resources.AccessBinding() + req.return_value._content = ( + analytics_admin.ListExpandedDataSetsResponse.to_json( + analytics_admin.ListExpandedDataSetsResponse() + ) ) - request = analytics_admin.UpdateAccessBindingRequest() + request = analytics_admin.ListExpandedDataSetsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.AccessBinding() + post.return_value = analytics_admin.ListExpandedDataSetsResponse() - client.update_access_binding( + client.list_expanded_data_sets( request, metadata=[ ("key", "val"), @@ -62050,8 +63520,8 @@ def test_update_access_binding_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_access_binding_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateAccessBindingRequest +def test_list_expanded_data_sets_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListExpandedDataSetsRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -62059,14 +63529,7 @@ def test_update_access_binding_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "access_binding": {"name": "accounts/sample1/accessBindings/sample2"} - } - request_init["access_binding"] = { - "user": "user_value", - "name": "accounts/sample1/accessBindings/sample2", - "roles": ["roles_value1", "roles_value2"], - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -62078,10 +63541,10 @@ def test_update_access_binding_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_access_binding(request) + client.list_expanded_data_sets(request) -def test_update_access_binding_rest_flattened(): +def test_list_expanded_data_sets_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -62090,41 +63553,40 @@ def test_update_access_binding_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.AccessBinding() + return_value = analytics_admin.ListExpandedDataSetsResponse() # get arguments that satisfy an http rule for this method - sample_request = { - "access_binding": {"name": "accounts/sample1/accessBindings/sample2"} - } + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - access_binding=resources.AccessBinding(user="user_value"), + parent="parent_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AccessBinding.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListExpandedDataSetsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_access_binding(**mock_args) + client.list_expanded_data_sets(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{access_binding.name=accounts/*/accessBindings/*}" + "%s/v1alpha/{parent=properties/*}/expandedDataSets" % client.transport._host, args[1], ) -def test_update_access_binding_rest_flattened_error(transport: str = "rest"): +def test_list_expanded_data_sets_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -62133,60 +63595,223 @@ def test_update_access_binding_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_access_binding( - analytics_admin.UpdateAccessBindingRequest(), - access_binding=resources.AccessBinding(user="user_value"), + client.list_expanded_data_sets( + analytics_admin.ListExpandedDataSetsRequest(), + parent="parent_value", ) -def test_update_access_binding_rest_error(): +def test_list_expanded_data_sets_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + ], + next_page_token="abc", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[], + next_page_token="def", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + ], + next_page_token="ghi", + ), + analytics_admin.ListExpandedDataSetsResponse( + expanded_data_sets=[ + expanded_data_set.ExpandedDataSet(), + expanded_data_set.ExpandedDataSet(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListExpandedDataSetsResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "properties/sample1"} + + pager = client.list_expanded_data_sets(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, expanded_data_set.ExpandedDataSet) for i in results) + + pages = list(client.list_expanded_data_sets(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteAccessBindingRequest, + analytics_admin.CreateExpandedDataSetRequest, dict, ], ) -def test_delete_access_binding_rest(request_type): +def test_create_expanded_data_set_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1/accessBindings/sample2"} + request_init = {"parent": "properties/sample1"} + request_init["expanded_data_set"] = { + "name": "name_value", + "display_name": "display_name_value", + "description": "description_value", + "dimension_names": ["dimension_names_value1", "dimension_names_value2"], + "metric_names": ["metric_names_value1", "metric_names_value2"], + "dimension_filter_expression": { + "and_group": {"filter_expressions": {}}, + "not_expression": {}, + "filter": { + "string_filter": { + "match_type": 1, + "value": "value_value", + "case_sensitive": True, + }, + "in_list_filter": { + "values": ["values_value1", "values_value2"], + "case_sensitive": True, + }, + "field_name": "field_name_value", + }, + }, + "data_collection_start_time": {"seconds": 751, "nanos": 543}, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateExpandedDataSetRequest.meta.fields[ + "expanded_data_set" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["expanded_data_set"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["expanded_data_set"][field])): + del request_init["expanded_data_set"][field][i][subfield] + else: + del request_init["expanded_data_set"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = gaa_expanded_data_set.ExpandedDataSet( + name="name_value", + display_name="display_name_value", + description="description_value", + dimension_names=["dimension_names_value"], + metric_names=["metric_names_value"], + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = gaa_expanded_data_set.ExpandedDataSet.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_access_binding(request) + response = client.create_expanded_data_set(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, gaa_expanded_data_set.ExpandedDataSet) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.dimension_names == ["dimension_names_value"] + assert response.metric_names == ["metric_names_value"] -def test_delete_access_binding_rest_required_fields( - request_type=analytics_admin.DeleteAccessBindingRequest, +def test_create_expanded_data_set_rest_required_fields( + request_type=analytics_admin.CreateExpandedDataSetRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -62201,21 +63826,21 @@ def test_delete_access_binding_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_access_binding._get_unset_required_fields(jsonified_request) + ).create_expanded_data_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_access_binding._get_unset_required_fields(jsonified_request) + ).create_expanded_data_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -62224,7 +63849,7 @@ def test_delete_access_binding_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = gaa_expanded_data_set.ExpandedDataSet() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -62236,36 +63861,48 @@ def test_delete_access_binding_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = gaa_expanded_data_set.ExpandedDataSet.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_access_binding(request) + response = client.create_expanded_data_set(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_access_binding_rest_unset_required_fields(): +def test_create_expanded_data_set_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_access_binding._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.create_expanded_data_set._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "expandedDataSet", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_access_binding_rest_interceptors(null_interceptor): +def test_create_expanded_data_set_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -62278,11 +63915,14 @@ def test_delete_access_binding_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_access_binding" + transports.AnalyticsAdminServiceRestInterceptor, "post_create_expanded_data_set" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_expanded_data_set" ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteAccessBindingRequest.pb( - analytics_admin.DeleteAccessBindingRequest() + post.assert_not_called() + pb_message = analytics_admin.CreateExpandedDataSetRequest.pb( + analytics_admin.CreateExpandedDataSetRequest() ) transcode.return_value = { "method": "post", @@ -62294,15 +63934,19 @@ def test_delete_access_binding_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = gaa_expanded_data_set.ExpandedDataSet.to_json( + gaa_expanded_data_set.ExpandedDataSet() + ) - request = analytics_admin.DeleteAccessBindingRequest() + request = analytics_admin.CreateExpandedDataSetRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = gaa_expanded_data_set.ExpandedDataSet() - client.delete_access_binding( + client.create_expanded_data_set( request, metadata=[ ("key", "val"), @@ -62311,10 +63955,11 @@ def test_delete_access_binding_rest_interceptors(null_interceptor): ) pre.assert_called_once() + post.assert_called_once() -def test_delete_access_binding_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteAccessBindingRequest +def test_create_expanded_data_set_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateExpandedDataSetRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -62322,7 +63967,7 @@ def test_delete_access_binding_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "accounts/sample1/accessBindings/sample2"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -62334,10 +63979,10 @@ def test_delete_access_binding_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_access_binding(request) + client.create_expanded_data_set(request) -def test_delete_access_binding_rest_flattened(): +def test_create_expanded_data_set_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -62346,37 +63991,41 @@ def test_delete_access_binding_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = gaa_expanded_data_set.ExpandedDataSet() # get arguments that satisfy an http rule for this method - sample_request = {"name": "accounts/sample1/accessBindings/sample2"} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", + expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = gaa_expanded_data_set.ExpandedDataSet.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.delete_access_binding(**mock_args) + client.create_expanded_data_set(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=accounts/*/accessBindings/*}" % client.transport._host, + "%s/v1alpha/{parent=properties/*}/expandedDataSets" + % client.transport._host, args[1], ) -def test_delete_access_binding_rest_flattened_error(transport: str = "rest"): +def test_create_expanded_data_set_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -62385,13 +64034,14 @@ def test_delete_access_binding_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_access_binding( - analytics_admin.DeleteAccessBindingRequest(), - name="name_value", + client.create_expanded_data_set( + analytics_admin.CreateExpandedDataSetRequest(), + parent="parent_value", + expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), ) -def test_delete_access_binding_rest_error(): +def test_create_expanded_data_set_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -62400,49 +64050,152 @@ def test_delete_access_binding_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAccessBindingsRequest, + analytics_admin.UpdateExpandedDataSetRequest, dict, ], ) -def test_list_access_bindings_rest(request_type): +def test_update_expanded_data_set_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = { + "expanded_data_set": {"name": "properties/sample1/expandedDataSets/sample2"} + } + request_init["expanded_data_set"] = { + "name": "properties/sample1/expandedDataSets/sample2", + "display_name": "display_name_value", + "description": "description_value", + "dimension_names": ["dimension_names_value1", "dimension_names_value2"], + "metric_names": ["metric_names_value1", "metric_names_value2"], + "dimension_filter_expression": { + "and_group": {"filter_expressions": {}}, + "not_expression": {}, + "filter": { + "string_filter": { + "match_type": 1, + "value": "value_value", + "case_sensitive": True, + }, + "in_list_filter": { + "values": ["values_value1", "values_value2"], + "case_sensitive": True, + }, + "field_name": "field_name_value", + }, + }, + "data_collection_start_time": {"seconds": 751, "nanos": 543}, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateExpandedDataSetRequest.meta.fields[ + "expanded_data_set" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["expanded_data_set"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["expanded_data_set"][field])): + del request_init["expanded_data_set"][field][i][subfield] + else: + del request_init["expanded_data_set"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListAccessBindingsResponse( - next_page_token="next_page_token_value", + return_value = gaa_expanded_data_set.ExpandedDataSet( + name="name_value", + display_name="display_name_value", + description="description_value", + dimension_names=["dimension_names_value"], + metric_names=["metric_names_value"], ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListAccessBindingsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = gaa_expanded_data_set.ExpandedDataSet.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_access_bindings(request) + response = client.update_expanded_data_set(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAccessBindingsPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, gaa_expanded_data_set.ExpandedDataSet) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.dimension_names == ["dimension_names_value"] + assert response.metric_names == ["metric_names_value"] -def test_list_access_bindings_rest_required_fields( - request_type=analytics_admin.ListAccessBindingsRequest, +def test_update_expanded_data_set_rest_required_fields( + request_type=analytics_admin.UpdateExpandedDataSetRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -62457,28 +64210,19 @@ def test_list_access_bindings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_access_bindings._get_unset_required_fields(jsonified_request) + ).update_expanded_data_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_access_bindings._get_unset_required_fields(jsonified_request) + ).update_expanded_data_set._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) - ) + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -62487,7 +64231,7 @@ def test_list_access_bindings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListAccessBindingsResponse() + return_value = gaa_expanded_data_set.ExpandedDataSet() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -62499,48 +64243,48 @@ def test_list_access_bindings_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "patch", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListAccessBindingsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = gaa_expanded_data_set.ExpandedDataSet.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_access_bindings(request) + response = client.update_expanded_data_set(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_access_bindings_rest_unset_required_fields(): +def test_update_expanded_data_set_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_access_bindings._get_unset_required_fields({}) + unset_fields = transport.update_expanded_data_set._get_unset_required_fields({}) assert set(unset_fields) == ( - set( + set(("updateMask",)) + & set( ( - "pageSize", - "pageToken", + "expandedDataSet", + "updateMask", ) ) - & set(("parent",)) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_access_bindings_rest_interceptors(null_interceptor): +def test_update_expanded_data_set_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -62553,14 +64297,14 @@ def test_list_access_bindings_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_access_bindings" + transports.AnalyticsAdminServiceRestInterceptor, "post_update_expanded_data_set" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_access_bindings" + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_expanded_data_set" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListAccessBindingsRequest.pb( - analytics_admin.ListAccessBindingsRequest() + pb_message = analytics_admin.UpdateExpandedDataSetRequest.pb( + analytics_admin.UpdateExpandedDataSetRequest() ) transcode.return_value = { "method": "post", @@ -62572,19 +64316,19 @@ def test_list_access_bindings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ListAccessBindingsResponse.to_json( - analytics_admin.ListAccessBindingsResponse() + req.return_value._content = gaa_expanded_data_set.ExpandedDataSet.to_json( + gaa_expanded_data_set.ExpandedDataSet() ) - request = analytics_admin.ListAccessBindingsRequest() + request = analytics_admin.UpdateExpandedDataSetRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListAccessBindingsResponse() + post.return_value = gaa_expanded_data_set.ExpandedDataSet() - client.list_access_bindings( + client.update_expanded_data_set( request, metadata=[ ("key", "val"), @@ -62596,8 +64340,8 @@ def test_list_access_bindings_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_access_bindings_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListAccessBindingsRequest +def test_update_expanded_data_set_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateExpandedDataSetRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -62605,7 +64349,9 @@ def test_list_access_bindings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = { + "expanded_data_set": {"name": "properties/sample1/expandedDataSets/sample2"} + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -62617,10 +64363,10 @@ def test_list_access_bindings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_access_bindings(request) + client.update_expanded_data_set(request) -def test_list_access_bindings_rest_flattened(): +def test_update_expanded_data_set_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -62629,38 +64375,43 @@ def test_list_access_bindings_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListAccessBindingsResponse() + return_value = gaa_expanded_data_set.ExpandedDataSet() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "accounts/sample1"} + sample_request = { + "expanded_data_set": {"name": "properties/sample1/expandedDataSets/sample2"} + } # get truthy value for each flattened field mock_args = dict( - parent="parent_value", + expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListAccessBindingsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = gaa_expanded_data_set.ExpandedDataSet.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_access_bindings(**mock_args) + client.update_expanded_data_set(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=accounts/*}/accessBindings" % client.transport._host, + "%s/v1alpha/{expanded_data_set.name=properties/*/expandedDataSets/*}" + % client.transport._host, args[1], ) -def test_list_access_bindings_rest_flattened_error(transport: str = "rest"): +def test_update_expanded_data_set_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -62669,120 +64420,61 @@ def test_list_access_bindings_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_access_bindings( - analytics_admin.ListAccessBindingsRequest(), - parent="parent_value", + client.update_expanded_data_set( + analytics_admin.UpdateExpandedDataSetRequest(), + expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_list_access_bindings_rest_pager(transport: str = "rest"): +def test_update_expanded_data_set_rest_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - resources.AccessBinding(), - resources.AccessBinding(), - ], - next_page_token="abc", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[], - next_page_token="def", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAccessBindingsResponse( - access_bindings=[ - resources.AccessBinding(), - resources.AccessBinding(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListAccessBindingsResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "accounts/sample1"} - - pager = client.list_access_bindings(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.AccessBinding) for i in results) - - pages = list(client.list_access_bindings(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchCreateAccessBindingsRequest, + analytics_admin.DeleteExpandedDataSetRequest, dict, ], ) -def test_batch_create_access_bindings_rest(request_type): +def test_delete_expanded_data_set_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"name": "properties/sample1/expandedDataSets/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.BatchCreateAccessBindingsResponse() + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.BatchCreateAccessBindingsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_create_access_bindings(request) + response = client.delete_expanded_data_set(request) # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchCreateAccessBindingsResponse) + assert response is None -def test_batch_create_access_bindings_rest_required_fields( - request_type=analytics_admin.BatchCreateAccessBindingsRequest, +def test_delete_expanded_data_set_rest_required_fields( + request_type=analytics_admin.DeleteExpandedDataSetRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -62797,21 +64489,21 @@ def test_batch_create_access_bindings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_create_access_bindings._get_unset_required_fields(jsonified_request) + ).delete_expanded_data_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_create_access_bindings._get_unset_required_fields(jsonified_request) + ).delete_expanded_data_set._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -62820,7 +64512,7 @@ def test_batch_create_access_bindings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.BatchCreateAccessBindingsResponse() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -62832,49 +64524,36 @@ def test_batch_create_access_bindings_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "delete", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = analytics_admin.BatchCreateAccessBindingsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_create_access_bindings(request) + response = client.delete_expanded_data_set(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_batch_create_access_bindings_rest_unset_required_fields(): +def test_delete_expanded_data_set_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.batch_create_access_bindings._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(()) - & set( - ( - "parent", - "requests", - ) - ) - ) + unset_fields = transport.delete_expanded_data_set._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_batch_create_access_bindings_rest_interceptors(null_interceptor): +def test_delete_expanded_data_set_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -62887,16 +64566,11 @@ def test_batch_create_access_bindings_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_batch_create_access_bindings", - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_batch_create_access_bindings", + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_expanded_data_set" ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.BatchCreateAccessBindingsRequest.pb( - analytics_admin.BatchCreateAccessBindingsRequest() + pb_message = analytics_admin.DeleteExpandedDataSetRequest.pb( + analytics_admin.DeleteExpandedDataSetRequest() ) transcode.return_value = { "method": "post", @@ -62908,21 +64582,15 @@ def test_batch_create_access_bindings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.BatchCreateAccessBindingsResponse.to_json( - analytics_admin.BatchCreateAccessBindingsResponse() - ) - ) - request = analytics_admin.BatchCreateAccessBindingsRequest() + request = analytics_admin.DeleteExpandedDataSetRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.BatchCreateAccessBindingsResponse() - client.batch_create_access_bindings( + client.delete_expanded_data_set( request, metadata=[ ("key", "val"), @@ -62931,12 +64599,10 @@ def test_batch_create_access_bindings_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_batch_create_access_bindings_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.BatchCreateAccessBindingsRequest, +def test_delete_expanded_data_set_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeleteExpandedDataSetRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -62944,7 +64610,7 @@ def test_batch_create_access_bindings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"name": "properties/sample1/expandedDataSets/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -62956,10 +64622,65 @@ def test_batch_create_access_bindings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.batch_create_access_bindings(request) + client.delete_expanded_data_set(request) -def test_batch_create_access_bindings_rest_error(): +def test_delete_expanded_data_set_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = None + + # get arguments that satisfy an http rule for this method + sample_request = {"name": "properties/sample1/expandedDataSets/sample2"} + + # get truthy value for each flattened field + mock_args = dict( + name="name_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = "" + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.delete_expanded_data_set(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{name=properties/*/expandedDataSets/*}" + % client.transport._host, + args[1], + ) + + +def test_delete_expanded_data_set_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_expanded_data_set( + analytics_admin.DeleteExpandedDataSetRequest(), + name="name_value", + ) + + +def test_delete_expanded_data_set_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -62968,49 +64689,56 @@ def test_batch_create_access_bindings_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchGetAccessBindingsRequest, + analytics_admin.GetChannelGroupRequest, dict, ], ) -def test_batch_get_access_bindings_rest(request_type): +def test_get_channel_group_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"name": "properties/sample1/channelGroups/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.BatchGetAccessBindingsResponse() + return_value = channel_group.ChannelGroup( + name="name_value", + display_name="display_name_value", + description="description_value", + system_defined=True, + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.BatchGetAccessBindingsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = channel_group.ChannelGroup.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_get_access_bindings(request) + response = client.get_channel_group(request) # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchGetAccessBindingsResponse) + assert isinstance(response, channel_group.ChannelGroup) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.system_defined is True -def test_batch_get_access_bindings_rest_required_fields( - request_type=analytics_admin.BatchGetAccessBindingsRequest, +def test_get_channel_group_rest_required_fields( + request_type=analytics_admin.GetChannelGroupRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" - request_init["names"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -63022,32 +64750,24 @@ def test_batch_get_access_bindings_rest_required_fields( ) # verify fields with default values are dropped - assert "names" not in jsonified_request unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_get_access_bindings._get_unset_required_fields(jsonified_request) + ).get_channel_group._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - assert "names" in jsonified_request - assert jsonified_request["names"] == request_init["names"] - jsonified_request["parent"] = "parent_value" - jsonified_request["names"] = "names_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_get_access_bindings._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("names",)) + ).get_channel_group._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" - assert "names" in jsonified_request - assert jsonified_request["names"] == "names_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -63056,7 +64776,7 @@ def test_batch_get_access_bindings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.BatchGetAccessBindingsResponse() + return_value = channel_group.ChannelGroup() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -63076,46 +64796,31 @@ def test_batch_get_access_bindings_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.BatchGetAccessBindingsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = channel_group.ChannelGroup.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_get_access_bindings(request) + response = client.get_channel_group(request) - expected_params = [ - ( - "names", - "", - ), - ("$alt", "json;enum-encoding=int"), - ] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_batch_get_access_bindings_rest_unset_required_fields(): +def test_get_channel_group_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.batch_get_access_bindings._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(("names",)) - & set( - ( - "parent", - "names", - ) - ) - ) + unset_fields = transport.get_channel_group._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_batch_get_access_bindings_rest_interceptors(null_interceptor): +def test_get_channel_group_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -63128,15 +64833,14 @@ def test_batch_get_access_bindings_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_batch_get_access_bindings", + transports.AnalyticsAdminServiceRestInterceptor, "post_get_channel_group" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_batch_get_access_bindings" + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_channel_group" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.BatchGetAccessBindingsRequest.pb( - analytics_admin.BatchGetAccessBindingsRequest() + pb_message = analytics_admin.GetChannelGroupRequest.pb( + analytics_admin.GetChannelGroupRequest() ) transcode.return_value = { "method": "post", @@ -63148,21 +64852,19 @@ def test_batch_get_access_bindings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.BatchGetAccessBindingsResponse.to_json( - analytics_admin.BatchGetAccessBindingsResponse() - ) + req.return_value._content = channel_group.ChannelGroup.to_json( + channel_group.ChannelGroup() ) - request = analytics_admin.BatchGetAccessBindingsRequest() + request = analytics_admin.GetChannelGroupRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.BatchGetAccessBindingsResponse() + post.return_value = channel_group.ChannelGroup() - client.batch_get_access_bindings( + client.get_channel_group( request, metadata=[ ("key", "val"), @@ -63174,8 +64876,8 @@ def test_batch_get_access_bindings_rest_interceptors(null_interceptor): post.assert_called_once() -def test_batch_get_access_bindings_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.BatchGetAccessBindingsRequest +def test_get_channel_group_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetChannelGroupRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -63183,7 +64885,7 @@ def test_batch_get_access_bindings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"name": "properties/sample1/channelGroups/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -63195,10 +64897,66 @@ def test_batch_get_access_bindings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.batch_get_access_bindings(request) + client.get_channel_group(request) -def test_batch_get_access_bindings_rest_error(): +def test_get_channel_group_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = channel_group.ChannelGroup() + + # get arguments that satisfy an http rule for this method + sample_request = {"name": "properties/sample1/channelGroups/sample2"} + + # get truthy value for each flattened field + mock_args = dict( + name="name_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = channel_group.ChannelGroup.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_channel_group(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{name=properties/*/channelGroups/*}" % client.transport._host, + args[1], + ) + + +def test_get_channel_group_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_channel_group( + analytics_admin.GetChannelGroupRequest(), + name="name_value", + ) + + +def test_get_channel_group_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -63207,43 +64965,45 @@ def test_batch_get_access_bindings_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchUpdateAccessBindingsRequest, + analytics_admin.ListChannelGroupsRequest, dict, ], ) -def test_batch_update_access_bindings_rest(request_type): +def test_list_channel_groups_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.BatchUpdateAccessBindingsResponse() + return_value = analytics_admin.ListChannelGroupsResponse( + next_page_token="next_page_token_value", + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.BatchUpdateAccessBindingsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListChannelGroupsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_update_access_bindings(request) + response = client.list_channel_groups(request) # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.BatchUpdateAccessBindingsResponse) + assert isinstance(response, pagers.ListChannelGroupsPager) + assert response.next_page_token == "next_page_token_value" -def test_batch_update_access_bindings_rest_required_fields( - request_type=analytics_admin.BatchUpdateAccessBindingsRequest, +def test_list_channel_groups_rest_required_fields( + request_type=analytics_admin.ListChannelGroupsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -63263,7 +65023,7 @@ def test_batch_update_access_bindings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_update_access_bindings._get_unset_required_fields(jsonified_request) + ).list_channel_groups._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -63272,7 +65032,14 @@ def test_batch_update_access_bindings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_update_access_bindings._get_unset_required_fields(jsonified_request) + ).list_channel_groups._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -63286,7 +65053,7 @@ def test_batch_update_access_bindings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.BatchUpdateAccessBindingsResponse() + return_value = analytics_admin.ListChannelGroupsResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -63298,49 +65065,47 @@ def test_batch_update_access_bindings_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.BatchUpdateAccessBindingsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListChannelGroupsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_update_access_bindings(request) + response = client.list_channel_groups(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_batch_update_access_bindings_rest_unset_required_fields(): +def test_list_channel_groups_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.batch_update_access_bindings._get_unset_required_fields({}) + unset_fields = transport.list_channel_groups._get_unset_required_fields({}) assert set(unset_fields) == ( - set(()) - & set( + set( ( - "parent", - "requests", + "pageSize", + "pageToken", ) ) + & set(("parent",)) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_batch_update_access_bindings_rest_interceptors(null_interceptor): +def test_list_channel_groups_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -63353,16 +65118,14 @@ def test_batch_update_access_bindings_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_batch_update_access_bindings", + transports.AnalyticsAdminServiceRestInterceptor, "post_list_channel_groups" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_batch_update_access_bindings", + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_channel_groups" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.BatchUpdateAccessBindingsRequest.pb( - analytics_admin.BatchUpdateAccessBindingsRequest() + pb_message = analytics_admin.ListChannelGroupsRequest.pb( + analytics_admin.ListChannelGroupsRequest() ) transcode.return_value = { "method": "post", @@ -63374,21 +65137,19 @@ def test_batch_update_access_bindings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.BatchUpdateAccessBindingsResponse.to_json( - analytics_admin.BatchUpdateAccessBindingsResponse() - ) + req.return_value._content = analytics_admin.ListChannelGroupsResponse.to_json( + analytics_admin.ListChannelGroupsResponse() ) - request = analytics_admin.BatchUpdateAccessBindingsRequest() + request = analytics_admin.ListChannelGroupsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.BatchUpdateAccessBindingsResponse() + post.return_value = analytics_admin.ListChannelGroupsResponse() - client.batch_update_access_bindings( + client.list_channel_groups( request, metadata=[ ("key", "val"), @@ -63400,9 +65161,8 @@ def test_batch_update_access_bindings_rest_interceptors(null_interceptor): post.assert_called_once() -def test_batch_update_access_bindings_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.BatchUpdateAccessBindingsRequest, +def test_list_channel_groups_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListChannelGroupsRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -63410,7 +65170,7 @@ def test_batch_update_access_bindings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -63422,52 +65182,266 @@ def test_batch_update_access_bindings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.batch_update_access_bindings(request) + client.list_channel_groups(request) -def test_batch_update_access_bindings_rest_error(): +def test_list_channel_groups_rest_flattened(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = analytics_admin.ListChannelGroupsResponse() + + # get arguments that satisfy an http rule for this method + sample_request = {"parent": "properties/sample1"} + + # get truthy value for each flattened field + mock_args = dict( + parent="parent_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = analytics_admin.ListChannelGroupsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.list_channel_groups(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{parent=properties/*}/channelGroups" % client.transport._host, + args[1], + ) + + +def test_list_channel_groups_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_channel_groups( + analytics_admin.ListChannelGroupsRequest(), + parent="parent_value", + ) + + +def test_list_channel_groups_rest_pager(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + ], + next_page_token="abc", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[], + next_page_token="def", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + ], + next_page_token="ghi", + ), + analytics_admin.ListChannelGroupsResponse( + channel_groups=[ + channel_group.ChannelGroup(), + channel_group.ChannelGroup(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListChannelGroupsResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "properties/sample1"} + + pager = client.list_channel_groups(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, channel_group.ChannelGroup) for i in results) + + pages = list(client.list_channel_groups(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + @pytest.mark.parametrize( "request_type", [ - analytics_admin.BatchDeleteAccessBindingsRequest, + analytics_admin.CreateChannelGroupRequest, dict, ], ) -def test_batch_delete_access_bindings_rest(request_type): +def test_create_channel_group_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"parent": "properties/sample1"} + request_init["channel_group"] = { + "name": "name_value", + "display_name": "display_name_value", + "description": "description_value", + "grouping_rule": [ + { + "display_name": "display_name_value", + "expression": { + "and_group": {"filter_expressions": {}}, + "or_group": {}, + "not_expression": {}, + "filter": { + "string_filter": {"match_type": 1, "value": "value_value"}, + "in_list_filter": { + "values": ["values_value1", "values_value2"] + }, + "field_name": "field_name_value", + }, + }, + } + ], + "system_defined": True, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateChannelGroupRequest.meta.fields["channel_group"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["channel_group"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["channel_group"][field])): + del request_init["channel_group"][field][i][subfield] + else: + del request_init["channel_group"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = gaa_channel_group.ChannelGroup( + name="name_value", + display_name="display_name_value", + description="description_value", + system_defined=True, + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = gaa_channel_group.ChannelGroup.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_delete_access_bindings(request) + response = client.create_channel_group(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, gaa_channel_group.ChannelGroup) + assert response.name == "name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.system_defined is True -def test_batch_delete_access_bindings_rest_required_fields( - request_type=analytics_admin.BatchDeleteAccessBindingsRequest, +def test_create_channel_group_rest_required_fields( + request_type=analytics_admin.CreateChannelGroupRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -63487,7 +65461,7 @@ def test_batch_delete_access_bindings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_delete_access_bindings._get_unset_required_fields(jsonified_request) + ).create_channel_group._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -63496,7 +65470,7 @@ def test_batch_delete_access_bindings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).batch_delete_access_bindings._get_unset_required_fields(jsonified_request) + ).create_channel_group._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -63510,7 +65484,7 @@ def test_batch_delete_access_bindings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = gaa_channel_group.ChannelGroup() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -63530,37 +65504,40 @@ def test_batch_delete_access_bindings_rest_required_fields( response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = gaa_channel_group.ChannelGroup.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.batch_delete_access_bindings(request) + response = client.create_channel_group(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_batch_delete_access_bindings_rest_unset_required_fields(): +def test_create_channel_group_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.batch_delete_access_bindings._get_unset_required_fields({}) + unset_fields = transport.create_channel_group._get_unset_required_fields({}) assert set(unset_fields) == ( set(()) & set( ( "parent", - "requests", + "channelGroup", ) ) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_batch_delete_access_bindings_rest_interceptors(null_interceptor): +def test_create_channel_group_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -63573,12 +65550,14 @@ def test_batch_delete_access_bindings_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_batch_delete_access_bindings", + transports.AnalyticsAdminServiceRestInterceptor, "post_create_channel_group" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_channel_group" ) as pre: pre.assert_not_called() - pb_message = analytics_admin.BatchDeleteAccessBindingsRequest.pb( - analytics_admin.BatchDeleteAccessBindingsRequest() + post.assert_not_called() + pb_message = analytics_admin.CreateChannelGroupRequest.pb( + analytics_admin.CreateChannelGroupRequest() ) transcode.return_value = { "method": "post", @@ -63590,15 +65569,19 @@ def test_batch_delete_access_bindings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = gaa_channel_group.ChannelGroup.to_json( + gaa_channel_group.ChannelGroup() + ) - request = analytics_admin.BatchDeleteAccessBindingsRequest() + request = analytics_admin.CreateChannelGroupRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = gaa_channel_group.ChannelGroup() - client.batch_delete_access_bindings( + client.create_channel_group( request, metadata=[ ("key", "val"), @@ -63607,11 +65590,11 @@ def test_batch_delete_access_bindings_rest_interceptors(null_interceptor): ) pre.assert_called_once() + post.assert_called_once() -def test_batch_delete_access_bindings_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.BatchDeleteAccessBindingsRequest, +def test_create_channel_group_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateChannelGroupRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -63619,7 +65602,7 @@ def test_batch_delete_access_bindings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "accounts/sample1"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -63631,10 +65614,68 @@ def test_batch_delete_access_bindings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.batch_delete_access_bindings(request) + client.create_channel_group(request) -def test_batch_delete_access_bindings_rest_error(): +def test_create_channel_group_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = gaa_channel_group.ChannelGroup() + + # get arguments that satisfy an http rule for this method + sample_request = {"parent": "properties/sample1"} + + # get truthy value for each flattened field + mock_args = dict( + parent="parent_value", + channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = gaa_channel_group.ChannelGroup.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.create_channel_group(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{parent=properties/*}/channelGroups" % client.transport._host, + args[1], + ) + + +def test_create_channel_group_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_channel_group( + analytics_admin.CreateChannelGroupRequest(), + parent="parent_value", + channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + ) + + +def test_create_channel_group_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -63643,57 +65684,147 @@ def test_batch_delete_access_bindings_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetExpandedDataSetRequest, + analytics_admin.UpdateChannelGroupRequest, dict, ], ) -def test_get_expanded_data_set_rest(request_type): +def test_update_channel_group_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/expandedDataSets/sample2"} + request_init = { + "channel_group": {"name": "properties/sample1/channelGroups/sample2"} + } + request_init["channel_group"] = { + "name": "properties/sample1/channelGroups/sample2", + "display_name": "display_name_value", + "description": "description_value", + "grouping_rule": [ + { + "display_name": "display_name_value", + "expression": { + "and_group": {"filter_expressions": {}}, + "or_group": {}, + "not_expression": {}, + "filter": { + "string_filter": {"match_type": 1, "value": "value_value"}, + "in_list_filter": { + "values": ["values_value1", "values_value2"] + }, + "field_name": "field_name_value", + }, + }, + } + ], + "system_defined": True, + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateChannelGroupRequest.meta.fields["channel_group"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["channel_group"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["channel_group"][field])): + del request_init["channel_group"][field][i][subfield] + else: + del request_init["channel_group"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = expanded_data_set.ExpandedDataSet( + return_value = gaa_channel_group.ChannelGroup( name="name_value", display_name="display_name_value", description="description_value", - dimension_names=["dimension_names_value"], - metric_names=["metric_names_value"], + system_defined=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = expanded_data_set.ExpandedDataSet.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = gaa_channel_group.ChannelGroup.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_expanded_data_set(request) + response = client.update_channel_group(request) # Establish that the response is the type that we expect. - assert isinstance(response, expanded_data_set.ExpandedDataSet) + assert isinstance(response, gaa_channel_group.ChannelGroup) assert response.name == "name_value" assert response.display_name == "display_name_value" assert response.description == "description_value" - assert response.dimension_names == ["dimension_names_value"] - assert response.metric_names == ["metric_names_value"] + assert response.system_defined is True -def test_get_expanded_data_set_rest_required_fields( - request_type=analytics_admin.GetExpandedDataSetRequest, +def test_update_channel_group_rest_required_fields( + request_type=analytics_admin.UpdateChannelGroupRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -63708,21 +65839,19 @@ def test_get_expanded_data_set_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_expanded_data_set._get_unset_required_fields(jsonified_request) + ).update_channel_group._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_expanded_data_set._get_unset_required_fields(jsonified_request) + ).update_channel_group._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -63731,7 +65860,7 @@ def test_get_expanded_data_set_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = expanded_data_set.ExpandedDataSet() + return_value = gaa_channel_group.ChannelGroup() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -63743,38 +65872,48 @@ def test_get_expanded_data_set_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "patch", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = expanded_data_set.ExpandedDataSet.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = gaa_channel_group.ChannelGroup.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_expanded_data_set(request) + response = client.update_channel_group(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_expanded_data_set_rest_unset_required_fields(): +def test_update_channel_group_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_expanded_data_set._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.update_channel_group._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("updateMask",)) + & set( + ( + "channelGroup", + "updateMask", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_expanded_data_set_rest_interceptors(null_interceptor): +def test_update_channel_group_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -63787,14 +65926,14 @@ def test_get_expanded_data_set_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_expanded_data_set" + transports.AnalyticsAdminServiceRestInterceptor, "post_update_channel_group" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_expanded_data_set" + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_channel_group" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetExpandedDataSetRequest.pb( - analytics_admin.GetExpandedDataSetRequest() + pb_message = analytics_admin.UpdateChannelGroupRequest.pb( + analytics_admin.UpdateChannelGroupRequest() ) transcode.return_value = { "method": "post", @@ -63806,19 +65945,19 @@ def test_get_expanded_data_set_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = expanded_data_set.ExpandedDataSet.to_json( - expanded_data_set.ExpandedDataSet() + req.return_value._content = gaa_channel_group.ChannelGroup.to_json( + gaa_channel_group.ChannelGroup() ) - request = analytics_admin.GetExpandedDataSetRequest() + request = analytics_admin.UpdateChannelGroupRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = expanded_data_set.ExpandedDataSet() + post.return_value = gaa_channel_group.ChannelGroup() - client.get_expanded_data_set( + client.update_channel_group( request, metadata=[ ("key", "val"), @@ -63830,8 +65969,8 @@ def test_get_expanded_data_set_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_expanded_data_set_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetExpandedDataSetRequest +def test_update_channel_group_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateChannelGroupRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -63839,7 +65978,9 @@ def test_get_expanded_data_set_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/expandedDataSets/sample2"} + request_init = { + "channel_group": {"name": "properties/sample1/channelGroups/sample2"} + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -63851,10 +65992,10 @@ def test_get_expanded_data_set_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_expanded_data_set(request) + client.update_channel_group(request) -def test_get_expanded_data_set_rest_flattened(): +def test_update_channel_group_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -63863,39 +66004,43 @@ def test_get_expanded_data_set_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = expanded_data_set.ExpandedDataSet() + return_value = gaa_channel_group.ChannelGroup() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/expandedDataSets/sample2"} + sample_request = { + "channel_group": {"name": "properties/sample1/channelGroups/sample2"} + } # get truthy value for each flattened field mock_args = dict( - name="name_value", + channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = expanded_data_set.ExpandedDataSet.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = gaa_channel_group.ChannelGroup.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_expanded_data_set(**mock_args) + client.update_channel_group(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/expandedDataSets/*}" + "%s/v1alpha/{channel_group.name=properties/*/channelGroups/*}" % client.transport._host, args[1], ) -def test_get_expanded_data_set_rest_flattened_error(transport: str = "rest"): +def test_update_channel_group_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -63904,13 +66049,14 @@ def test_get_expanded_data_set_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_expanded_data_set( - analytics_admin.GetExpandedDataSetRequest(), - name="name_value", + client.update_channel_group( + analytics_admin.UpdateChannelGroupRequest(), + channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_get_expanded_data_set_rest_error(): +def test_update_channel_group_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -63919,49 +66065,45 @@ def test_get_expanded_data_set_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListExpandedDataSetsRequest, + analytics_admin.DeleteChannelGroupRequest, dict, ], ) -def test_list_expanded_data_sets_rest(request_type): +def test_delete_channel_group_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = {"name": "properties/sample1/channelGroups/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListExpandedDataSetsResponse( - next_page_token="next_page_token_value", - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListExpandedDataSetsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_expanded_data_sets(request) + response = client.delete_channel_group(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListExpandedDataSetsPager) - assert response.next_page_token == "next_page_token_value" + assert response is None -def test_list_expanded_data_sets_rest_required_fields( - request_type=analytics_admin.ListExpandedDataSetsRequest, +def test_delete_channel_group_rest_required_fields( + request_type=analytics_admin.DeleteChannelGroupRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -63976,28 +66118,21 @@ def test_list_expanded_data_sets_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_expanded_data_sets._get_unset_required_fields(jsonified_request) + ).delete_channel_group._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_expanded_data_sets._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) - ) + ).delete_channel_group._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -64006,7 +66141,7 @@ def test_list_expanded_data_sets_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListExpandedDataSetsResponse() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -64018,48 +66153,36 @@ def test_list_expanded_data_sets_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "delete", "query_params": pb_request, } transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = analytics_admin.ListExpandedDataSetsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_expanded_data_sets(request) + response = client.delete_channel_group(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_expanded_data_sets_rest_unset_required_fields(): +def test_delete_channel_group_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_expanded_data_sets._get_unset_required_fields({}) - assert set(unset_fields) == ( - set( - ( - "pageSize", - "pageToken", - ) - ) - & set(("parent",)) - ) + unset_fields = transport.delete_channel_group._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_expanded_data_sets_rest_interceptors(null_interceptor): +def test_delete_channel_group_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -64072,14 +66195,11 @@ def test_list_expanded_data_sets_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_expanded_data_sets" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_expanded_data_sets" + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_channel_group" ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.ListExpandedDataSetsRequest.pb( - analytics_admin.ListExpandedDataSetsRequest() + pb_message = analytics_admin.DeleteChannelGroupRequest.pb( + analytics_admin.DeleteChannelGroupRequest() ) transcode.return_value = { "method": "post", @@ -64091,21 +66211,15 @@ def test_list_expanded_data_sets_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.ListExpandedDataSetsResponse.to_json( - analytics_admin.ListExpandedDataSetsResponse() - ) - ) - request = analytics_admin.ListExpandedDataSetsRequest() + request = analytics_admin.DeleteChannelGroupRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListExpandedDataSetsResponse() - client.list_expanded_data_sets( + client.delete_channel_group( request, metadata=[ ("key", "val"), @@ -64114,11 +66228,10 @@ def test_list_expanded_data_sets_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_list_expanded_data_sets_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListExpandedDataSetsRequest +def test_delete_channel_group_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeleteChannelGroupRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -64126,7 +66239,7 @@ def test_list_expanded_data_sets_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = {"name": "properties/sample1/channelGroups/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -64138,10 +66251,10 @@ def test_list_expanded_data_sets_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_expanded_data_sets(request) + client.delete_channel_group(request) -def test_list_expanded_data_sets_rest_flattened(): +def test_delete_channel_group_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -64150,39 +66263,37 @@ def test_list_expanded_data_sets_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListExpandedDataSetsResponse() + return_value = None # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = {"name": "properties/sample1/channelGroups/sample2"} # get truthy value for each flattened field mock_args = dict( - parent="parent_value", + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListExpandedDataSetsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_expanded_data_sets(**mock_args) + client.delete_channel_group(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/expandedDataSets" - % client.transport._host, + "%s/v1alpha/{name=properties/*/channelGroups/*}" % client.transport._host, args[1], ) -def test_list_expanded_data_sets_rest_flattened_error(transport: str = "rest"): +def test_delete_channel_group_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -64191,153 +66302,66 @@ def test_list_expanded_data_sets_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_expanded_data_sets( - analytics_admin.ListExpandedDataSetsRequest(), - parent="parent_value", + client.delete_channel_group( + analytics_admin.DeleteChannelGroupRequest(), + name="name_value", ) -def test_list_expanded_data_sets_rest_pager(transport: str = "rest"): +def test_delete_channel_group_rest_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - ], - next_page_token="abc", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[], - next_page_token="def", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - ], - next_page_token="ghi", - ), - analytics_admin.ListExpandedDataSetsResponse( - expanded_data_sets=[ - expanded_data_set.ExpandedDataSet(), - expanded_data_set.ExpandedDataSet(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListExpandedDataSetsResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "properties/sample1"} - - pager = client.list_expanded_data_sets(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, expanded_data_set.ExpandedDataSet) for i in results) - - pages = list(client.list_expanded_data_sets(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.CreateExpandedDataSetRequest, - dict, - ], -) -def test_create_expanded_data_set_rest(request_type): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["expanded_data_set"] = { - "name": "name_value", - "display_name": "display_name_value", - "description": "description_value", - "dimension_names": ["dimension_names_value1", "dimension_names_value2"], - "metric_names": ["metric_names_value1", "metric_names_value2"], - "dimension_filter_expression": { - "and_group": {"filter_expressions": {}}, - "not_expression": {}, - "filter": { - "string_filter": { - "match_type": 1, - "value": "value_value", - "case_sensitive": True, - }, - "in_list_filter": { - "values": ["values_value1", "values_value2"], - "case_sensitive": True, - }, - "field_name": "field_name_value", - }, - }, - "data_collection_start_time": {"seconds": 751, "nanos": 543}, - } +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, + dict, + ], +) +def test_set_automated_ga4_configuration_opt_out_rest(request_type): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = gaa_expanded_data_set.ExpandedDataSet( - name="name_value", - display_name="display_name_value", - description="description_value", - dimension_names=["dimension_names_value"], - metric_names=["metric_names_value"], - ) + return_value = analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse() # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_expanded_data_set.ExpandedDataSet.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_expanded_data_set(request) + response = client.set_automated_ga4_configuration_opt_out(request) # Establish that the response is the type that we expect. - assert isinstance(response, gaa_expanded_data_set.ExpandedDataSet) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.dimension_names == ["dimension_names_value"] - assert response.metric_names == ["metric_names_value"] + assert isinstance( + response, analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse + ) -def test_create_expanded_data_set_rest_required_fields( - request_type=analytics_admin.CreateExpandedDataSetRequest, +def test_set_automated_ga4_configuration_opt_out_rest_required_fields( + request_type=analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["property"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -64352,21 +66376,25 @@ def test_create_expanded_data_set_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_expanded_data_set._get_unset_required_fields(jsonified_request) + ).set_automated_ga4_configuration_opt_out._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["property"] = "property_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_expanded_data_set._get_unset_required_fields(jsonified_request) + ).set_automated_ga4_configuration_opt_out._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "property" in jsonified_request + assert jsonified_request["property"] == "property_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -64375,7 +66403,7 @@ def test_create_expanded_data_set_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = gaa_expanded_data_set.ExpandedDataSet() + return_value = analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -64396,38 +66424,37 @@ def test_create_expanded_data_set_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_expanded_data_set.ExpandedDataSet.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = ( + analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse.pb( + return_value + ) + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_expanded_data_set(request) + response = client.set_automated_ga4_configuration_opt_out(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_expanded_data_set_rest_unset_required_fields(): +def test_set_automated_ga4_configuration_opt_out_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_expanded_data_set._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(()) - & set( - ( - "parent", - "expandedDataSet", - ) - ) + unset_fields = ( + transport.set_automated_ga4_configuration_opt_out._get_unset_required_fields({}) ) + assert set(unset_fields) == (set(()) & set(("property",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_expanded_data_set_rest_interceptors(null_interceptor): +def test_set_automated_ga4_configuration_opt_out_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -64440,14 +66467,16 @@ def test_create_expanded_data_set_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_expanded_data_set" + transports.AnalyticsAdminServiceRestInterceptor, + "post_set_automated_ga4_configuration_opt_out", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_expanded_data_set" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_set_automated_ga4_configuration_opt_out", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateExpandedDataSetRequest.pb( - analytics_admin.CreateExpandedDataSetRequest() + pb_message = analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest.pb( + analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest() ) transcode.return_value = { "method": "post", @@ -64459,19 +66488,21 @@ def test_create_expanded_data_set_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = gaa_expanded_data_set.ExpandedDataSet.to_json( - gaa_expanded_data_set.ExpandedDataSet() + req.return_value._content = ( + analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse.to_json( + analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse() + ) ) - request = analytics_admin.CreateExpandedDataSetRequest() + request = analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = gaa_expanded_data_set.ExpandedDataSet() + post.return_value = analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse() - client.create_expanded_data_set( + client.set_automated_ga4_configuration_opt_out( request, metadata=[ ("key", "val"), @@ -64483,8 +66514,9 @@ def test_create_expanded_data_set_rest_interceptors(null_interceptor): post.assert_called_once() -def test_create_expanded_data_set_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateExpandedDataSetRequest +def test_set_automated_ga4_configuration_opt_out_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -64492,31 +66524,7 @@ def test_create_expanded_data_set_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["expanded_data_set"] = { - "name": "name_value", - "display_name": "display_name_value", - "description": "description_value", - "dimension_names": ["dimension_names_value1", "dimension_names_value2"], - "metric_names": ["metric_names_value1", "metric_names_value2"], - "dimension_filter_expression": { - "and_group": {"filter_expressions": {}}, - "not_expression": {}, - "filter": { - "string_filter": { - "match_type": 1, - "value": "value_value", - "case_sensitive": True, - }, - "in_list_filter": { - "values": ["values_value1", "values_value2"], - "case_sensitive": True, - }, - "field_name": "field_name_value", - }, - }, - "data_collection_start_time": {"seconds": 751, "nanos": 543}, - } + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -64528,68 +66536,10 @@ def test_create_expanded_data_set_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_expanded_data_set(request) - - -def test_create_expanded_data_set_rest_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = gaa_expanded_data_set.ExpandedDataSet() - - # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} - - # get truthy value for each flattened field - mock_args = dict( - parent="parent_value", - expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = gaa_expanded_data_set.ExpandedDataSet.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.create_expanded_data_set(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/expandedDataSets" - % client.transport._host, - args[1], - ) - - -def test_create_expanded_data_set_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.create_expanded_data_set( - analytics_admin.CreateExpandedDataSetRequest(), - parent="parent_value", - expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), - ) + client.set_automated_ga4_configuration_opt_out(request) -def test_create_expanded_data_set_rest_error(): +def test_set_automated_ga4_configuration_opt_out_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -64598,82 +66548,54 @@ def test_create_expanded_data_set_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateExpandedDataSetRequest, + analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, dict, ], ) -def test_update_expanded_data_set_rest(request_type): +def test_fetch_automated_ga4_configuration_opt_out_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "expanded_data_set": {"name": "properties/sample1/expandedDataSets/sample2"} - } - request_init["expanded_data_set"] = { - "name": "properties/sample1/expandedDataSets/sample2", - "display_name": "display_name_value", - "description": "description_value", - "dimension_names": ["dimension_names_value1", "dimension_names_value2"], - "metric_names": ["metric_names_value1", "metric_names_value2"], - "dimension_filter_expression": { - "and_group": {"filter_expressions": {}}, - "not_expression": {}, - "filter": { - "string_filter": { - "match_type": 1, - "value": "value_value", - "case_sensitive": True, - }, - "in_list_filter": { - "values": ["values_value1", "values_value2"], - "case_sensitive": True, - }, - "field_name": "field_name_value", - }, - }, - "data_collection_start_time": {"seconds": 751, "nanos": 543}, - } + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = gaa_expanded_data_set.ExpandedDataSet( - name="name_value", - display_name="display_name_value", - description="description_value", - dimension_names=["dimension_names_value"], - metric_names=["metric_names_value"], + return_value = analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse( + opt_out=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_expanded_data_set.ExpandedDataSet.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_expanded_data_set(request) + response = client.fetch_automated_ga4_configuration_opt_out(request) # Establish that the response is the type that we expect. - assert isinstance(response, gaa_expanded_data_set.ExpandedDataSet) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.dimension_names == ["dimension_names_value"] - assert response.metric_names == ["metric_names_value"] + assert isinstance( + response, analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse + ) + assert response.opt_out is True -def test_update_expanded_data_set_rest_required_fields( - request_type=analytics_admin.UpdateExpandedDataSetRequest, +def test_fetch_automated_ga4_configuration_opt_out_rest_required_fields( + request_type=analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["property"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -64688,19 +66610,25 @@ def test_update_expanded_data_set_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_expanded_data_set._get_unset_required_fields(jsonified_request) + ).fetch_automated_ga4_configuration_opt_out._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["property"] = "property_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_expanded_data_set._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + ).fetch_automated_ga4_configuration_opt_out._get_unset_required_fields( + jsonified_request + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "property" in jsonified_request + assert jsonified_request["property"] == "property_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -64709,7 +66637,7 @@ def test_update_expanded_data_set_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = gaa_expanded_data_set.ExpandedDataSet() + return_value = analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -64721,7 +66649,7 @@ def test_update_expanded_data_set_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "post", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -64730,38 +66658,39 @@ def test_update_expanded_data_set_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_expanded_data_set.ExpandedDataSet.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = ( + analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse.pb( + return_value + ) + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_expanded_data_set(request) + response = client.fetch_automated_ga4_configuration_opt_out(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_expanded_data_set_rest_unset_required_fields(): +def test_fetch_automated_ga4_configuration_opt_out_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_expanded_data_set._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(("updateMask",)) - & set( - ( - "expandedDataSet", - "updateMask", - ) + unset_fields = ( + transport.fetch_automated_ga4_configuration_opt_out._get_unset_required_fields( + {} ) ) + assert set(unset_fields) == (set(()) & set(("property",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_expanded_data_set_rest_interceptors(null_interceptor): +def test_fetch_automated_ga4_configuration_opt_out_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -64774,14 +66703,16 @@ def test_update_expanded_data_set_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_expanded_data_set" + transports.AnalyticsAdminServiceRestInterceptor, + "post_fetch_automated_ga4_configuration_opt_out", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_expanded_data_set" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_fetch_automated_ga4_configuration_opt_out", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateExpandedDataSetRequest.pb( - analytics_admin.UpdateExpandedDataSetRequest() + pb_message = analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest.pb( + analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest() ) transcode.return_value = { "method": "post", @@ -64793,19 +66724,23 @@ def test_update_expanded_data_set_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = gaa_expanded_data_set.ExpandedDataSet.to_json( - gaa_expanded_data_set.ExpandedDataSet() + req.return_value._content = ( + analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse.to_json( + analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse() + ) ) - request = analytics_admin.UpdateExpandedDataSetRequest() + request = analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = gaa_expanded_data_set.ExpandedDataSet() + post.return_value = ( + analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse() + ) - client.update_expanded_data_set( + client.fetch_automated_ga4_configuration_opt_out( request, metadata=[ ("key", "val"), @@ -64817,8 +66752,9 @@ def test_update_expanded_data_set_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_expanded_data_set_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateExpandedDataSetRequest +def test_fetch_automated_ga4_configuration_opt_out_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -64826,33 +66762,7 @@ def test_update_expanded_data_set_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "expanded_data_set": {"name": "properties/sample1/expandedDataSets/sample2"} - } - request_init["expanded_data_set"] = { - "name": "properties/sample1/expandedDataSets/sample2", - "display_name": "display_name_value", - "description": "description_value", - "dimension_names": ["dimension_names_value1", "dimension_names_value2"], - "metric_names": ["metric_names_value1", "metric_names_value2"], - "dimension_filter_expression": { - "and_group": {"filter_expressions": {}}, - "not_expression": {}, - "filter": { - "string_filter": { - "match_type": 1, - "value": "value_value", - "case_sensitive": True, - }, - "in_list_filter": { - "values": ["values_value1", "values_value2"], - "case_sensitive": True, - }, - "field_name": "field_name_value", - }, - }, - "data_collection_start_time": {"seconds": 751, "nanos": 543}, - } + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -64864,70 +66774,10 @@ def test_update_expanded_data_set_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_expanded_data_set(request) - - -def test_update_expanded_data_set_rest_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = gaa_expanded_data_set.ExpandedDataSet() - - # get arguments that satisfy an http rule for this method - sample_request = { - "expanded_data_set": {"name": "properties/sample1/expandedDataSets/sample2"} - } - - # get truthy value for each flattened field - mock_args = dict( - expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = gaa_expanded_data_set.ExpandedDataSet.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.update_expanded_data_set(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{expanded_data_set.name=properties/*/expandedDataSets/*}" - % client.transport._host, - args[1], - ) - - -def test_update_expanded_data_set_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_expanded_data_set( - analytics_admin.UpdateExpandedDataSetRequest(), - expanded_data_set=gaa_expanded_data_set.ExpandedDataSet(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) + client.fetch_automated_ga4_configuration_opt_out(request) -def test_update_expanded_data_set_rest_error(): +def test_fetch_automated_ga4_configuration_opt_out_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -64936,40 +66786,59 @@ def test_update_expanded_data_set_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteExpandedDataSetRequest, + analytics_admin.GetBigQueryLinkRequest, dict, ], ) -def test_delete_expanded_data_set_rest(request_type): +def test_get_big_query_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/expandedDataSets/sample2"} + request_init = {"name": "properties/sample1/bigQueryLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.BigQueryLink( + name="name_value", + project="project_value", + daily_export_enabled=True, + streaming_export_enabled=True, + fresh_daily_export_enabled=True, + include_advertising_id=True, + export_streams=["export_streams_value"], + excluded_events=["excluded_events_value"], + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.BigQueryLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_expanded_data_set(request) + response = client.get_big_query_link(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.BigQueryLink) + assert response.name == "name_value" + assert response.project == "project_value" + assert response.daily_export_enabled is True + assert response.streaming_export_enabled is True + assert response.fresh_daily_export_enabled is True + assert response.include_advertising_id is True + assert response.export_streams == ["export_streams_value"] + assert response.excluded_events == ["excluded_events_value"] -def test_delete_expanded_data_set_rest_required_fields( - request_type=analytics_admin.DeleteExpandedDataSetRequest, +def test_get_big_query_link_rest_required_fields( + request_type=analytics_admin.GetBigQueryLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -64989,7 +66858,7 @@ def test_delete_expanded_data_set_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_expanded_data_set._get_unset_required_fields(jsonified_request) + ).get_big_query_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -64998,7 +66867,7 @@ def test_delete_expanded_data_set_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_expanded_data_set._get_unset_required_fields(jsonified_request) + ).get_big_query_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -65012,7 +66881,7 @@ def test_delete_expanded_data_set_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.BigQueryLink() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -65024,36 +66893,39 @@ def test_delete_expanded_data_set_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "get", "query_params": pb_request, } transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = resources.BigQueryLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_expanded_data_set(request) + response = client.get_big_query_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_expanded_data_set_rest_unset_required_fields(): +def test_get_big_query_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_expanded_data_set._get_unset_required_fields({}) + unset_fields = transport.get_big_query_link._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_expanded_data_set_rest_interceptors(null_interceptor): +def test_get_big_query_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -65066,11 +66938,14 @@ def test_delete_expanded_data_set_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_expanded_data_set" + transports.AnalyticsAdminServiceRestInterceptor, "post_get_big_query_link" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_big_query_link" ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteExpandedDataSetRequest.pb( - analytics_admin.DeleteExpandedDataSetRequest() + post.assert_not_called() + pb_message = analytics_admin.GetBigQueryLinkRequest.pb( + analytics_admin.GetBigQueryLinkRequest() ) transcode.return_value = { "method": "post", @@ -65082,15 +66957,19 @@ def test_delete_expanded_data_set_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = resources.BigQueryLink.to_json( + resources.BigQueryLink() + ) - request = analytics_admin.DeleteExpandedDataSetRequest() + request = analytics_admin.GetBigQueryLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = resources.BigQueryLink() - client.delete_expanded_data_set( + client.get_big_query_link( request, metadata=[ ("key", "val"), @@ -65099,10 +66978,11 @@ def test_delete_expanded_data_set_rest_interceptors(null_interceptor): ) pre.assert_called_once() + post.assert_called_once() -def test_delete_expanded_data_set_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteExpandedDataSetRequest +def test_get_big_query_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetBigQueryLinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -65110,7 +66990,7 @@ def test_delete_expanded_data_set_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/expandedDataSets/sample2"} + request_init = {"name": "properties/sample1/bigQueryLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -65122,10 +67002,10 @@ def test_delete_expanded_data_set_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_expanded_data_set(request) + client.get_big_query_link(request) -def test_delete_expanded_data_set_rest_flattened(): +def test_get_big_query_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -65134,10 +67014,10 @@ def test_delete_expanded_data_set_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.BigQueryLink() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/expandedDataSets/sample2"} + sample_request = {"name": "properties/sample1/bigQueryLinks/sample2"} # get truthy value for each flattened field mock_args = dict( @@ -65148,24 +67028,25 @@ def test_delete_expanded_data_set_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.BigQueryLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.delete_expanded_data_set(**mock_args) + client.get_big_query_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/expandedDataSets/*}" - % client.transport._host, + "%s/v1alpha/{name=properties/*/bigQueryLinks/*}" % client.transport._host, args[1], ) -def test_delete_expanded_data_set_rest_flattened_error(transport: str = "rest"): +def test_get_big_query_link_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -65174,13 +67055,13 @@ def test_delete_expanded_data_set_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_expanded_data_set( - analytics_admin.DeleteExpandedDataSetRequest(), + client.get_big_query_link( + analytics_admin.GetBigQueryLinkRequest(), name="name_value", ) -def test_delete_expanded_data_set_rest_error(): +def test_get_big_query_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -65189,55 +67070,50 @@ def test_delete_expanded_data_set_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetChannelGroupRequest, + analytics_admin.ListBigQueryLinksRequest, dict, ], ) -def test_get_channel_group_rest(request_type): +def test_list_big_query_links_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/channelGroups/sample2"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = channel_group.ChannelGroup( - name="name_value", - display_name="display_name_value", - description="description_value", - system_defined=True, + return_value = analytics_admin.ListBigQueryLinksResponse( + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = channel_group.ChannelGroup.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListBigQueryLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_channel_group(request) + response = client.list_big_query_links(request) # Establish that the response is the type that we expect. - assert isinstance(response, channel_group.ChannelGroup) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.system_defined is True + assert isinstance(response, pagers.ListBigQueryLinksPager) + assert response.next_page_token == "next_page_token_value" -def test_get_channel_group_rest_required_fields( - request_type=analytics_admin.GetChannelGroupRequest, +def test_list_big_query_links_rest_required_fields( + request_type=analytics_admin.ListBigQueryLinksRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -65252,21 +67128,28 @@ def test_get_channel_group_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_channel_group._get_unset_required_fields(jsonified_request) + ).list_big_query_links._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["name"] = "name_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_channel_group._get_unset_required_fields(jsonified_request) + ).list_big_query_links._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -65275,7 +67158,7 @@ def test_get_channel_group_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = channel_group.ChannelGroup() + return_value = analytics_admin.ListBigQueryLinksResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -65295,30 +67178,39 @@ def test_get_channel_group_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = channel_group.ChannelGroup.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListBigQueryLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_channel_group(request) + response = client.list_big_query_links(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_channel_group_rest_unset_required_fields(): +def test_list_big_query_links_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_channel_group._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.list_big_query_links._get_unset_required_fields({}) + assert set(unset_fields) == ( + set( + ( + "pageSize", + "pageToken", + ) + ) + & set(("parent",)) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_channel_group_rest_interceptors(null_interceptor): +def test_list_big_query_links_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -65331,14 +67223,14 @@ def test_get_channel_group_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_channel_group" + transports.AnalyticsAdminServiceRestInterceptor, "post_list_big_query_links" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_channel_group" + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_big_query_links" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetChannelGroupRequest.pb( - analytics_admin.GetChannelGroupRequest() + pb_message = analytics_admin.ListBigQueryLinksRequest.pb( + analytics_admin.ListBigQueryLinksRequest() ) transcode.return_value = { "method": "post", @@ -65350,19 +67242,19 @@ def test_get_channel_group_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = channel_group.ChannelGroup.to_json( - channel_group.ChannelGroup() + req.return_value._content = analytics_admin.ListBigQueryLinksResponse.to_json( + analytics_admin.ListBigQueryLinksResponse() ) - request = analytics_admin.GetChannelGroupRequest() + request = analytics_admin.ListBigQueryLinksRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = channel_group.ChannelGroup() + post.return_value = analytics_admin.ListBigQueryLinksResponse() - client.get_channel_group( + client.list_big_query_links( request, metadata=[ ("key", "val"), @@ -65374,8 +67266,8 @@ def test_get_channel_group_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_channel_group_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetChannelGroupRequest +def test_list_big_query_links_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListBigQueryLinksRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -65383,7 +67275,7 @@ def test_get_channel_group_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/channelGroups/sample2"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -65395,10 +67287,10 @@ def test_get_channel_group_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_channel_group(request) + client.list_big_query_links(request) -def test_get_channel_group_rest_flattened(): +def test_list_big_query_links_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -65407,38 +67299,39 @@ def test_get_channel_group_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = channel_group.ChannelGroup() + return_value = analytics_admin.ListBigQueryLinksResponse() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/channelGroups/sample2"} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( - name="name_value", + parent="parent_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = channel_group.ChannelGroup.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListBigQueryLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_channel_group(**mock_args) + client.list_big_query_links(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/channelGroups/*}" % client.transport._host, + "%s/v1alpha/{parent=properties/*}/bigQueryLinks" % client.transport._host, args[1], ) -def test_get_channel_group_rest_flattened_error(transport: str = "rest"): +def test_list_big_query_links_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -65447,64 +67340,144 @@ def test_get_channel_group_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_channel_group( - analytics_admin.GetChannelGroupRequest(), - name="name_value", + client.list_big_query_links( + analytics_admin.ListBigQueryLinksRequest(), + parent="parent_value", ) -def test_get_channel_group_rest_error(): +def test_list_big_query_links_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, ) + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), + resources.BigQueryLink(), + resources.BigQueryLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[], + next_page_token="def", + ), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListBigQueryLinksResponse( + bigquery_links=[ + resources.BigQueryLink(), + resources.BigQueryLink(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListBigQueryLinksResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "properties/sample1"} + + pager = client.list_big_query_links(request=sample_request) + + results = list(pager) + assert len(results) == 6 + assert all(isinstance(i, resources.BigQueryLink) for i in results) + + pages = list(client.list_big_query_links(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListChannelGroupsRequest, + analytics_admin.GetEnhancedMeasurementSettingsRequest, dict, ], ) -def test_list_channel_groups_rest(request_type): +def test_get_enhanced_measurement_settings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = { + "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings" + } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListChannelGroupsResponse( - next_page_token="next_page_token_value", + return_value = resources.EnhancedMeasurementSettings( + name="name_value", + stream_enabled=True, + scrolls_enabled=True, + outbound_clicks_enabled=True, + site_search_enabled=True, + video_engagement_enabled=True, + file_downloads_enabled=True, + page_changes_enabled=True, + form_interactions_enabled=True, + search_query_parameter="search_query_parameter_value", + uri_query_parameter="uri_query_parameter_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListChannelGroupsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.EnhancedMeasurementSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_channel_groups(request) + response = client.get_enhanced_measurement_settings(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListChannelGroupsPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.EnhancedMeasurementSettings) + assert response.name == "name_value" + assert response.stream_enabled is True + assert response.scrolls_enabled is True + assert response.outbound_clicks_enabled is True + assert response.site_search_enabled is True + assert response.video_engagement_enabled is True + assert response.file_downloads_enabled is True + assert response.page_changes_enabled is True + assert response.form_interactions_enabled is True + assert response.search_query_parameter == "search_query_parameter_value" + assert response.uri_query_parameter == "uri_query_parameter_value" -def test_list_channel_groups_rest_required_fields( - request_type=analytics_admin.ListChannelGroupsRequest, +def test_get_enhanced_measurement_settings_rest_required_fields( + request_type=analytics_admin.GetEnhancedMeasurementSettingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -65519,28 +67492,21 @@ def test_list_channel_groups_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_channel_groups._get_unset_required_fields(jsonified_request) + ).get_enhanced_measurement_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_channel_groups._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) - ) + ).get_enhanced_measurement_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -65549,7 +67515,7 @@ def test_list_channel_groups_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListChannelGroupsResponse() + return_value = resources.EnhancedMeasurementSettings() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -65569,38 +67535,33 @@ def test_list_channel_groups_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListChannelGroupsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.EnhancedMeasurementSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_channel_groups(request) + response = client.get_enhanced_measurement_settings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_channel_groups_rest_unset_required_fields(): +def test_get_enhanced_measurement_settings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_channel_groups._get_unset_required_fields({}) - assert set(unset_fields) == ( - set( - ( - "pageSize", - "pageToken", - ) - ) - & set(("parent",)) + unset_fields = ( + transport.get_enhanced_measurement_settings._get_unset_required_fields({}) ) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_channel_groups_rest_interceptors(null_interceptor): +def test_get_enhanced_measurement_settings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -65613,14 +67574,16 @@ def test_list_channel_groups_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_channel_groups" + transports.AnalyticsAdminServiceRestInterceptor, + "post_get_enhanced_measurement_settings", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_channel_groups" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_get_enhanced_measurement_settings", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListChannelGroupsRequest.pb( - analytics_admin.ListChannelGroupsRequest() + pb_message = analytics_admin.GetEnhancedMeasurementSettingsRequest.pb( + analytics_admin.GetEnhancedMeasurementSettingsRequest() ) transcode.return_value = { "method": "post", @@ -65632,19 +67595,19 @@ def test_list_channel_groups_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ListChannelGroupsResponse.to_json( - analytics_admin.ListChannelGroupsResponse() + req.return_value._content = resources.EnhancedMeasurementSettings.to_json( + resources.EnhancedMeasurementSettings() ) - request = analytics_admin.ListChannelGroupsRequest() + request = analytics_admin.GetEnhancedMeasurementSettingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListChannelGroupsResponse() + post.return_value = resources.EnhancedMeasurementSettings() - client.list_channel_groups( + client.get_enhanced_measurement_settings( request, metadata=[ ("key", "val"), @@ -65656,8 +67619,9 @@ def test_list_channel_groups_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_channel_groups_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListChannelGroupsRequest +def test_get_enhanced_measurement_settings_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.GetEnhancedMeasurementSettingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -65665,7 +67629,9 @@ def test_list_channel_groups_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = { + "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings" + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -65677,10 +67643,10 @@ def test_list_channel_groups_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_channel_groups(request) + client.get_enhanced_measurement_settings(request) -def test_list_channel_groups_rest_flattened(): +def test_get_enhanced_measurement_settings_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -65689,38 +67655,44 @@ def test_list_channel_groups_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListChannelGroupsResponse() + return_value = resources.EnhancedMeasurementSettings() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = { + "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings" + } # get truthy value for each flattened field mock_args = dict( - parent="parent_value", + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListChannelGroupsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.EnhancedMeasurementSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_channel_groups(**mock_args) + client.get_enhanced_measurement_settings(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/channelGroups" % client.transport._host, + "%s/v1alpha/{name=properties/*/dataStreams/*/enhancedMeasurementSettings}" + % client.transport._host, args[1], ) -def test_list_channel_groups_rest_flattened_error(transport: str = "rest"): +def test_get_enhanced_measurement_settings_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -65729,150 +67701,176 @@ def test_list_channel_groups_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_channel_groups( - analytics_admin.ListChannelGroupsRequest(), - parent="parent_value", + client.get_enhanced_measurement_settings( + analytics_admin.GetEnhancedMeasurementSettingsRequest(), + name="name_value", ) -def test_list_channel_groups_rest_pager(transport: str = "rest"): +def test_get_enhanced_measurement_settings_rest_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), - ], - next_page_token="abc", - ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[], - next_page_token="def", - ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), - ], - next_page_token="ghi", - ), - analytics_admin.ListChannelGroupsResponse( - channel_groups=[ - channel_group.ChannelGroup(), - channel_group.ChannelGroup(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListChannelGroupsResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "properties/sample1"} - - pager = client.list_channel_groups(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, channel_group.ChannelGroup) for i in results) - - pages = list(client.list_channel_groups(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateChannelGroupRequest, + analytics_admin.UpdateEnhancedMeasurementSettingsRequest, dict, ], ) -def test_create_channel_group_rest(request_type): +def test_update_enhanced_measurement_settings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["channel_group"] = { - "name": "name_value", - "display_name": "display_name_value", - "description": "description_value", - "grouping_rule": [ - { - "display_name": "display_name_value", - "expression": { - "and_group": {"filter_expressions": {}}, - "or_group": {}, - "not_expression": {}, - "filter": { - "string_filter": {"match_type": 1, "value": "value_value"}, - "in_list_filter": { - "values": ["values_value1", "values_value2"] - }, - "field_name": "field_name_value", - }, - }, - } - ], - "system_defined": True, + request_init = { + "enhanced_measurement_settings": { + "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings" + } + } + request_init["enhanced_measurement_settings"] = { + "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings", + "stream_enabled": True, + "scrolls_enabled": True, + "outbound_clicks_enabled": True, + "site_search_enabled": True, + "video_engagement_enabled": True, + "file_downloads_enabled": True, + "page_changes_enabled": True, + "form_interactions_enabled": True, + "search_query_parameter": "search_query_parameter_value", + "uri_query_parameter": "uri_query_parameter_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateEnhancedMeasurementSettingsRequest.meta.fields[ + "enhanced_measurement_settings" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "enhanced_measurement_settings" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range( + 0, len(request_init["enhanced_measurement_settings"][field]) + ): + del request_init["enhanced_measurement_settings"][field][i][ + subfield + ] + else: + del request_init["enhanced_measurement_settings"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = gaa_channel_group.ChannelGroup( + return_value = resources.EnhancedMeasurementSettings( name="name_value", - display_name="display_name_value", - description="description_value", - system_defined=True, + stream_enabled=True, + scrolls_enabled=True, + outbound_clicks_enabled=True, + site_search_enabled=True, + video_engagement_enabled=True, + file_downloads_enabled=True, + page_changes_enabled=True, + form_interactions_enabled=True, + search_query_parameter="search_query_parameter_value", + uri_query_parameter="uri_query_parameter_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_channel_group.ChannelGroup.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.EnhancedMeasurementSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_channel_group(request) + response = client.update_enhanced_measurement_settings(request) # Establish that the response is the type that we expect. - assert isinstance(response, gaa_channel_group.ChannelGroup) + assert isinstance(response, resources.EnhancedMeasurementSettings) assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.system_defined is True + assert response.stream_enabled is True + assert response.scrolls_enabled is True + assert response.outbound_clicks_enabled is True + assert response.site_search_enabled is True + assert response.video_engagement_enabled is True + assert response.file_downloads_enabled is True + assert response.page_changes_enabled is True + assert response.form_interactions_enabled is True + assert response.search_query_parameter == "search_query_parameter_value" + assert response.uri_query_parameter == "uri_query_parameter_value" -def test_create_channel_group_rest_required_fields( - request_type=analytics_admin.CreateChannelGroupRequest, +def test_update_enhanced_measurement_settings_rest_required_fields( + request_type=analytics_admin.UpdateEnhancedMeasurementSettingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -65887,21 +67885,19 @@ def test_create_channel_group_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_channel_group._get_unset_required_fields(jsonified_request) + ).update_enhanced_measurement_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_channel_group._get_unset_required_fields(jsonified_request) + ).update_enhanced_measurement_settings._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -65910,7 +67906,7 @@ def test_create_channel_group_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = gaa_channel_group.ChannelGroup() + return_value = resources.EnhancedMeasurementSettings() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -65922,7 +67918,7 @@ def test_create_channel_group_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "patch", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -65931,38 +67927,41 @@ def test_create_channel_group_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_channel_group.ChannelGroup.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.EnhancedMeasurementSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_channel_group(request) + response = client.update_enhanced_measurement_settings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_channel_group_rest_unset_required_fields(): +def test_update_enhanced_measurement_settings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_channel_group._get_unset_required_fields({}) + unset_fields = ( + transport.update_enhanced_measurement_settings._get_unset_required_fields({}) + ) assert set(unset_fields) == ( - set(()) + set(("updateMask",)) & set( ( - "parent", - "channelGroup", + "enhancedMeasurementSettings", + "updateMask", ) ) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_channel_group_rest_interceptors(null_interceptor): +def test_update_enhanced_measurement_settings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -65975,14 +67974,16 @@ def test_create_channel_group_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_channel_group" + transports.AnalyticsAdminServiceRestInterceptor, + "post_update_enhanced_measurement_settings", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_channel_group" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_update_enhanced_measurement_settings", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateChannelGroupRequest.pb( - analytics_admin.CreateChannelGroupRequest() + pb_message = analytics_admin.UpdateEnhancedMeasurementSettingsRequest.pb( + analytics_admin.UpdateEnhancedMeasurementSettingsRequest() ) transcode.return_value = { "method": "post", @@ -65994,19 +67995,19 @@ def test_create_channel_group_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = gaa_channel_group.ChannelGroup.to_json( - gaa_channel_group.ChannelGroup() + req.return_value._content = resources.EnhancedMeasurementSettings.to_json( + resources.EnhancedMeasurementSettings() ) - request = analytics_admin.CreateChannelGroupRequest() + request = analytics_admin.UpdateEnhancedMeasurementSettingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = gaa_channel_group.ChannelGroup() + post.return_value = resources.EnhancedMeasurementSettings() - client.create_channel_group( + client.update_enhanced_measurement_settings( request, metadata=[ ("key", "val"), @@ -66018,8 +68019,9 @@ def test_create_channel_group_rest_interceptors(null_interceptor): post.assert_called_once() -def test_create_channel_group_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateChannelGroupRequest +def test_update_enhanced_measurement_settings_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.UpdateEnhancedMeasurementSettingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -66027,29 +68029,10 @@ def test_create_channel_group_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["channel_group"] = { - "name": "name_value", - "display_name": "display_name_value", - "description": "description_value", - "grouping_rule": [ - { - "display_name": "display_name_value", - "expression": { - "and_group": {"filter_expressions": {}}, - "or_group": {}, - "not_expression": {}, - "filter": { - "string_filter": {"match_type": 1, "value": "value_value"}, - "in_list_filter": { - "values": ["values_value1", "values_value2"] - }, - "field_name": "field_name_value", - }, - }, - } - ], - "system_defined": True, + request_init = { + "enhanced_measurement_settings": { + "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings" + } } request = request_type(**request_init) @@ -66062,10 +68045,10 @@ def test_create_channel_group_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_channel_group(request) + client.update_enhanced_measurement_settings(request) -def test_create_channel_group_rest_flattened(): +def test_update_enhanced_measurement_settings_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -66074,39 +68057,49 @@ def test_create_channel_group_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = gaa_channel_group.ChannelGroup() + return_value = resources.EnhancedMeasurementSettings() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = { + "enhanced_measurement_settings": { + "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings" + } + } # get truthy value for each flattened field mock_args = dict( - parent="parent_value", - channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + enhanced_measurement_settings=resources.EnhancedMeasurementSettings( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_channel_group.ChannelGroup.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.EnhancedMeasurementSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_channel_group(**mock_args) + client.update_enhanced_measurement_settings(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/channelGroups" % client.transport._host, + "%s/v1alpha/{enhanced_measurement_settings.name=properties/*/dataStreams/*/enhancedMeasurementSettings}" + % client.transport._host, args[1], ) -def test_create_channel_group_rest_flattened_error(transport: str = "rest"): +def test_update_enhanced_measurement_settings_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -66115,14 +68108,16 @@ def test_create_channel_group_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_channel_group( - analytics_admin.CreateChannelGroupRequest(), - parent="parent_value", - channel_group=gaa_channel_group.ChannelGroup(name="name_value"), + client.update_enhanced_measurement_settings( + analytics_admin.UpdateEnhancedMeasurementSettingsRequest(), + enhanced_measurement_settings=resources.EnhancedMeasurementSettings( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_create_channel_group_rest_error(): +def test_update_enhanced_measurement_settings_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -66131,75 +68126,42 @@ def test_create_channel_group_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateChannelGroupRequest, + analytics_admin.CreateConnectedSiteTagRequest, dict, ], ) -def test_update_channel_group_rest(request_type): +def test_create_connected_site_tag_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "channel_group": {"name": "properties/sample1/channelGroups/sample2"} - } - request_init["channel_group"] = { - "name": "properties/sample1/channelGroups/sample2", - "display_name": "display_name_value", - "description": "description_value", - "grouping_rule": [ - { - "display_name": "display_name_value", - "expression": { - "and_group": {"filter_expressions": {}}, - "or_group": {}, - "not_expression": {}, - "filter": { - "string_filter": {"match_type": 1, "value": "value_value"}, - "in_list_filter": { - "values": ["values_value1", "values_value2"] - }, - "field_name": "field_name_value", - }, - }, - } - ], - "system_defined": True, - } + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = gaa_channel_group.ChannelGroup( - name="name_value", - display_name="display_name_value", - description="description_value", - system_defined=True, - ) + return_value = analytics_admin.CreateConnectedSiteTagResponse() # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_channel_group.ChannelGroup.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.CreateConnectedSiteTagResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_channel_group(request) + response = client.create_connected_site_tag(request) # Establish that the response is the type that we expect. - assert isinstance(response, gaa_channel_group.ChannelGroup) - assert response.name == "name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.system_defined is True + assert isinstance(response, analytics_admin.CreateConnectedSiteTagResponse) -def test_update_channel_group_rest_required_fields( - request_type=analytics_admin.UpdateChannelGroupRequest, +def test_create_connected_site_tag_rest_required_fields( + request_type=analytics_admin.CreateConnectedSiteTagRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -66218,16 +68180,14 @@ def test_update_channel_group_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_channel_group._get_unset_required_fields(jsonified_request) + ).create_connected_site_tag._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_channel_group._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + ).create_connected_site_tag._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -66239,7 +68199,7 @@ def test_update_channel_group_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = gaa_channel_group.ChannelGroup() + return_value = analytics_admin.CreateConnectedSiteTagResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -66251,7 +68211,7 @@ def test_update_channel_group_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "post", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -66260,38 +68220,33 @@ def test_update_channel_group_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_channel_group.ChannelGroup.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.CreateConnectedSiteTagResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_channel_group(request) + response = client.create_connected_site_tag(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_channel_group_rest_unset_required_fields(): +def test_create_connected_site_tag_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_channel_group._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(("updateMask",)) - & set( - ( - "channelGroup", - "updateMask", - ) - ) - ) + unset_fields = transport.create_connected_site_tag._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("connectedSiteTag",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_channel_group_rest_interceptors(null_interceptor): +def test_create_connected_site_tag_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -66304,14 +68259,15 @@ def test_update_channel_group_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_channel_group" + transports.AnalyticsAdminServiceRestInterceptor, + "post_create_connected_site_tag", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_channel_group" + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_connected_site_tag" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateChannelGroupRequest.pb( - analytics_admin.UpdateChannelGroupRequest() + pb_message = analytics_admin.CreateConnectedSiteTagRequest.pb( + analytics_admin.CreateConnectedSiteTagRequest() ) transcode.return_value = { "method": "post", @@ -66323,19 +68279,21 @@ def test_update_channel_group_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = gaa_channel_group.ChannelGroup.to_json( - gaa_channel_group.ChannelGroup() + req.return_value._content = ( + analytics_admin.CreateConnectedSiteTagResponse.to_json( + analytics_admin.CreateConnectedSiteTagResponse() + ) ) - request = analytics_admin.UpdateChannelGroupRequest() + request = analytics_admin.CreateConnectedSiteTagRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = gaa_channel_group.ChannelGroup() + post.return_value = analytics_admin.CreateConnectedSiteTagResponse() - client.update_channel_group( + client.create_connected_site_tag( request, metadata=[ ("key", "val"), @@ -66347,8 +68305,8 @@ def test_update_channel_group_rest_interceptors(null_interceptor): post.assert_called_once() -def test_update_channel_group_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateChannelGroupRequest +def test_create_connected_site_tag_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateConnectedSiteTagRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -66356,32 +68314,7 @@ def test_update_channel_group_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "channel_group": {"name": "properties/sample1/channelGroups/sample2"} - } - request_init["channel_group"] = { - "name": "properties/sample1/channelGroups/sample2", - "display_name": "display_name_value", - "description": "description_value", - "grouping_rule": [ - { - "display_name": "display_name_value", - "expression": { - "and_group": {"filter_expressions": {}}, - "or_group": {}, - "not_expression": {}, - "filter": { - "string_filter": {"match_type": 1, "value": "value_value"}, - "in_list_filter": { - "values": ["values_value1", "values_value2"] - }, - "field_name": "field_name_value", - }, - }, - } - ], - "system_defined": True, - } + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -66393,70 +68326,250 @@ def test_update_channel_group_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_channel_group(request) + client.create_connected_site_tag(request) -def test_update_channel_group_rest_flattened(): +def test_create_connected_site_tag_rest_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteConnectedSiteTagRequest, + dict, + ], +) +def test_delete_connected_site_tag_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) + # send a request that will satisfy transcoding + request_init = {} + request = request_type(**request_init) + # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = gaa_channel_group.ChannelGroup() + return_value = None - # get arguments that satisfy an http rule for this method - sample_request = { - "channel_group": {"name": "properties/sample1/channelGroups/sample2"} + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + json_return_value = "" + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.delete_connected_site_tag(request) + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_delete_connected_site_tag_rest_interceptors(null_interceptor): + transport = transports.AnalyticsAdminServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.AnalyticsAdminServiceRestInterceptor(), + ) + client = AnalyticsAdminServiceClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_connected_site_tag" + ) as pre: + pre.assert_not_called() + pb_message = analytics_admin.DeleteConnectedSiteTagRequest.pb( + analytics_admin.DeleteConnectedSiteTagRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, } - # get truthy value for each flattened field - mock_args = dict( - channel_group=gaa_channel_group.ChannelGroup(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + + request = analytics_admin.DeleteConnectedSiteTagRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + + client.delete_connected_site_tag( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], ) - mock_args.update(sample_request) + + pre.assert_called_once() + + +def test_delete_connected_site_tag_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeleteConnectedSiteTagRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.delete_connected_site_tag(request) + + +def test_delete_connected_site_tag_rest_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.ListConnectedSiteTagsRequest, + dict, + ], +) +def test_list_connected_site_tags_rest(request_type): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = analytics_admin.ListConnectedSiteTagsResponse() # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = gaa_channel_group.ChannelGroup.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListConnectedSiteTagsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value + response = client.list_connected_site_tags(request) - client.update_channel_group(**mock_args) + # Establish that the response is the type that we expect. + assert isinstance(response, analytics_admin.ListConnectedSiteTagsResponse) - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{channel_group.name=properties/*/channelGroups/*}" - % client.transport._host, - args[1], + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_list_connected_site_tags_rest_interceptors(null_interceptor): + transport = transports.AnalyticsAdminServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.AnalyticsAdminServiceRestInterceptor(), + ) + client = AnalyticsAdminServiceClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "post_list_connected_site_tags" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_connected_site_tags" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = analytics_admin.ListConnectedSiteTagsRequest.pb( + analytics_admin.ListConnectedSiteTagsRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = ( + analytics_admin.ListConnectedSiteTagsResponse.to_json( + analytics_admin.ListConnectedSiteTagsResponse() + ) ) + request = analytics_admin.ListConnectedSiteTagsRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = analytics_admin.ListConnectedSiteTagsResponse() -def test_update_channel_group_rest_flattened_error(transport: str = "rest"): + client.list_connected_site_tags( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_list_connected_site_tags_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListConnectedSiteTagsRequest +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_channel_group( - analytics_admin.UpdateChannelGroupRequest(), - channel_group=gaa_channel_group.ChannelGroup(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) + # send a request that will satisfy transcoding + request_init = {} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.list_connected_site_tags(request) -def test_update_channel_group_rest_error(): +def test_list_connected_site_tags_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -66465,45 +68578,52 @@ def test_update_channel_group_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteChannelGroupRequest, + analytics_admin.FetchConnectedGa4PropertyRequest, dict, ], ) -def test_delete_channel_group_rest(request_type): +def test_fetch_connected_ga4_property_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/channelGroups/sample2"} + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = analytics_admin.FetchConnectedGa4PropertyResponse( + property="property_value", + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = analytics_admin.FetchConnectedGa4PropertyResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_channel_group(request) + response = client.fetch_connected_ga4_property(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, analytics_admin.FetchConnectedGa4PropertyResponse) + assert response.property == "property_value" -def test_delete_channel_group_rest_required_fields( - request_type=analytics_admin.DeleteChannelGroupRequest, +def test_fetch_connected_ga4_property_rest_required_fields( + request_type=analytics_admin.FetchConnectedGa4PropertyRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["name"] = "" + request_init["property"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -66515,24 +68635,29 @@ def test_delete_channel_group_rest_required_fields( ) # verify fields with default values are dropped + assert "property" not in jsonified_request unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_channel_group._get_unset_required_fields(jsonified_request) + ).fetch_connected_ga4_property._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + assert "property" in jsonified_request + assert jsonified_request["property"] == request_init["property"] - jsonified_request["name"] = "name_value" + jsonified_request["property"] = "property_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_channel_group._get_unset_required_fields(jsonified_request) + ).fetch_connected_ga4_property._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("property",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "name" in jsonified_request - assert jsonified_request["name"] == "name_value" + assert "property" in jsonified_request + assert jsonified_request["property"] == "property_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -66541,7 +68666,7 @@ def test_delete_channel_group_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = analytics_admin.FetchConnectedGa4PropertyResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -66553,36 +68678,47 @@ def test_delete_channel_group_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "get", "query_params": pb_request, } transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = analytics_admin.FetchConnectedGa4PropertyResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_channel_group(request) + response = client.fetch_connected_ga4_property(request) - expected_params = [("$alt", "json;enum-encoding=int")] + expected_params = [ + ( + "property", + "", + ), + ("$alt", "json;enum-encoding=int"), + ] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_channel_group_rest_unset_required_fields(): +def test_fetch_connected_ga4_property_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_channel_group._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("name",))) + unset_fields = transport.fetch_connected_ga4_property._get_unset_required_fields({}) + assert set(unset_fields) == (set(("property",)) & set(("property",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_channel_group_rest_interceptors(null_interceptor): +def test_fetch_connected_ga4_property_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -66595,11 +68731,16 @@ def test_delete_channel_group_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_channel_group" + transports.AnalyticsAdminServiceRestInterceptor, + "post_fetch_connected_ga4_property", + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, + "pre_fetch_connected_ga4_property", ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteChannelGroupRequest.pb( - analytics_admin.DeleteChannelGroupRequest() + post.assert_not_called() + pb_message = analytics_admin.FetchConnectedGa4PropertyRequest.pb( + analytics_admin.FetchConnectedGa4PropertyRequest() ) transcode.return_value = { "method": "post", @@ -66611,15 +68752,21 @@ def test_delete_channel_group_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = ( + analytics_admin.FetchConnectedGa4PropertyResponse.to_json( + analytics_admin.FetchConnectedGa4PropertyResponse() + ) + ) - request = analytics_admin.DeleteChannelGroupRequest() + request = analytics_admin.FetchConnectedGa4PropertyRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = analytics_admin.FetchConnectedGa4PropertyResponse() - client.delete_channel_group( + client.fetch_connected_ga4_property( request, metadata=[ ("key", "val"), @@ -66628,10 +68775,12 @@ def test_delete_channel_group_rest_interceptors(null_interceptor): ) pre.assert_called_once() + post.assert_called_once() -def test_delete_channel_group_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteChannelGroupRequest +def test_fetch_connected_ga4_property_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.FetchConnectedGa4PropertyRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -66639,7 +68788,7 @@ def test_delete_channel_group_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/channelGroups/sample2"} + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -66651,64 +68800,10 @@ def test_delete_channel_group_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_channel_group(request) - - -def test_delete_channel_group_rest_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = None - - # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/channelGroups/sample2"} - - # get truthy value for each flattened field - mock_args = dict( - name="name_value", - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - json_return_value = "" - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.delete_channel_group(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{name=properties/*/channelGroups/*}" % client.transport._host, - args[1], - ) - - -def test_delete_channel_group_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.delete_channel_group( - analytics_admin.DeleteChannelGroupRequest(), - name="name_value", - ) + client.fetch_connected_ga4_property(request) -def test_delete_channel_group_rest_error(): +def test_fetch_connected_ga4_property_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -66717,50 +68812,52 @@ def test_delete_channel_group_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, + analytics_admin.GetAdSenseLinkRequest, dict, ], ) -def test_set_automated_ga4_configuration_opt_out_rest(request_type): +def test_get_ad_sense_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {} + request_init = {"name": "properties/sample1/adSenseLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse() + return_value = resources.AdSenseLink( + name="name_value", + ad_client_code="ad_client_code_value", + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AdSenseLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.set_automated_ga4_configuration_opt_out(request) + response = client.get_ad_sense_link(request) # Establish that the response is the type that we expect. - assert isinstance( - response, analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse - ) + assert isinstance(response, resources.AdSenseLink) + assert response.name == "name_value" + assert response.ad_client_code == "ad_client_code_value" -def test_set_automated_ga4_configuration_opt_out_rest_required_fields( - request_type=analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, +def test_get_ad_sense_link_rest_required_fields( + request_type=analytics_admin.GetAdSenseLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["property"] = "" + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -66775,25 +68872,21 @@ def test_set_automated_ga4_configuration_opt_out_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).set_automated_ga4_configuration_opt_out._get_unset_required_fields( - jsonified_request - ) + ).get_ad_sense_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["property"] = "property_value" + jsonified_request["name"] = "name_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).set_automated_ga4_configuration_opt_out._get_unset_required_fields( - jsonified_request - ) + ).get_ad_sense_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "property" in jsonified_request - assert jsonified_request["property"] == "property_value" + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -66802,7 +68895,7 @@ def test_set_automated_ga4_configuration_opt_out_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse() + return_value = resources.AdSenseLink() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -66814,45 +68907,39 @@ def test_set_automated_ga4_configuration_opt_out_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = ( - analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse.pb( - return_value - ) - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AdSenseLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.set_automated_ga4_configuration_opt_out(request) + response = client.get_ad_sense_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_set_automated_ga4_configuration_opt_out_rest_unset_required_fields(): +def test_get_ad_sense_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.set_automated_ga4_configuration_opt_out._get_unset_required_fields({}) - ) - assert set(unset_fields) == (set(()) & set(("property",))) + unset_fields = transport.get_ad_sense_link._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_set_automated_ga4_configuration_opt_out_rest_interceptors(null_interceptor): +def test_get_ad_sense_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -66865,16 +68952,14 @@ def test_set_automated_ga4_configuration_opt_out_rest_interceptors(null_intercep ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_set_automated_ga4_configuration_opt_out", + transports.AnalyticsAdminServiceRestInterceptor, "post_get_ad_sense_link" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_set_automated_ga4_configuration_opt_out", + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_ad_sense_link" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest.pb( - analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest() + pb_message = analytics_admin.GetAdSenseLinkRequest.pb( + analytics_admin.GetAdSenseLinkRequest() ) transcode.return_value = { "method": "post", @@ -66886,21 +68971,19 @@ def test_set_automated_ga4_configuration_opt_out_rest_interceptors(null_intercep req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse.to_json( - analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse() - ) + req.return_value._content = resources.AdSenseLink.to_json( + resources.AdSenseLink() ) - request = analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest() + request = analytics_admin.GetAdSenseLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.SetAutomatedGa4ConfigurationOptOutResponse() + post.return_value = resources.AdSenseLink() - client.set_automated_ga4_configuration_opt_out( + client.get_ad_sense_link( request, metadata=[ ("key", "val"), @@ -66912,9 +68995,8 @@ def test_set_automated_ga4_configuration_opt_out_rest_interceptors(null_intercep post.assert_called_once() -def test_set_automated_ga4_configuration_opt_out_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.SetAutomatedGa4ConfigurationOptOutRequest, +def test_get_ad_sense_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetAdSenseLinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -66922,7 +69004,7 @@ def test_set_automated_ga4_configuration_opt_out_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {} + request_init = {"name": "properties/sample1/adSenseLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -66934,10 +69016,66 @@ def test_set_automated_ga4_configuration_opt_out_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.set_automated_ga4_configuration_opt_out(request) + client.get_ad_sense_link(request) -def test_set_automated_ga4_configuration_opt_out_rest_error(): +def test_get_ad_sense_link_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resources.AdSenseLink() + + # get arguments that satisfy an http rule for this method + sample_request = {"name": "properties/sample1/adSenseLinks/sample2"} + + # get truthy value for each flattened field + mock_args = dict( + name="name_value", + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = resources.AdSenseLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.get_ad_sense_link(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{name=properties/*/adSenseLinks/*}" % client.transport._host, + args[1], + ) + + +def test_get_ad_sense_link_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_ad_sense_link( + analytics_admin.GetAdSenseLinkRequest(), + name="name_value", + ) + + +def test_get_ad_sense_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -66946,55 +69084,123 @@ def test_set_automated_ga4_configuration_opt_out_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, + analytics_admin.CreateAdSenseLinkRequest, dict, ], ) -def test_fetch_automated_ga4_configuration_opt_out_rest(request_type): +def test_create_ad_sense_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {} + request_init = {"parent": "properties/sample1"} + request_init["adsense_link"] = { + "name": "name_value", + "ad_client_code": "ad_client_code_value", + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateAdSenseLinkRequest.meta.fields["adsense_link"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["adsense_link"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["adsense_link"][field])): + del request_init["adsense_link"][field][i][subfield] + else: + del request_init["adsense_link"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse( - opt_out=True, + return_value = resources.AdSenseLink( + name="name_value", + ad_client_code="ad_client_code_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = ( - analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse.pb( - return_value - ) - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AdSenseLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.fetch_automated_ga4_configuration_opt_out(request) + response = client.create_ad_sense_link(request) # Establish that the response is the type that we expect. - assert isinstance( - response, analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse - ) - assert response.opt_out is True + assert isinstance(response, resources.AdSenseLink) + assert response.name == "name_value" + assert response.ad_client_code == "ad_client_code_value" -def test_fetch_automated_ga4_configuration_opt_out_rest_required_fields( - request_type=analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, +def test_create_ad_sense_link_rest_required_fields( + request_type=analytics_admin.CreateAdSenseLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["property"] = "" + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -67009,25 +69215,21 @@ def test_fetch_automated_ga4_configuration_opt_out_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).fetch_automated_ga4_configuration_opt_out._get_unset_required_fields( - jsonified_request - ) + ).create_ad_sense_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["property"] = "property_value" + jsonified_request["parent"] = "parent_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).fetch_automated_ga4_configuration_opt_out._get_unset_required_fields( - jsonified_request - ) + ).create_ad_sense_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "property" in jsonified_request - assert jsonified_request["property"] == "property_value" + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -67036,7 +69238,7 @@ def test_fetch_automated_ga4_configuration_opt_out_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse() + return_value = resources.AdSenseLink() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -67057,38 +69259,39 @@ def test_fetch_automated_ga4_configuration_opt_out_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = ( - analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse.pb( - return_value - ) - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.AdSenseLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.fetch_automated_ga4_configuration_opt_out(request) + response = client.create_ad_sense_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_fetch_automated_ga4_configuration_opt_out_rest_unset_required_fields(): +def test_create_ad_sense_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.fetch_automated_ga4_configuration_opt_out._get_unset_required_fields( - {} + unset_fields = transport.create_ad_sense_link._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "adsenseLink", + ) ) ) - assert set(unset_fields) == (set(()) & set(("property",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_fetch_automated_ga4_configuration_opt_out_rest_interceptors(null_interceptor): +def test_create_ad_sense_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -67101,16 +69304,14 @@ def test_fetch_automated_ga4_configuration_opt_out_rest_interceptors(null_interc ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_fetch_automated_ga4_configuration_opt_out", + transports.AnalyticsAdminServiceRestInterceptor, "post_create_ad_sense_link" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_fetch_automated_ga4_configuration_opt_out", + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_ad_sense_link" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest.pb( - analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest() + pb_message = analytics_admin.CreateAdSenseLinkRequest.pb( + analytics_admin.CreateAdSenseLinkRequest() ) transcode.return_value = { "method": "post", @@ -67122,23 +69323,19 @@ def test_fetch_automated_ga4_configuration_opt_out_rest_interceptors(null_interc req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse.to_json( - analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse() - ) + req.return_value._content = resources.AdSenseLink.to_json( + resources.AdSenseLink() ) - request = analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest() + request = analytics_admin.CreateAdSenseLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = ( - analytics_admin.FetchAutomatedGa4ConfigurationOptOutResponse() - ) + post.return_value = resources.AdSenseLink() - client.fetch_automated_ga4_configuration_opt_out( + client.create_ad_sense_link( request, metadata=[ ("key", "val"), @@ -67150,9 +69347,8 @@ def test_fetch_automated_ga4_configuration_opt_out_rest_interceptors(null_interc post.assert_called_once() -def test_fetch_automated_ga4_configuration_opt_out_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.FetchAutomatedGa4ConfigurationOptOutRequest, +def test_create_ad_sense_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateAdSenseLinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -67160,7 +69356,7 @@ def test_fetch_automated_ga4_configuration_opt_out_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -67172,10 +69368,68 @@ def test_fetch_automated_ga4_configuration_opt_out_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.fetch_automated_ga4_configuration_opt_out(request) + client.create_ad_sense_link(request) -def test_fetch_automated_ga4_configuration_opt_out_rest_error(): +def test_create_ad_sense_link_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resources.AdSenseLink() + + # get arguments that satisfy an http rule for this method + sample_request = {"parent": "properties/sample1"} + + # get truthy value for each flattened field + mock_args = dict( + parent="parent_value", + adsense_link=resources.AdSenseLink(name="name_value"), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = resources.AdSenseLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.create_ad_sense_link(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{parent=properties/*}/adSenseLinks" % client.transport._host, + args[1], + ) + + +def test_create_ad_sense_link_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_ad_sense_link( + analytics_admin.CreateAdSenseLinkRequest(), + parent="parent_value", + adsense_link=resources.AdSenseLink(name="name_value"), + ) + + +def test_create_ad_sense_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -67184,58 +69438,40 @@ def test_fetch_automated_ga4_configuration_opt_out_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetBigQueryLinkRequest, + analytics_admin.DeleteAdSenseLinkRequest, dict, ], ) -def test_get_big_query_link_rest(request_type): +def test_delete_ad_sense_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/bigQueryLinks/sample2"} + request_init = {"name": "properties/sample1/adSenseLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.BigQueryLink( - name="name_value", - project="project_value", - daily_export_enabled=True, - streaming_export_enabled=True, - fresh_daily_export_enabled=True, - include_advertising_id=True, - export_streams=["export_streams_value"], - excluded_events=["excluded_events_value"], - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.BigQueryLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_big_query_link(request) + response = client.delete_ad_sense_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.BigQueryLink) - assert response.name == "name_value" - assert response.project == "project_value" - assert response.daily_export_enabled is True - assert response.streaming_export_enabled is True - assert response.fresh_daily_export_enabled is True - assert response.include_advertising_id is True - assert response.export_streams == ["export_streams_value"] - assert response.excluded_events == ["excluded_events_value"] + assert response is None -def test_get_big_query_link_rest_required_fields( - request_type=analytics_admin.GetBigQueryLinkRequest, +def test_delete_ad_sense_link_rest_required_fields( + request_type=analytics_admin.DeleteAdSenseLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -67255,7 +69491,7 @@ def test_get_big_query_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_big_query_link._get_unset_required_fields(jsonified_request) + ).delete_ad_sense_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -67264,7 +69500,7 @@ def test_get_big_query_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_big_query_link._get_unset_required_fields(jsonified_request) + ).delete_ad_sense_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -67278,7 +69514,7 @@ def test_get_big_query_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.BigQueryLink() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -67290,38 +69526,36 @@ def test_get_big_query_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "delete", "query_params": pb_request, } transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = resources.BigQueryLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_big_query_link(request) + response = client.delete_ad_sense_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_big_query_link_rest_unset_required_fields(): +def test_delete_ad_sense_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_big_query_link._get_unset_required_fields({}) + unset_fields = transport.delete_ad_sense_link._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_big_query_link_rest_interceptors(null_interceptor): +def test_delete_ad_sense_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -67334,14 +69568,11 @@ def test_get_big_query_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_big_query_link" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_big_query_link" + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_ad_sense_link" ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.GetBigQueryLinkRequest.pb( - analytics_admin.GetBigQueryLinkRequest() + pb_message = analytics_admin.DeleteAdSenseLinkRequest.pb( + analytics_admin.DeleteAdSenseLinkRequest() ) transcode.return_value = { "method": "post", @@ -67353,19 +69584,15 @@ def test_get_big_query_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.BigQueryLink.to_json( - resources.BigQueryLink() - ) - request = analytics_admin.GetBigQueryLinkRequest() + request = analytics_admin.DeleteAdSenseLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.BigQueryLink() - client.get_big_query_link( + client.delete_ad_sense_link( request, metadata=[ ("key", "val"), @@ -67374,11 +69601,10 @@ def test_get_big_query_link_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_get_big_query_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetBigQueryLinkRequest +def test_delete_ad_sense_link_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeleteAdSenseLinkRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -67386,7 +69612,7 @@ def test_get_big_query_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/bigQueryLinks/sample2"} + request_init = {"name": "properties/sample1/adSenseLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -67398,10 +69624,10 @@ def test_get_big_query_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_big_query_link(request) + client.delete_ad_sense_link(request) -def test_get_big_query_link_rest_flattened(): +def test_delete_ad_sense_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -67410,10 +69636,10 @@ def test_get_big_query_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.BigQueryLink() + return_value = None # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/bigQueryLinks/sample2"} + sample_request = {"name": "properties/sample1/adSenseLinks/sample2"} # get truthy value for each flattened field mock_args = dict( @@ -67424,24 +69650,23 @@ def test_get_big_query_link_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.BigQueryLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_big_query_link(**mock_args) + client.delete_ad_sense_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/bigQueryLinks/*}" % client.transport._host, + "%s/v1alpha/{name=properties/*/adSenseLinks/*}" % client.transport._host, args[1], ) -def test_get_big_query_link_rest_flattened_error(transport: str = "rest"): +def test_delete_ad_sense_link_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -67450,13 +69675,13 @@ def test_get_big_query_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_big_query_link( - analytics_admin.GetBigQueryLinkRequest(), + client.delete_ad_sense_link( + analytics_admin.DeleteAdSenseLinkRequest(), name="name_value", ) -def test_get_big_query_link_rest_error(): +def test_delete_ad_sense_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -67465,11 +69690,11 @@ def test_get_big_query_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListBigQueryLinksRequest, + analytics_admin.ListAdSenseLinksRequest, dict, ], ) -def test_list_big_query_links_rest(request_type): +def test_list_ad_sense_links_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -67482,27 +69707,28 @@ def test_list_big_query_links_rest(request_type): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListBigQueryLinksResponse( + return_value = analytics_admin.ListAdSenseLinksResponse( next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListBigQueryLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListAdSenseLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_big_query_links(request) + response = client.list_ad_sense_links(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListBigQueryLinksPager) + assert isinstance(response, pagers.ListAdSenseLinksPager) assert response.next_page_token == "next_page_token_value" -def test_list_big_query_links_rest_required_fields( - request_type=analytics_admin.ListBigQueryLinksRequest, +def test_list_ad_sense_links_rest_required_fields( + request_type=analytics_admin.ListAdSenseLinksRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -67522,7 +69748,7 @@ def test_list_big_query_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_big_query_links._get_unset_required_fields(jsonified_request) + ).list_ad_sense_links._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -67531,7 +69757,7 @@ def test_list_big_query_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_big_query_links._get_unset_required_fields(jsonified_request) + ).list_ad_sense_links._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( ( @@ -67552,7 +69778,7 @@ def test_list_big_query_links_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListBigQueryLinksResponse() + return_value = analytics_admin.ListAdSenseLinksResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -67572,25 +69798,26 @@ def test_list_big_query_links_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListBigQueryLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListAdSenseLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_big_query_links(request) + response = client.list_ad_sense_links(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_big_query_links_rest_unset_required_fields(): +def test_list_ad_sense_links_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_big_query_links._get_unset_required_fields({}) + unset_fields = transport.list_ad_sense_links._get_unset_required_fields({}) assert set(unset_fields) == ( set( ( @@ -67603,7 +69830,7 @@ def test_list_big_query_links_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_big_query_links_rest_interceptors(null_interceptor): +def test_list_ad_sense_links_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -67616,14 +69843,14 @@ def test_list_big_query_links_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_big_query_links" + transports.AnalyticsAdminServiceRestInterceptor, "post_list_ad_sense_links" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_big_query_links" + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_ad_sense_links" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListBigQueryLinksRequest.pb( - analytics_admin.ListBigQueryLinksRequest() + pb_message = analytics_admin.ListAdSenseLinksRequest.pb( + analytics_admin.ListAdSenseLinksRequest() ) transcode.return_value = { "method": "post", @@ -67635,19 +69862,19 @@ def test_list_big_query_links_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ListBigQueryLinksResponse.to_json( - analytics_admin.ListBigQueryLinksResponse() + req.return_value._content = analytics_admin.ListAdSenseLinksResponse.to_json( + analytics_admin.ListAdSenseLinksResponse() ) - request = analytics_admin.ListBigQueryLinksRequest() + request = analytics_admin.ListAdSenseLinksRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListBigQueryLinksResponse() + post.return_value = analytics_admin.ListAdSenseLinksResponse() - client.list_big_query_links( + client.list_ad_sense_links( request, metadata=[ ("key", "val"), @@ -67659,8 +69886,8 @@ def test_list_big_query_links_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_big_query_links_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListBigQueryLinksRequest +def test_list_ad_sense_links_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListAdSenseLinksRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -67680,10 +69907,10 @@ def test_list_big_query_links_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_big_query_links(request) + client.list_ad_sense_links(request) -def test_list_big_query_links_rest_flattened(): +def test_list_ad_sense_links_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -67692,7 +69919,7 @@ def test_list_big_query_links_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListBigQueryLinksResponse() + return_value = analytics_admin.ListAdSenseLinksResponse() # get arguments that satisfy an http rule for this method sample_request = {"parent": "properties/sample1"} @@ -67706,24 +69933,25 @@ def test_list_big_query_links_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListBigQueryLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListAdSenseLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_big_query_links(**mock_args) + client.list_ad_sense_links(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/bigQueryLinks" % client.transport._host, + "%s/v1alpha/{parent=properties/*}/adSenseLinks" % client.transport._host, args[1], ) -def test_list_big_query_links_rest_flattened_error(transport: str = "rest"): +def test_list_ad_sense_links_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -67732,13 +69960,13 @@ def test_list_big_query_links_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_big_query_links( - analytics_admin.ListBigQueryLinksRequest(), + client.list_ad_sense_links( + analytics_admin.ListAdSenseLinksRequest(), parent="parent_value", ) -def test_list_big_query_links_rest_pager(transport: str = "rest"): +def test_list_ad_sense_links_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -67750,28 +69978,28 @@ def test_list_big_query_links_rest_pager(transport: str = "rest"): # with mock.patch.object(path_template, 'transcode') as transcode: # Set the response as a series of pages response = ( - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - resources.BigQueryLink(), - resources.BigQueryLink(), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + resources.AdSenseLink(), + resources.AdSenseLink(), ], next_page_token="abc", ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[], + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[], next_page_token="def", ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), ], next_page_token="ghi", ), - analytics_admin.ListBigQueryLinksResponse( - bigquery_links=[ - resources.BigQueryLink(), - resources.BigQueryLink(), + analytics_admin.ListAdSenseLinksResponse( + adsense_links=[ + resources.AdSenseLink(), + resources.AdSenseLink(), ], ), ) @@ -67780,7 +70008,7 @@ def test_list_big_query_links_rest_pager(transport: str = "rest"): # Wrap the values into proper Response objs response = tuple( - analytics_admin.ListBigQueryLinksResponse.to_json(x) for x in response + analytics_admin.ListAdSenseLinksResponse.to_json(x) for x in response ) return_values = tuple(Response() for i in response) for return_val, response_val in zip(return_values, response): @@ -67790,13 +70018,13 @@ def test_list_big_query_links_rest_pager(transport: str = "rest"): sample_request = {"parent": "properties/sample1"} - pager = client.list_big_query_links(request=sample_request) + pager = client.list_ad_sense_links(request=sample_request) results = list(pager) assert len(results) == 6 - assert all(isinstance(i, resources.BigQueryLink) for i in results) + assert all(isinstance(i, resources.AdSenseLink) for i in results) - pages = list(client.list_big_query_links(request=sample_request).pages) + pages = list(client.list_ad_sense_links(request=sample_request).pages) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -67804,11 +70032,11 @@ def test_list_big_query_links_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetEnhancedMeasurementSettingsRequest, + analytics_admin.GetEventCreateRuleRequest, dict, ], ) -def test_get_enhanced_measurement_settings_rest(request_type): +def test_get_event_create_rule_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -67816,54 +70044,39 @@ def test_get_enhanced_measurement_settings_rest(request_type): # send a request that will satisfy transcoding request_init = { - "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings" + "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.EnhancedMeasurementSettings( + return_value = event_create_and_edit.EventCreateRule( name="name_value", - stream_enabled=True, - scrolls_enabled=True, - outbound_clicks_enabled=True, - site_search_enabled=True, - video_engagement_enabled=True, - file_downloads_enabled=True, - page_changes_enabled=True, - form_interactions_enabled=True, - search_query_parameter="search_query_parameter_value", - uri_query_parameter="uri_query_parameter_value", + destination_event="destination_event_value", + source_copy_parameters=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.EnhancedMeasurementSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = event_create_and_edit.EventCreateRule.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_enhanced_measurement_settings(request) + response = client.get_event_create_rule(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.EnhancedMeasurementSettings) + assert isinstance(response, event_create_and_edit.EventCreateRule) assert response.name == "name_value" - assert response.stream_enabled is True - assert response.scrolls_enabled is True - assert response.outbound_clicks_enabled is True - assert response.site_search_enabled is True - assert response.video_engagement_enabled is True - assert response.file_downloads_enabled is True - assert response.page_changes_enabled is True - assert response.form_interactions_enabled is True - assert response.search_query_parameter == "search_query_parameter_value" - assert response.uri_query_parameter == "uri_query_parameter_value" + assert response.destination_event == "destination_event_value" + assert response.source_copy_parameters is True -def test_get_enhanced_measurement_settings_rest_required_fields( - request_type=analytics_admin.GetEnhancedMeasurementSettingsRequest, +def test_get_event_create_rule_rest_required_fields( + request_type=analytics_admin.GetEventCreateRuleRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -67883,7 +70096,7 @@ def test_get_enhanced_measurement_settings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_enhanced_measurement_settings._get_unset_required_fields(jsonified_request) + ).get_event_create_rule._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -67892,7 +70105,7 @@ def test_get_enhanced_measurement_settings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_enhanced_measurement_settings._get_unset_required_fields(jsonified_request) + ).get_event_create_rule._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -67906,7 +70119,7 @@ def test_get_enhanced_measurement_settings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.EnhancedMeasurementSettings() + return_value = event_create_and_edit.EventCreateRule() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -67926,32 +70139,31 @@ def test_get_enhanced_measurement_settings_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.EnhancedMeasurementSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = event_create_and_edit.EventCreateRule.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_enhanced_measurement_settings(request) + response = client.get_event_create_rule(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_enhanced_measurement_settings_rest_unset_required_fields(): +def test_get_event_create_rule_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.get_enhanced_measurement_settings._get_unset_required_fields({}) - ) + unset_fields = transport.get_event_create_rule._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_enhanced_measurement_settings_rest_interceptors(null_interceptor): +def test_get_event_create_rule_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -67964,16 +70176,14 @@ def test_get_enhanced_measurement_settings_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_get_enhanced_measurement_settings", + transports.AnalyticsAdminServiceRestInterceptor, "post_get_event_create_rule" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_get_enhanced_measurement_settings", + transports.AnalyticsAdminServiceRestInterceptor, "pre_get_event_create_rule" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetEnhancedMeasurementSettingsRequest.pb( - analytics_admin.GetEnhancedMeasurementSettingsRequest() + pb_message = analytics_admin.GetEventCreateRuleRequest.pb( + analytics_admin.GetEventCreateRuleRequest() ) transcode.return_value = { "method": "post", @@ -67985,19 +70195,19 @@ def test_get_enhanced_measurement_settings_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.EnhancedMeasurementSettings.to_json( - resources.EnhancedMeasurementSettings() + req.return_value._content = event_create_and_edit.EventCreateRule.to_json( + event_create_and_edit.EventCreateRule() ) - request = analytics_admin.GetEnhancedMeasurementSettingsRequest() + request = analytics_admin.GetEventCreateRuleRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.EnhancedMeasurementSettings() + post.return_value = event_create_and_edit.EventCreateRule() - client.get_enhanced_measurement_settings( + client.get_event_create_rule( request, metadata=[ ("key", "val"), @@ -68009,9 +70219,8 @@ def test_get_enhanced_measurement_settings_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_enhanced_measurement_settings_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.GetEnhancedMeasurementSettingsRequest, +def test_get_event_create_rule_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.GetEventCreateRuleRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -68020,7 +70229,7 @@ def test_get_enhanced_measurement_settings_rest_bad_request( # send a request that will satisfy transcoding request_init = { - "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings" + "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" } request = request_type(**request_init) @@ -68033,10 +70242,10 @@ def test_get_enhanced_measurement_settings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_enhanced_measurement_settings(request) + client.get_event_create_rule(request) -def test_get_enhanced_measurement_settings_rest_flattened(): +def test_get_event_create_rule_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -68045,11 +70254,11 @@ def test_get_enhanced_measurement_settings_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.EnhancedMeasurementSettings() + return_value = event_create_and_edit.EventCreateRule() # get arguments that satisfy an http rule for this method sample_request = { - "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings" + "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" } # get truthy value for each flattened field @@ -68061,27 +70270,26 @@ def test_get_enhanced_measurement_settings_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.EnhancedMeasurementSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = event_create_and_edit.EventCreateRule.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_enhanced_measurement_settings(**mock_args) + client.get_event_create_rule(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/dataStreams/*/enhancedMeasurementSettings}" + "%s/v1alpha/{name=properties/*/dataStreams/*/eventCreateRules/*}" % client.transport._host, args[1], ) -def test_get_enhanced_measurement_settings_rest_flattened_error( - transport: str = "rest", -): +def test_get_event_create_rule_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -68090,13 +70298,13 @@ def test_get_enhanced_measurement_settings_rest_flattened_error( # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_enhanced_measurement_settings( - analytics_admin.GetEnhancedMeasurementSettingsRequest(), + client.get_event_create_rule( + analytics_admin.GetEventCreateRuleRequest(), name="name_value", ) -def test_get_enhanced_measurement_settings_rest_error(): +def test_get_event_create_rule_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -68105,85 +70313,50 @@ def test_get_enhanced_measurement_settings_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateEnhancedMeasurementSettingsRequest, + analytics_admin.ListEventCreateRulesRequest, dict, ], ) -def test_update_enhanced_measurement_settings_rest(request_type): +def test_list_event_create_rules_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "enhanced_measurement_settings": { - "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings" - } - } - request_init["enhanced_measurement_settings"] = { - "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings", - "stream_enabled": True, - "scrolls_enabled": True, - "outbound_clicks_enabled": True, - "site_search_enabled": True, - "video_engagement_enabled": True, - "file_downloads_enabled": True, - "page_changes_enabled": True, - "form_interactions_enabled": True, - "search_query_parameter": "search_query_parameter_value", - "uri_query_parameter": "uri_query_parameter_value", - } + request_init = {"parent": "properties/sample1/dataStreams/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.EnhancedMeasurementSettings( - name="name_value", - stream_enabled=True, - scrolls_enabled=True, - outbound_clicks_enabled=True, - site_search_enabled=True, - video_engagement_enabled=True, - file_downloads_enabled=True, - page_changes_enabled=True, - form_interactions_enabled=True, - search_query_parameter="search_query_parameter_value", - uri_query_parameter="uri_query_parameter_value", + return_value = analytics_admin.ListEventCreateRulesResponse( + next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.EnhancedMeasurementSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListEventCreateRulesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_enhanced_measurement_settings(request) + response = client.list_event_create_rules(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.EnhancedMeasurementSettings) - assert response.name == "name_value" - assert response.stream_enabled is True - assert response.scrolls_enabled is True - assert response.outbound_clicks_enabled is True - assert response.site_search_enabled is True - assert response.video_engagement_enabled is True - assert response.file_downloads_enabled is True - assert response.page_changes_enabled is True - assert response.form_interactions_enabled is True - assert response.search_query_parameter == "search_query_parameter_value" - assert response.uri_query_parameter == "uri_query_parameter_value" + assert isinstance(response, pagers.ListEventCreateRulesPager) + assert response.next_page_token == "next_page_token_value" -def test_update_enhanced_measurement_settings_rest_required_fields( - request_type=analytics_admin.UpdateEnhancedMeasurementSettingsRequest, +def test_list_event_create_rules_rest_required_fields( + request_type=analytics_admin.ListEventCreateRulesRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -68198,19 +70371,28 @@ def test_update_enhanced_measurement_settings_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_enhanced_measurement_settings._get_unset_required_fields(jsonified_request) + ).list_event_create_rules._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["parent"] = "parent_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_enhanced_measurement_settings._get_unset_required_fields(jsonified_request) + ).list_event_create_rules._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + assert not set(unset_fields) - set( + ( + "page_size", + "page_token", + ) + ) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -68219,7 +70401,7 @@ def test_update_enhanced_measurement_settings_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.EnhancedMeasurementSettings() + return_value = analytics_admin.ListEventCreateRulesResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -68231,49 +70413,47 @@ def test_update_enhanced_measurement_settings_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "get", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = resources.EnhancedMeasurementSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListEventCreateRulesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_enhanced_measurement_settings(request) + response = client.list_event_create_rules(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_enhanced_measurement_settings_rest_unset_required_fields(): +def test_list_event_create_rules_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = ( - transport.update_enhanced_measurement_settings._get_unset_required_fields({}) - ) + unset_fields = transport.list_event_create_rules._get_unset_required_fields({}) assert set(unset_fields) == ( - set(("updateMask",)) - & set( + set( ( - "enhancedMeasurementSettings", - "updateMask", + "pageSize", + "pageToken", ) ) + & set(("parent",)) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_enhanced_measurement_settings_rest_interceptors(null_interceptor): +def test_list_event_create_rules_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -68286,16 +70466,14 @@ def test_update_enhanced_measurement_settings_rest_interceptors(null_interceptor ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_update_enhanced_measurement_settings", + transports.AnalyticsAdminServiceRestInterceptor, "post_list_event_create_rules" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_update_enhanced_measurement_settings", + transports.AnalyticsAdminServiceRestInterceptor, "pre_list_event_create_rules" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.UpdateEnhancedMeasurementSettingsRequest.pb( - analytics_admin.UpdateEnhancedMeasurementSettingsRequest() + pb_message = analytics_admin.ListEventCreateRulesRequest.pb( + analytics_admin.ListEventCreateRulesRequest() ) transcode.return_value = { "method": "post", @@ -68307,19 +70485,21 @@ def test_update_enhanced_measurement_settings_rest_interceptors(null_interceptor req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.EnhancedMeasurementSettings.to_json( - resources.EnhancedMeasurementSettings() + req.return_value._content = ( + analytics_admin.ListEventCreateRulesResponse.to_json( + analytics_admin.ListEventCreateRulesResponse() + ) ) - request = analytics_admin.UpdateEnhancedMeasurementSettingsRequest() + request = analytics_admin.ListEventCreateRulesRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.EnhancedMeasurementSettings() + post.return_value = analytics_admin.ListEventCreateRulesResponse() - client.update_enhanced_measurement_settings( + client.list_event_create_rules( request, metadata=[ ("key", "val"), @@ -68331,9 +70511,8 @@ def test_update_enhanced_measurement_settings_rest_interceptors(null_interceptor post.assert_called_once() -def test_update_enhanced_measurement_settings_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.UpdateEnhancedMeasurementSettingsRequest, +def test_list_event_create_rules_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.ListEventCreateRulesRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -68341,24 +70520,7 @@ def test_update_enhanced_measurement_settings_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "enhanced_measurement_settings": { - "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings" - } - } - request_init["enhanced_measurement_settings"] = { - "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings", - "stream_enabled": True, - "scrolls_enabled": True, - "outbound_clicks_enabled": True, - "site_search_enabled": True, - "video_engagement_enabled": True, - "file_downloads_enabled": True, - "page_changes_enabled": True, - "form_interactions_enabled": True, - "search_query_parameter": "search_query_parameter_value", - "uri_query_parameter": "uri_query_parameter_value", - } + request_init = {"parent": "properties/sample1/dataStreams/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -68370,10 +70532,10 @@ def test_update_enhanced_measurement_settings_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_enhanced_measurement_settings(request) + client.list_event_create_rules(request) -def test_update_enhanced_measurement_settings_rest_flattened(): +def test_list_event_create_rules_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -68382,115 +70544,255 @@ def test_update_enhanced_measurement_settings_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.EnhancedMeasurementSettings() + return_value = analytics_admin.ListEventCreateRulesResponse() # get arguments that satisfy an http rule for this method - sample_request = { - "enhanced_measurement_settings": { - "name": "properties/sample1/dataStreams/sample2/enhancedMeasurementSettings" - } - } + sample_request = {"parent": "properties/sample1/dataStreams/sample2"} # get truthy value for each flattened field mock_args = dict( - enhanced_measurement_settings=resources.EnhancedMeasurementSettings( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + parent="parent_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.EnhancedMeasurementSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListEventCreateRulesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_enhanced_measurement_settings(**mock_args) + client.list_event_create_rules(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{enhanced_measurement_settings.name=properties/*/dataStreams/*/enhancedMeasurementSettings}" + "%s/v1alpha/{parent=properties/*/dataStreams/*}/eventCreateRules" % client.transport._host, args[1], ) -def test_update_enhanced_measurement_settings_rest_flattened_error( - transport: str = "rest", -): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) +def test_list_event_create_rules_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_event_create_rules( + analytics_admin.ListEventCreateRulesRequest(), + parent="parent_value", + ) + + +def test_list_event_create_rules_rest_pager(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # TODO(kbandes): remove this mock unless there's a good reason for it. + # with mock.patch.object(path_template, 'transcode') as transcode: + # Set the response as a series of pages + response = ( + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + ], + next_page_token="abc", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[], + next_page_token="def", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + ], + next_page_token="ghi", + ), + analytics_admin.ListEventCreateRulesResponse( + event_create_rules=[ + event_create_and_edit.EventCreateRule(), + event_create_and_edit.EventCreateRule(), + ], + ), + ) + # Two responses for two calls + response = response + response + + # Wrap the values into proper Response objs + response = tuple( + analytics_admin.ListEventCreateRulesResponse.to_json(x) for x in response + ) + return_values = tuple(Response() for i in response) + for return_val, response_val in zip(return_values, response): + return_val._content = response_val.encode("UTF-8") + return_val.status_code = 200 + req.side_effect = return_values + + sample_request = {"parent": "properties/sample1/dataStreams/sample2"} + + pager = client.list_event_create_rules(request=sample_request) - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_enhanced_measurement_settings( - analytics_admin.UpdateEnhancedMeasurementSettingsRequest(), - enhanced_measurement_settings=resources.EnhancedMeasurementSettings( - name="name_value" - ), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + results = list(pager) + assert len(results) == 6 + assert all( + isinstance(i, event_create_and_edit.EventCreateRule) for i in results ) - -def test_update_enhanced_measurement_settings_rest_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) + pages = list(client.list_event_create_rules(request=sample_request).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateConnectedSiteTagRequest, + analytics_admin.CreateEventCreateRuleRequest, dict, ], ) -def test_create_connected_site_tag_rest(request_type): +def test_create_event_create_rule_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {} + request_init = {"parent": "properties/sample1/dataStreams/sample2"} + request_init["event_create_rule"] = { + "name": "name_value", + "destination_event": "destination_event_value", + "event_conditions": [ + { + "field": "field_value", + "comparison_type": 1, + "value": "value_value", + "negated": True, + } + ], + "source_copy_parameters": True, + "parameter_mutations": [ + {"parameter": "parameter_value", "parameter_value": "parameter_value_value"} + ], + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateEventCreateRuleRequest.meta.fields[ + "event_create_rule" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["event_create_rule"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["event_create_rule"][field])): + del request_init["event_create_rule"][field][i][subfield] + else: + del request_init["event_create_rule"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.CreateConnectedSiteTagResponse() + return_value = event_create_and_edit.EventCreateRule( + name="name_value", + destination_event="destination_event_value", + source_copy_parameters=True, + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.CreateConnectedSiteTagResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = event_create_and_edit.EventCreateRule.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_connected_site_tag(request) + response = client.create_event_create_rule(request) # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.CreateConnectedSiteTagResponse) + assert isinstance(response, event_create_and_edit.EventCreateRule) + assert response.name == "name_value" + assert response.destination_event == "destination_event_value" + assert response.source_copy_parameters is True -def test_create_connected_site_tag_rest_required_fields( - request_type=analytics_admin.CreateConnectedSiteTagRequest, +def test_create_event_create_rule_rest_required_fields( + request_type=analytics_admin.CreateEventCreateRuleRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -68505,17 +70807,21 @@ def test_create_connected_site_tag_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_connected_site_tag._get_unset_required_fields(jsonified_request) + ).create_event_create_rule._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["parent"] = "parent_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_connected_site_tag._get_unset_required_fields(jsonified_request) + ).create_event_create_rule._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -68524,7 +70830,7 @@ def test_create_connected_site_tag_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.CreateConnectedSiteTagResponse() + return_value = event_create_and_edit.EventCreateRule() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -68545,32 +70851,39 @@ def test_create_connected_site_tag_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.CreateConnectedSiteTagResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = event_create_and_edit.EventCreateRule.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_connected_site_tag(request) + response = client.create_event_create_rule(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_connected_site_tag_rest_unset_required_fields(): +def test_create_event_create_rule_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_connected_site_tag._get_unset_required_fields({}) - assert set(unset_fields) == (set(()) & set(("connectedSiteTag",))) + unset_fields = transport.create_event_create_rule._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "eventCreateRule", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_connected_site_tag_rest_interceptors(null_interceptor): +def test_create_event_create_rule_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -68583,15 +70896,14 @@ def test_create_connected_site_tag_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_create_connected_site_tag", + transports.AnalyticsAdminServiceRestInterceptor, "post_create_event_create_rule" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_connected_site_tag" + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_event_create_rule" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateConnectedSiteTagRequest.pb( - analytics_admin.CreateConnectedSiteTagRequest() + pb_message = analytics_admin.CreateEventCreateRuleRequest.pb( + analytics_admin.CreateEventCreateRuleRequest() ) transcode.return_value = { "method": "post", @@ -68603,21 +70915,19 @@ def test_create_connected_site_tag_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.CreateConnectedSiteTagResponse.to_json( - analytics_admin.CreateConnectedSiteTagResponse() - ) + req.return_value._content = event_create_and_edit.EventCreateRule.to_json( + event_create_and_edit.EventCreateRule() ) - request = analytics_admin.CreateConnectedSiteTagRequest() + request = analytics_admin.CreateEventCreateRuleRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.CreateConnectedSiteTagResponse() + post.return_value = event_create_and_edit.EventCreateRule() - client.create_connected_site_tag( + client.create_event_create_rule( request, metadata=[ ("key", "val"), @@ -68629,8 +70939,8 @@ def test_create_connected_site_tag_rest_interceptors(null_interceptor): post.assert_called_once() -def test_create_connected_site_tag_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateConnectedSiteTagRequest +def test_create_event_create_rule_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateEventCreateRuleRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -68638,7 +70948,7 @@ def test_create_connected_site_tag_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {} + request_init = {"parent": "properties/sample1/dataStreams/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -68650,124 +70960,69 @@ def test_create_connected_site_tag_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_connected_site_tag(request) - - -def test_create_connected_site_tag_rest_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) + client.create_event_create_rule(request) -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.DeleteConnectedSiteTagRequest, - dict, - ], -) -def test_delete_connected_site_tag_rest(request_type): +def test_create_event_create_rule_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) - # send a request that will satisfy transcoding - request_init = {} - request = request_type(**request_init) - # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = event_create_and_edit.EventCreateRule() + + # get arguments that satisfy an http rule for this method + sample_request = {"parent": "properties/sample1/dataStreams/sample2"} + + # get truthy value for each flattened field + mock_args = dict( + parent="parent_value", + event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + ) + mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" - + # Convert return value to protobuf type + return_value = event_create_and_edit.EventCreateRule.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_connected_site_tag(request) - - # Establish that the response is the type that we expect. - assert response is None - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_connected_site_tag_rest_interceptors(null_interceptor): - transport = transports.AnalyticsAdminServiceRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.AnalyticsAdminServiceRestInterceptor(), - ) - client = AnalyticsAdminServiceClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_connected_site_tag" - ) as pre: - pre.assert_not_called() - pb_message = analytics_admin.DeleteConnectedSiteTagRequest.pb( - analytics_admin.DeleteConnectedSiteTagRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, - } - - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - request = analytics_admin.DeleteConnectedSiteTagRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata + client.create_event_create_rule(**mock_args) - client.delete_connected_site_tag( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{parent=properties/*/dataStreams/*}/eventCreateRules" + % client.transport._host, + args[1], ) - pre.assert_called_once() - -def test_delete_connected_site_tag_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteConnectedSiteTagRequest -): +def test_create_event_create_rule_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) - # send a request that will satisfy transcoding - request_init = {} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.delete_connected_site_tag(request) + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_event_create_rule( + analytics_admin.CreateEventCreateRuleRequest(), + parent="parent_value", + event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + ) -def test_delete_connected_site_tag_rest_error(): +def test_create_event_create_rule_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -68776,176 +71031,142 @@ def test_delete_connected_site_tag_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListConnectedSiteTagsRequest, + analytics_admin.UpdateEventCreateRuleRequest, dict, ], ) -def test_list_connected_site_tags_rest(request_type): +def test_update_event_create_rule_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListConnectedSiteTagsResponse() - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = analytics_admin.ListConnectedSiteTagsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) - - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - response = client.list_connected_site_tags(request) - - # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.ListConnectedSiteTagsResponse) - - -@pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_connected_site_tags_rest_interceptors(null_interceptor): - transport = transports.AnalyticsAdminServiceRestTransport( - credentials=ga_credentials.AnonymousCredentials(), - interceptor=None - if null_interceptor - else transports.AnalyticsAdminServiceRestInterceptor(), - ) - client = AnalyticsAdminServiceClient(transport=transport) - with mock.patch.object( - type(client.transport._session), "request" - ) as req, mock.patch.object( - path_template, "transcode" - ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_connected_site_tags" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_connected_site_tags" - ) as pre: - pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.ListConnectedSiteTagsRequest.pb( - analytics_admin.ListConnectedSiteTagsRequest() - ) - transcode.return_value = { - "method": "post", - "uri": "my_uri", - "body": pb_message, - "query_params": pb_message, + request_init = { + "event_create_rule": { + "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" } + } + request_init["event_create_rule"] = { + "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3", + "destination_event": "destination_event_value", + "event_conditions": [ + { + "field": "field_value", + "comparison_type": 1, + "value": "value_value", + "negated": True, + } + ], + "source_copy_parameters": True, + "parameter_mutations": [ + {"parameter": "parameter_value", "parameter_value": "parameter_value_value"} + ], + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 - req.return_value = Response() - req.return_value.status_code = 200 - req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.ListConnectedSiteTagsResponse.to_json( - analytics_admin.ListConnectedSiteTagsResponse() - ) - ) - - request = analytics_admin.ListConnectedSiteTagsRequest() - metadata = [ - ("key", "val"), - ("cephalopod", "squid"), - ] - pre.return_value = request, metadata - post.return_value = analytics_admin.ListConnectedSiteTagsResponse() - - client.list_connected_site_tags( - request, - metadata=[ - ("key", "val"), - ("cephalopod", "squid"), - ], - ) - - pre.assert_called_once() - post.assert_called_once() - - -def test_list_connected_site_tags_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListConnectedSiteTagsRequest -): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # send a request that will satisfy transcoding - request_init = {} - request = request_type(**request_init) - - # Mock the http request call within the method and fake a BadRequest error. - with mock.patch.object(Session, "request") as req, pytest.raises( - core_exceptions.BadRequest - ): - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 400 - response_value.request = Request() - req.return_value = response_value - client.list_connected_site_tags(request) - - -def test_list_connected_site_tags_rest_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="rest" - ) + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateEventCreateRuleRequest.meta.fields[ + "event_create_rule" + ] + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] -@pytest.mark.parametrize( - "request_type", - [ - analytics_admin.FetchConnectedGa4PropertyRequest, - dict, - ], -) -def test_fetch_connected_ga4_property_rest(request_type): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["event_create_rule"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) - # send a request that will satisfy transcoding - request_init = {} + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["event_create_rule"][field])): + del request_init["event_create_rule"][field][i][subfield] + else: + del request_init["event_create_rule"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.FetchConnectedGa4PropertyResponse( - property="property_value", + return_value = event_create_and_edit.EventCreateRule( + name="name_value", + destination_event="destination_event_value", + source_copy_parameters=True, ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.FetchConnectedGa4PropertyResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = event_create_and_edit.EventCreateRule.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.fetch_connected_ga4_property(request) + response = client.update_event_create_rule(request) # Establish that the response is the type that we expect. - assert isinstance(response, analytics_admin.FetchConnectedGa4PropertyResponse) - assert response.property == "property_value" + assert isinstance(response, event_create_and_edit.EventCreateRule) + assert response.name == "name_value" + assert response.destination_event == "destination_event_value" + assert response.source_copy_parameters is True -def test_fetch_connected_ga4_property_rest_required_fields( - request_type=analytics_admin.FetchConnectedGa4PropertyRequest, +def test_update_event_create_rule_rest_required_fields( + request_type=analytics_admin.UpdateEventCreateRuleRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["property"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -68957,29 +71178,22 @@ def test_fetch_connected_ga4_property_rest_required_fields( ) # verify fields with default values are dropped - assert "property" not in jsonified_request unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).fetch_connected_ga4_property._get_unset_required_fields(jsonified_request) + ).update_event_create_rule._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - assert "property" in jsonified_request - assert jsonified_request["property"] == request_init["property"] - - jsonified_request["property"] = "property_value" unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).fetch_connected_ga4_property._get_unset_required_fields(jsonified_request) + ).update_event_create_rule._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("property",)) + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "property" in jsonified_request - assert jsonified_request["property"] == "property_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -68988,7 +71202,7 @@ def test_fetch_connected_ga4_property_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.FetchConnectedGa4PropertyResponse() + return_value = event_create_and_edit.EventCreateRule() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -69000,46 +71214,48 @@ def test_fetch_connected_ga4_property_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "patch", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.FetchConnectedGa4PropertyResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = event_create_and_edit.EventCreateRule.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.fetch_connected_ga4_property(request) + response = client.update_event_create_rule(request) - expected_params = [ - ( - "property", - "", - ), - ("$alt", "json;enum-encoding=int"), - ] + expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_fetch_connected_ga4_property_rest_unset_required_fields(): +def test_update_event_create_rule_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.fetch_connected_ga4_property._get_unset_required_fields({}) - assert set(unset_fields) == (set(("property",)) & set(("property",))) + unset_fields = transport.update_event_create_rule._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("updateMask",)) + & set( + ( + "eventCreateRule", + "updateMask", + ) + ) + ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_fetch_connected_ga4_property_rest_interceptors(null_interceptor): +def test_update_event_create_rule_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -69052,16 +71268,14 @@ def test_fetch_connected_ga4_property_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "post_fetch_connected_ga4_property", + transports.AnalyticsAdminServiceRestInterceptor, "post_update_event_create_rule" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, - "pre_fetch_connected_ga4_property", + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_event_create_rule" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.FetchConnectedGa4PropertyRequest.pb( - analytics_admin.FetchConnectedGa4PropertyRequest() + pb_message = analytics_admin.UpdateEventCreateRuleRequest.pb( + analytics_admin.UpdateEventCreateRuleRequest() ) transcode.return_value = { "method": "post", @@ -69073,21 +71287,19 @@ def test_fetch_connected_ga4_property_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = ( - analytics_admin.FetchConnectedGa4PropertyResponse.to_json( - analytics_admin.FetchConnectedGa4PropertyResponse() - ) + req.return_value._content = event_create_and_edit.EventCreateRule.to_json( + event_create_and_edit.EventCreateRule() ) - request = analytics_admin.FetchConnectedGa4PropertyRequest() + request = analytics_admin.UpdateEventCreateRuleRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.FetchConnectedGa4PropertyResponse() + post.return_value = event_create_and_edit.EventCreateRule() - client.fetch_connected_ga4_property( + client.update_event_create_rule( request, metadata=[ ("key", "val"), @@ -69099,9 +71311,8 @@ def test_fetch_connected_ga4_property_rest_interceptors(null_interceptor): post.assert_called_once() -def test_fetch_connected_ga4_property_rest_bad_request( - transport: str = "rest", - request_type=analytics_admin.FetchConnectedGa4PropertyRequest, +def test_update_event_create_rule_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateEventCreateRuleRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -69109,7 +71320,11 @@ def test_fetch_connected_ga4_property_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {} + request_init = { + "event_create_rule": { + "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" + } + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -69121,10 +71336,73 @@ def test_fetch_connected_ga4_property_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.fetch_connected_ga4_property(request) + client.update_event_create_rule(request) -def test_fetch_connected_ga4_property_rest_error(): +def test_update_event_create_rule_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = event_create_and_edit.EventCreateRule() + + # get arguments that satisfy an http rule for this method + sample_request = { + "event_create_rule": { + "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" + } + } + + # get truthy value for each flattened field + mock_args = dict( + event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = event_create_and_edit.EventCreateRule.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.update_event_create_rule(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{event_create_rule.name=properties/*/dataStreams/*/eventCreateRules/*}" + % client.transport._host, + args[1], + ) + + +def test_update_event_create_rule_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_event_create_rule( + analytics_admin.UpdateEventCreateRuleRequest(), + event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +def test_update_event_create_rule_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -69133,46 +71411,42 @@ def test_fetch_connected_ga4_property_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetAdSenseLinkRequest, + analytics_admin.DeleteEventCreateRuleRequest, dict, ], ) -def test_get_ad_sense_link_rest(request_type): +def test_delete_event_create_rule_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/adSenseLinks/sample2"} + request_init = { + "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" + } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.AdSenseLink( - name="name_value", - ad_client_code="ad_client_code_value", - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AdSenseLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_ad_sense_link(request) + response = client.delete_event_create_rule(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.AdSenseLink) - assert response.name == "name_value" - assert response.ad_client_code == "ad_client_code_value" + assert response is None -def test_get_ad_sense_link_rest_required_fields( - request_type=analytics_admin.GetAdSenseLinkRequest, +def test_delete_event_create_rule_rest_required_fields( + request_type=analytics_admin.DeleteEventCreateRuleRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -69192,7 +71466,7 @@ def test_get_ad_sense_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_ad_sense_link._get_unset_required_fields(jsonified_request) + ).delete_event_create_rule._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -69201,7 +71475,7 @@ def test_get_ad_sense_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_ad_sense_link._get_unset_required_fields(jsonified_request) + ).delete_event_create_rule._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -69215,7 +71489,7 @@ def test_get_ad_sense_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.AdSenseLink() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -69227,38 +71501,36 @@ def test_get_ad_sense_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "delete", "query_params": pb_request, } transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = resources.AdSenseLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_ad_sense_link(request) + response = client.delete_event_create_rule(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_ad_sense_link_rest_unset_required_fields(): +def test_delete_event_create_rule_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_ad_sense_link._get_unset_required_fields({}) + unset_fields = transport.delete_event_create_rule._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_ad_sense_link_rest_interceptors(null_interceptor): +def test_delete_event_create_rule_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -69271,14 +71543,11 @@ def test_get_ad_sense_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_ad_sense_link" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_ad_sense_link" + transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_event_create_rule" ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.GetAdSenseLinkRequest.pb( - analytics_admin.GetAdSenseLinkRequest() + pb_message = analytics_admin.DeleteEventCreateRuleRequest.pb( + analytics_admin.DeleteEventCreateRuleRequest() ) transcode.return_value = { "method": "post", @@ -69290,19 +71559,15 @@ def test_get_ad_sense_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.AdSenseLink.to_json( - resources.AdSenseLink() - ) - request = analytics_admin.GetAdSenseLinkRequest() + request = analytics_admin.DeleteEventCreateRuleRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.AdSenseLink() - client.get_ad_sense_link( + client.delete_event_create_rule( request, metadata=[ ("key", "val"), @@ -69311,11 +71576,10 @@ def test_get_ad_sense_link_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_get_ad_sense_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetAdSenseLinkRequest +def test_delete_event_create_rule_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.DeleteEventCreateRuleRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -69323,7 +71587,9 @@ def test_get_ad_sense_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/adSenseLinks/sample2"} + request_init = { + "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -69335,10 +71601,10 @@ def test_get_ad_sense_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_ad_sense_link(request) + client.delete_event_create_rule(request) -def test_get_ad_sense_link_rest_flattened(): +def test_delete_event_create_rule_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -69347,10 +71613,12 @@ def test_get_ad_sense_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.AdSenseLink() + return_value = None # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/adSenseLinks/sample2"} + sample_request = { + "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" + } # get truthy value for each flattened field mock_args = dict( @@ -69361,24 +71629,24 @@ def test_get_ad_sense_link_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AdSenseLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_ad_sense_link(**mock_args) + client.delete_event_create_rule(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/adSenseLinks/*}" % client.transport._host, + "%s/v1alpha/{name=properties/*/dataStreams/*/eventCreateRules/*}" + % client.transport._host, args[1], ) -def test_get_ad_sense_link_rest_flattened_error(transport: str = "rest"): +def test_delete_event_create_rule_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -69387,13 +71655,13 @@ def test_get_ad_sense_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_ad_sense_link( - analytics_admin.GetAdSenseLinkRequest(), + client.delete_event_create_rule( + analytics_admin.DeleteEventCreateRuleRequest(), name="name_value", ) -def test_get_ad_sense_link_rest_error(): +def test_delete_event_create_rule_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -69402,55 +71670,139 @@ def test_get_ad_sense_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateAdSenseLinkRequest, + analytics_admin.UpdateDataRedactionSettingsRequest, dict, ], ) -def test_create_ad_sense_link_rest(request_type): +def test_update_data_redaction_settings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["adsense_link"] = { - "name": "name_value", - "ad_client_code": "ad_client_code_value", + request_init = { + "data_redaction_settings": { + "name": "properties/sample1/dataStreams/sample2/dataRedactionSettings" + } + } + request_init["data_redaction_settings"] = { + "name": "properties/sample1/dataStreams/sample2/dataRedactionSettings", + "email_redaction_enabled": True, + "query_parameter_redaction_enabled": True, + "query_parameter_keys": [ + "query_parameter_keys_value1", + "query_parameter_keys_value2", + ], } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateDataRedactionSettingsRequest.meta.fields[ + "data_redaction_settings" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "data_redaction_settings" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["data_redaction_settings"][field])): + del request_init["data_redaction_settings"][field][i][subfield] + else: + del request_init["data_redaction_settings"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.AdSenseLink( + return_value = resources.DataRedactionSettings( name="name_value", - ad_client_code="ad_client_code_value", + email_redaction_enabled=True, + query_parameter_redaction_enabled=True, + query_parameter_keys=["query_parameter_keys_value"], ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AdSenseLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataRedactionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_ad_sense_link(request) + response = client.update_data_redaction_settings(request) # Establish that the response is the type that we expect. - assert isinstance(response, resources.AdSenseLink) + assert isinstance(response, resources.DataRedactionSettings) assert response.name == "name_value" - assert response.ad_client_code == "ad_client_code_value" + assert response.email_redaction_enabled is True + assert response.query_parameter_redaction_enabled is True + assert response.query_parameter_keys == ["query_parameter_keys_value"] -def test_create_ad_sense_link_rest_required_fields( - request_type=analytics_admin.CreateAdSenseLinkRequest, +def test_update_data_redaction_settings_rest_required_fields( + request_type=analytics_admin.UpdateDataRedactionSettingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -69465,21 +71817,19 @@ def test_create_ad_sense_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_ad_sense_link._get_unset_required_fields(jsonified_request) + ).update_data_redaction_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_ad_sense_link._get_unset_required_fields(jsonified_request) + ).update_data_redaction_settings._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -69488,7 +71838,7 @@ def test_create_ad_sense_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = resources.AdSenseLink() + return_value = resources.DataRedactionSettings() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -69500,7 +71850,7 @@ def test_create_ad_sense_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "post", + "method": "patch", "query_params": pb_request, } transcode_result["body"] = pb_request @@ -69509,38 +71859,41 @@ def test_create_ad_sense_link_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AdSenseLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataRedactionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_ad_sense_link(request) + response = client.update_data_redaction_settings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_ad_sense_link_rest_unset_required_fields(): +def test_update_data_redaction_settings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_ad_sense_link._get_unset_required_fields({}) + unset_fields = transport.update_data_redaction_settings._get_unset_required_fields( + {} + ) assert set(unset_fields) == ( - set(()) + set(("updateMask",)) & set( ( - "parent", - "adsenseLink", + "dataRedactionSettings", + "updateMask", ) ) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_ad_sense_link_rest_interceptors(null_interceptor): +def test_update_data_redaction_settings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -69553,14 +71906,16 @@ def test_create_ad_sense_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_ad_sense_link" + transports.AnalyticsAdminServiceRestInterceptor, + "post_update_data_redaction_settings", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_ad_sense_link" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_update_data_redaction_settings", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateAdSenseLinkRequest.pb( - analytics_admin.CreateAdSenseLinkRequest() + pb_message = analytics_admin.UpdateDataRedactionSettingsRequest.pb( + analytics_admin.UpdateDataRedactionSettingsRequest() ) transcode.return_value = { "method": "post", @@ -69572,19 +71927,19 @@ def test_create_ad_sense_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = resources.AdSenseLink.to_json( - resources.AdSenseLink() + req.return_value._content = resources.DataRedactionSettings.to_json( + resources.DataRedactionSettings() ) - request = analytics_admin.CreateAdSenseLinkRequest() + request = analytics_admin.UpdateDataRedactionSettingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = resources.AdSenseLink() + post.return_value = resources.DataRedactionSettings() - client.create_ad_sense_link( + client.update_data_redaction_settings( request, metadata=[ ("key", "val"), @@ -69596,8 +71951,9 @@ def test_create_ad_sense_link_rest_interceptors(null_interceptor): post.assert_called_once() -def test_create_ad_sense_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateAdSenseLinkRequest +def test_update_data_redaction_settings_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.UpdateDataRedactionSettingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -69605,10 +71961,10 @@ def test_create_ad_sense_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} - request_init["adsense_link"] = { - "name": "name_value", - "ad_client_code": "ad_client_code_value", + request_init = { + "data_redaction_settings": { + "name": "properties/sample1/dataStreams/sample2/dataRedactionSettings" + } } request = request_type(**request_init) @@ -69621,10 +71977,10 @@ def test_create_ad_sense_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_ad_sense_link(request) + client.update_data_redaction_settings(request) -def test_create_ad_sense_link_rest_flattened(): +def test_update_data_redaction_settings_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -69633,39 +71989,45 @@ def test_create_ad_sense_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = resources.AdSenseLink() + return_value = resources.DataRedactionSettings() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} + sample_request = { + "data_redaction_settings": { + "name": "properties/sample1/dataStreams/sample2/dataRedactionSettings" + } + } # get truthy value for each flattened field mock_args = dict( - parent="parent_value", - adsense_link=resources.AdSenseLink(name="name_value"), + data_redaction_settings=resources.DataRedactionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.AdSenseLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataRedactionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_ad_sense_link(**mock_args) + client.update_data_redaction_settings(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/adSenseLinks" % client.transport._host, + "%s/v1alpha/{data_redaction_settings.name=properties/*/dataStreams/*/dataRedactionSettings}" + % client.transport._host, args[1], ) -def test_create_ad_sense_link_rest_flattened_error(transport: str = "rest"): +def test_update_data_redaction_settings_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -69674,14 +72036,14 @@ def test_create_ad_sense_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_ad_sense_link( - analytics_admin.CreateAdSenseLinkRequest(), - parent="parent_value", - adsense_link=resources.AdSenseLink(name="name_value"), + client.update_data_redaction_settings( + analytics_admin.UpdateDataRedactionSettingsRequest(), + data_redaction_settings=resources.DataRedactionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_create_ad_sense_link_rest_error(): +def test_update_data_redaction_settings_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -69690,40 +72052,53 @@ def test_create_ad_sense_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteAdSenseLinkRequest, + analytics_admin.GetDataRedactionSettingsRequest, dict, ], ) -def test_delete_ad_sense_link_rest(request_type): +def test_get_data_redaction_settings_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/adSenseLinks/sample2"} + request_init = { + "name": "properties/sample1/dataStreams/sample2/dataRedactionSettings" + } request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.DataRedactionSettings( + name="name_value", + email_redaction_enabled=True, + query_parameter_redaction_enabled=True, + query_parameter_keys=["query_parameter_keys_value"], + ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.DataRedactionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_ad_sense_link(request) + response = client.get_data_redaction_settings(request) # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.DataRedactionSettings) + assert response.name == "name_value" + assert response.email_redaction_enabled is True + assert response.query_parameter_redaction_enabled is True + assert response.query_parameter_keys == ["query_parameter_keys_value"] -def test_delete_ad_sense_link_rest_required_fields( - request_type=analytics_admin.DeleteAdSenseLinkRequest, +def test_get_data_redaction_settings_rest_required_fields( + request_type=analytics_admin.GetDataRedactionSettingsRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -69743,7 +72118,7 @@ def test_delete_ad_sense_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_ad_sense_link._get_unset_required_fields(jsonified_request) + ).get_data_redaction_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -69752,7 +72127,7 @@ def test_delete_ad_sense_link_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_ad_sense_link._get_unset_required_fields(jsonified_request) + ).get_data_redaction_settings._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -69766,7 +72141,7 @@ def test_delete_ad_sense_link_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.DataRedactionSettings() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -69778,36 +72153,39 @@ def test_delete_ad_sense_link_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "delete", + "method": "get", "query_params": pb_request, } transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - json_return_value = "" + + # Convert return value to protobuf type + return_value = resources.DataRedactionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_ad_sense_link(request) + response = client.get_data_redaction_settings(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_ad_sense_link_rest_unset_required_fields(): +def test_get_data_redaction_settings_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_ad_sense_link._get_unset_required_fields({}) + unset_fields = transport.get_data_redaction_settings._get_unset_required_fields({}) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_ad_sense_link_rest_interceptors(null_interceptor): +def test_get_data_redaction_settings_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -69820,11 +72198,16 @@ def test_delete_ad_sense_link_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_ad_sense_link" + transports.AnalyticsAdminServiceRestInterceptor, + "post_get_data_redaction_settings", + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, + "pre_get_data_redaction_settings", ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteAdSenseLinkRequest.pb( - analytics_admin.DeleteAdSenseLinkRequest() + post.assert_not_called() + pb_message = analytics_admin.GetDataRedactionSettingsRequest.pb( + analytics_admin.GetDataRedactionSettingsRequest() ) transcode.return_value = { "method": "post", @@ -69836,15 +72219,19 @@ def test_delete_ad_sense_link_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() + req.return_value._content = resources.DataRedactionSettings.to_json( + resources.DataRedactionSettings() + ) - request = analytics_admin.DeleteAdSenseLinkRequest() + request = analytics_admin.GetDataRedactionSettingsRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata + post.return_value = resources.DataRedactionSettings() - client.delete_ad_sense_link( + client.get_data_redaction_settings( request, metadata=[ ("key", "val"), @@ -69853,10 +72240,12 @@ def test_delete_ad_sense_link_rest_interceptors(null_interceptor): ) pre.assert_called_once() + post.assert_called_once() -def test_delete_ad_sense_link_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteAdSenseLinkRequest +def test_get_data_redaction_settings_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.GetDataRedactionSettingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -69864,7 +72253,9 @@ def test_delete_ad_sense_link_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"name": "properties/sample1/adSenseLinks/sample2"} + request_init = { + "name": "properties/sample1/dataStreams/sample2/dataRedactionSettings" + } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -69876,10 +72267,10 @@ def test_delete_ad_sense_link_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_ad_sense_link(request) + client.get_data_redaction_settings(request) -def test_delete_ad_sense_link_rest_flattened(): +def test_get_data_redaction_settings_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -69888,10 +72279,12 @@ def test_delete_ad_sense_link_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = None + return_value = resources.DataRedactionSettings() # get arguments that satisfy an http rule for this method - sample_request = {"name": "properties/sample1/adSenseLinks/sample2"} + sample_request = { + "name": "properties/sample1/dataStreams/sample2/dataRedactionSettings" + } # get truthy value for each flattened field mock_args = dict( @@ -69902,23 +72295,26 @@ def test_delete_ad_sense_link_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - json_return_value = "" + # Convert return value to protobuf type + return_value = resources.DataRedactionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.delete_ad_sense_link(**mock_args) + client.get_data_redaction_settings(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/adSenseLinks/*}" % client.transport._host, + "%s/v1alpha/{name=properties/*/dataStreams/*/dataRedactionSettings}" + % client.transport._host, args[1], ) -def test_delete_ad_sense_link_rest_flattened_error(transport: str = "rest"): +def test_get_data_redaction_settings_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -69927,13 +72323,13 @@ def test_delete_ad_sense_link_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_ad_sense_link( - analytics_admin.DeleteAdSenseLinkRequest(), + client.get_data_redaction_settings( + analytics_admin.GetDataRedactionSettingsRequest(), name="name_value", ) -def test_delete_ad_sense_link_rest_error(): +def test_get_data_redaction_settings_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -69942,49 +72338,46 @@ def test_delete_ad_sense_link_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListAdSenseLinksRequest, + analytics_admin.CreateRollupPropertyRequest, dict, ], ) -def test_list_ad_sense_links_rest(request_type): +def test_create_rollup_property_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListAdSenseLinksResponse( - next_page_token="next_page_token_value", - ) + return_value = analytics_admin.CreateRollupPropertyResponse() # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListAdSenseLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.CreateRollupPropertyResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_ad_sense_links(request) + response = client.create_rollup_property(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListAdSenseLinksPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, analytics_admin.CreateRollupPropertyResponse) -def test_list_ad_sense_links_rest_required_fields( - request_type=analytics_admin.ListAdSenseLinksRequest, +def test_create_rollup_property_rest_required_fields( + request_type=analytics_admin.CreateRollupPropertyRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} - request_init["parent"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -69999,28 +72392,17 @@ def test_list_ad_sense_links_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_ad_sense_links._get_unset_required_fields(jsonified_request) + ).create_rollup_property._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present - jsonified_request["parent"] = "parent_value" - unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_ad_sense_links._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set( - ( - "page_size", - "page_token", - ) - ) + ).create_rollup_property._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone - assert "parent" in jsonified_request - assert jsonified_request["parent"] == "parent_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -70029,7 +72411,7 @@ def test_list_ad_sense_links_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListAdSenseLinksResponse() + return_value = analytics_admin.CreateRollupPropertyResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -70041,46 +72423,40 @@ def test_list_ad_sense_links_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "get", + "method": "post", "query_params": pb_request, } + transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListAdSenseLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.CreateRollupPropertyResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_ad_sense_links(request) + response = client.create_rollup_property(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_ad_sense_links_rest_unset_required_fields(): +def test_create_rollup_property_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_ad_sense_links._get_unset_required_fields({}) - assert set(unset_fields) == ( - set( - ( - "pageSize", - "pageToken", - ) - ) - & set(("parent",)) - ) + unset_fields = transport.create_rollup_property._get_unset_required_fields({}) + assert set(unset_fields) == (set(()) & set(("rollupProperty",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_ad_sense_links_rest_interceptors(null_interceptor): +def test_create_rollup_property_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -70093,14 +72469,14 @@ def test_list_ad_sense_links_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_ad_sense_links" + transports.AnalyticsAdminServiceRestInterceptor, "post_create_rollup_property" ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_ad_sense_links" + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_rollup_property" ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListAdSenseLinksRequest.pb( - analytics_admin.ListAdSenseLinksRequest() + pb_message = analytics_admin.CreateRollupPropertyRequest.pb( + analytics_admin.CreateRollupPropertyRequest() ) transcode.return_value = { "method": "post", @@ -70112,19 +72488,21 @@ def test_list_ad_sense_links_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = analytics_admin.ListAdSenseLinksResponse.to_json( - analytics_admin.ListAdSenseLinksResponse() + req.return_value._content = ( + analytics_admin.CreateRollupPropertyResponse.to_json( + analytics_admin.CreateRollupPropertyResponse() + ) ) - request = analytics_admin.ListAdSenseLinksRequest() + request = analytics_admin.CreateRollupPropertyRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListAdSenseLinksResponse() + post.return_value = analytics_admin.CreateRollupPropertyResponse() - client.list_ad_sense_links( + client.create_rollup_property( request, metadata=[ ("key", "val"), @@ -70136,8 +72514,8 @@ def test_list_ad_sense_links_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_ad_sense_links_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListAdSenseLinksRequest +def test_create_rollup_property_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateRollupPropertyRequest ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -70145,7 +72523,7 @@ def test_list_ad_sense_links_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1"} + request_init = {} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -70157,174 +72535,59 @@ def test_list_ad_sense_links_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_ad_sense_links(request) - - -def test_list_ad_sense_links_rest_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport="rest", - ) - - # Mock the http request call within the method and fake a response. - with mock.patch.object(type(client.transport._session), "request") as req: - # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListAdSenseLinksResponse() - - # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1"} - - # get truthy value for each flattened field - mock_args = dict( - parent="parent_value", - ) - mock_args.update(sample_request) - - # Wrap the value into a proper Response obj - response_value = Response() - response_value.status_code = 200 - pb_return_value = analytics_admin.ListAdSenseLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) - response_value._content = json_return_value.encode("UTF-8") - req.return_value = response_value - - client.list_ad_sense_links(**mock_args) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(req.mock_calls) == 1 - _, args, _ = req.mock_calls[0] - assert path_template.validate( - "%s/v1alpha/{parent=properties/*}/adSenseLinks" % client.transport._host, - args[1], - ) + client.create_rollup_property(request) -def test_list_ad_sense_links_rest_flattened_error(transport: str = "rest"): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.list_ad_sense_links( - analytics_admin.ListAdSenseLinksRequest(), - parent="parent_value", - ) - - -def test_list_ad_sense_links_rest_pager(transport: str = "rest"): +def test_create_rollup_property_rest_error(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - transport=transport, + credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) - # Mock the http request call within the method and fake a response. - with mock.patch.object(Session, "request") as req: - # TODO(kbandes): remove this mock unless there's a good reason for it. - # with mock.patch.object(path_template, 'transcode') as transcode: - # Set the response as a series of pages - response = ( - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - resources.AdSenseLink(), - resources.AdSenseLink(), - ], - next_page_token="abc", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[], - next_page_token="def", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - ], - next_page_token="ghi", - ), - analytics_admin.ListAdSenseLinksResponse( - adsense_links=[ - resources.AdSenseLink(), - resources.AdSenseLink(), - ], - ), - ) - # Two responses for two calls - response = response + response - - # Wrap the values into proper Response objs - response = tuple( - analytics_admin.ListAdSenseLinksResponse.to_json(x) for x in response - ) - return_values = tuple(Response() for i in response) - for return_val, response_val in zip(return_values, response): - return_val._content = response_val.encode("UTF-8") - return_val.status_code = 200 - req.side_effect = return_values - - sample_request = {"parent": "properties/sample1"} - - pager = client.list_ad_sense_links(request=sample_request) - - results = list(pager) - assert len(results) == 6 - assert all(isinstance(i, resources.AdSenseLink) for i in results) - - pages = list(client.list_ad_sense_links(request=sample_request).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - @pytest.mark.parametrize( "request_type", [ - analytics_admin.GetEventCreateRuleRequest, + analytics_admin.GetRollupPropertySourceLinkRequest, dict, ], ) -def test_get_event_create_rule_rest(request_type): +def test_get_rollup_property_source_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" - } + request_init = {"name": "properties/sample1/rollupPropertySourceLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = event_create_and_edit.EventCreateRule( + return_value = resources.RollupPropertySourceLink( name="name_value", - destination_event="destination_event_value", - source_copy_parameters=True, + source_property="source_property_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = event_create_and_edit.EventCreateRule.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.RollupPropertySourceLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_event_create_rule(request) + response = client.get_rollup_property_source_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, event_create_and_edit.EventCreateRule) + assert isinstance(response, resources.RollupPropertySourceLink) assert response.name == "name_value" - assert response.destination_event == "destination_event_value" - assert response.source_copy_parameters is True + assert response.source_property == "source_property_value" -def test_get_event_create_rule_rest_required_fields( - request_type=analytics_admin.GetEventCreateRuleRequest, +def test_get_rollup_property_source_link_rest_required_fields( + request_type=analytics_admin.GetRollupPropertySourceLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -70344,7 +72607,7 @@ def test_get_event_create_rule_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_event_create_rule._get_unset_required_fields(jsonified_request) + ).get_rollup_property_source_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -70353,7 +72616,7 @@ def test_get_event_create_rule_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).get_event_create_rule._get_unset_required_fields(jsonified_request) + ).get_rollup_property_source_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -70367,7 +72630,7 @@ def test_get_event_create_rule_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = event_create_and_edit.EventCreateRule() + return_value = resources.RollupPropertySourceLink() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -70387,30 +72650,33 @@ def test_get_event_create_rule_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = event_create_and_edit.EventCreateRule.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.RollupPropertySourceLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.get_event_create_rule(request) + response = client.get_rollup_property_source_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_get_event_create_rule_rest_unset_required_fields(): +def test_get_rollup_property_source_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.get_event_create_rule._get_unset_required_fields({}) + unset_fields = transport.get_rollup_property_source_link._get_unset_required_fields( + {} + ) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_get_event_create_rule_rest_interceptors(null_interceptor): +def test_get_rollup_property_source_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -70423,14 +72689,16 @@ def test_get_event_create_rule_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_get_event_create_rule" + transports.AnalyticsAdminServiceRestInterceptor, + "post_get_rollup_property_source_link", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_get_event_create_rule" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_get_rollup_property_source_link", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.GetEventCreateRuleRequest.pb( - analytics_admin.GetEventCreateRuleRequest() + pb_message = analytics_admin.GetRollupPropertySourceLinkRequest.pb( + analytics_admin.GetRollupPropertySourceLinkRequest() ) transcode.return_value = { "method": "post", @@ -70442,19 +72710,19 @@ def test_get_event_create_rule_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = event_create_and_edit.EventCreateRule.to_json( - event_create_and_edit.EventCreateRule() + req.return_value._content = resources.RollupPropertySourceLink.to_json( + resources.RollupPropertySourceLink() ) - request = analytics_admin.GetEventCreateRuleRequest() + request = analytics_admin.GetRollupPropertySourceLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = event_create_and_edit.EventCreateRule() + post.return_value = resources.RollupPropertySourceLink() - client.get_event_create_rule( + client.get_rollup_property_source_link( request, metadata=[ ("key", "val"), @@ -70466,8 +72734,9 @@ def test_get_event_create_rule_rest_interceptors(null_interceptor): post.assert_called_once() -def test_get_event_create_rule_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.GetEventCreateRuleRequest +def test_get_rollup_property_source_link_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.GetRollupPropertySourceLinkRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -70475,9 +72744,7 @@ def test_get_event_create_rule_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" - } + request_init = {"name": "properties/sample1/rollupPropertySourceLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -70489,10 +72756,10 @@ def test_get_event_create_rule_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.get_event_create_rule(request) + client.get_rollup_property_source_link(request) -def test_get_event_create_rule_rest_flattened(): +def test_get_rollup_property_source_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -70501,11 +72768,11 @@ def test_get_event_create_rule_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = event_create_and_edit.EventCreateRule() + return_value = resources.RollupPropertySourceLink() # get arguments that satisfy an http rule for this method sample_request = { - "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" + "name": "properties/sample1/rollupPropertySourceLinks/sample2" } # get truthy value for each flattened field @@ -70517,25 +72784,26 @@ def test_get_event_create_rule_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = event_create_and_edit.EventCreateRule.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.RollupPropertySourceLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.get_event_create_rule(**mock_args) + client.get_rollup_property_source_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/dataStreams/*/eventCreateRules/*}" + "%s/v1alpha/{name=properties/*/rollupPropertySourceLinks/*}" % client.transport._host, args[1], ) -def test_get_event_create_rule_rest_flattened_error(transport: str = "rest"): +def test_get_rollup_property_source_link_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -70544,13 +72812,13 @@ def test_get_event_create_rule_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_event_create_rule( - analytics_admin.GetEventCreateRuleRequest(), + client.get_rollup_property_source_link( + analytics_admin.GetRollupPropertySourceLinkRequest(), name="name_value", ) -def test_get_event_create_rule_rest_error(): +def test_get_rollup_property_source_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -70559,44 +72827,47 @@ def test_get_event_create_rule_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.ListEventCreateRulesRequest, + analytics_admin.ListRollupPropertySourceLinksRequest, dict, ], ) -def test_list_event_create_rules_rest(request_type): +def test_list_rollup_property_source_links_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1/dataStreams/sample2"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListEventCreateRulesResponse( + return_value = analytics_admin.ListRollupPropertySourceLinksResponse( next_page_token="next_page_token_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListEventCreateRulesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListRollupPropertySourceLinksResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_event_create_rules(request) + response = client.list_rollup_property_source_links(request) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListEventCreateRulesPager) + assert isinstance(response, pagers.ListRollupPropertySourceLinksPager) assert response.next_page_token == "next_page_token_value" -def test_list_event_create_rules_rest_required_fields( - request_type=analytics_admin.ListEventCreateRulesRequest, +def test_list_rollup_property_source_links_rest_required_fields( + request_type=analytics_admin.ListRollupPropertySourceLinksRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -70616,7 +72887,7 @@ def test_list_event_create_rules_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_event_create_rules._get_unset_required_fields(jsonified_request) + ).list_rollup_property_source_links._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -70625,7 +72896,7 @@ def test_list_event_create_rules_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).list_event_create_rules._get_unset_required_fields(jsonified_request) + ).list_rollup_property_source_links._get_unset_required_fields(jsonified_request) # Check that path parameters and body parameters are not mixing in. assert not set(unset_fields) - set( ( @@ -70646,7 +72917,7 @@ def test_list_event_create_rules_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListEventCreateRulesResponse() + return_value = analytics_admin.ListRollupPropertySourceLinksResponse() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -70666,27 +72937,30 @@ def test_list_event_create_rules_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListEventCreateRulesResponse.pb( + # Convert return value to protobuf type + return_value = analytics_admin.ListRollupPropertySourceLinksResponse.pb( return_value ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.list_event_create_rules(request) + response = client.list_rollup_property_source_links(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_list_event_create_rules_rest_unset_required_fields(): +def test_list_rollup_property_source_links_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.list_event_create_rules._get_unset_required_fields({}) + unset_fields = ( + transport.list_rollup_property_source_links._get_unset_required_fields({}) + ) assert set(unset_fields) == ( set( ( @@ -70699,7 +72973,7 @@ def test_list_event_create_rules_rest_unset_required_fields(): @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_list_event_create_rules_rest_interceptors(null_interceptor): +def test_list_rollup_property_source_links_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -70712,14 +72986,16 @@ def test_list_event_create_rules_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_list_event_create_rules" + transports.AnalyticsAdminServiceRestInterceptor, + "post_list_rollup_property_source_links", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_list_event_create_rules" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_list_rollup_property_source_links", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.ListEventCreateRulesRequest.pb( - analytics_admin.ListEventCreateRulesRequest() + pb_message = analytics_admin.ListRollupPropertySourceLinksRequest.pb( + analytics_admin.ListRollupPropertySourceLinksRequest() ) transcode.return_value = { "method": "post", @@ -70732,20 +73008,20 @@ def test_list_event_create_rules_rest_interceptors(null_interceptor): req.return_value.status_code = 200 req.return_value.request = PreparedRequest() req.return_value._content = ( - analytics_admin.ListEventCreateRulesResponse.to_json( - analytics_admin.ListEventCreateRulesResponse() + analytics_admin.ListRollupPropertySourceLinksResponse.to_json( + analytics_admin.ListRollupPropertySourceLinksResponse() ) ) - request = analytics_admin.ListEventCreateRulesRequest() + request = analytics_admin.ListRollupPropertySourceLinksRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = analytics_admin.ListEventCreateRulesResponse() + post.return_value = analytics_admin.ListRollupPropertySourceLinksResponse() - client.list_event_create_rules( + client.list_rollup_property_source_links( request, metadata=[ ("key", "val"), @@ -70757,8 +73033,9 @@ def test_list_event_create_rules_rest_interceptors(null_interceptor): post.assert_called_once() -def test_list_event_create_rules_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.ListEventCreateRulesRequest +def test_list_rollup_property_source_links_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.ListRollupPropertySourceLinksRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -70766,7 +73043,7 @@ def test_list_event_create_rules_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1/dataStreams/sample2"} + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -70778,10 +73055,10 @@ def test_list_event_create_rules_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.list_event_create_rules(request) + client.list_rollup_property_source_links(request) -def test_list_event_create_rules_rest_flattened(): +def test_list_rollup_property_source_links_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -70790,10 +73067,10 @@ def test_list_event_create_rules_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = analytics_admin.ListEventCreateRulesResponse() + return_value = analytics_admin.ListRollupPropertySourceLinksResponse() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1/dataStreams/sample2"} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( @@ -70804,25 +73081,30 @@ def test_list_event_create_rules_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListEventCreateRulesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListRollupPropertySourceLinksResponse.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.list_event_create_rules(**mock_args) + client.list_rollup_property_source_links(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*/dataStreams/*}/eventCreateRules" + "%s/v1alpha/{parent=properties/*}/rollupPropertySourceLinks" % client.transport._host, args[1], ) -def test_list_event_create_rules_rest_flattened_error(transport: str = "rest"): +def test_list_rollup_property_source_links_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -70831,13 +73113,13 @@ def test_list_event_create_rules_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_event_create_rules( - analytics_admin.ListEventCreateRulesRequest(), + client.list_rollup_property_source_links( + analytics_admin.ListRollupPropertySourceLinksRequest(), parent="parent_value", ) -def test_list_event_create_rules_rest_pager(transport: str = "rest"): +def test_list_rollup_property_source_links_rest_pager(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -70849,28 +73131,28 @@ def test_list_event_create_rules_rest_pager(transport: str = "rest"): # with mock.patch.object(path_template, 'transcode') as transcode: # Set the response as a series of pages response = ( - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), ], next_page_token="abc", ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[], + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[], next_page_token="def", ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), ], next_page_token="ghi", ), - analytics_admin.ListEventCreateRulesResponse( - event_create_rules=[ - event_create_and_edit.EventCreateRule(), - event_create_and_edit.EventCreateRule(), + analytics_admin.ListRollupPropertySourceLinksResponse( + rollup_property_source_links=[ + resources.RollupPropertySourceLink(), + resources.RollupPropertySourceLink(), ], ), ) @@ -70879,7 +73161,8 @@ def test_list_event_create_rules_rest_pager(transport: str = "rest"): # Wrap the values into proper Response objs response = tuple( - analytics_admin.ListEventCreateRulesResponse.to_json(x) for x in response + analytics_admin.ListRollupPropertySourceLinksResponse.to_json(x) + for x in response ) return_values = tuple(Response() for i in response) for return_val, response_val in zip(return_values, response): @@ -70887,17 +73170,17 @@ def test_list_event_create_rules_rest_pager(transport: str = "rest"): return_val.status_code = 200 req.side_effect = return_values - sample_request = {"parent": "properties/sample1/dataStreams/sample2"} + sample_request = {"parent": "properties/sample1"} - pager = client.list_event_create_rules(request=sample_request) + pager = client.list_rollup_property_source_links(request=sample_request) results = list(pager) assert len(results) == 6 - assert all( - isinstance(i, event_create_and_edit.EventCreateRule) for i in results - ) + assert all(isinstance(i, resources.RollupPropertySourceLink) for i in results) - pages = list(client.list_event_create_rules(request=sample_request).pages) + pages = list( + client.list_rollup_property_source_links(request=sample_request).pages + ) for page_, token in zip(pages, ["abc", "def", "ghi", ""]): assert page_.raw_page.next_page_token == token @@ -70905,64 +73188,124 @@ def test_list_event_create_rules_rest_pager(transport: str = "rest"): @pytest.mark.parametrize( "request_type", [ - analytics_admin.CreateEventCreateRuleRequest, + analytics_admin.CreateRollupPropertySourceLinkRequest, dict, ], ) -def test_create_event_create_rule_rest(request_type): +def test_create_rollup_property_source_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1/dataStreams/sample2"} - request_init["event_create_rule"] = { + request_init = {"parent": "properties/sample1"} + request_init["rollup_property_source_link"] = { "name": "name_value", - "destination_event": "destination_event_value", - "event_conditions": [ - { - "field": "field_value", - "comparison_type": 1, - "value": "value_value", - "negated": True, - } - ], - "source_copy_parameters": True, - "parameter_mutations": [ - {"parameter": "parameter_value", "parameter_value": "parameter_value_value"} - ], + "source_property": "source_property_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateRollupPropertySourceLinkRequest.meta.fields[ + "rollup_property_source_link" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "rollup_property_source_link" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range( + 0, len(request_init["rollup_property_source_link"][field]) + ): + del request_init["rollup_property_source_link"][field][i][subfield] + else: + del request_init["rollup_property_source_link"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = event_create_and_edit.EventCreateRule( + return_value = resources.RollupPropertySourceLink( name="name_value", - destination_event="destination_event_value", - source_copy_parameters=True, + source_property="source_property_value", ) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = event_create_and_edit.EventCreateRule.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.RollupPropertySourceLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_event_create_rule(request) + response = client.create_rollup_property_source_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, event_create_and_edit.EventCreateRule) + assert isinstance(response, resources.RollupPropertySourceLink) assert response.name == "name_value" - assert response.destination_event == "destination_event_value" - assert response.source_copy_parameters is True + assert response.source_property == "source_property_value" -def test_create_event_create_rule_rest_required_fields( - request_type=analytics_admin.CreateEventCreateRuleRequest, +def test_create_rollup_property_source_link_rest_required_fields( + request_type=analytics_admin.CreateRollupPropertySourceLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -70982,7 +73325,7 @@ def test_create_event_create_rule_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_event_create_rule._get_unset_required_fields(jsonified_request) + ).create_rollup_property_source_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -70991,7 +73334,7 @@ def test_create_event_create_rule_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).create_event_create_rule._get_unset_required_fields(jsonified_request) + ).create_rollup_property_source_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -71005,7 +73348,7 @@ def test_create_event_create_rule_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = event_create_and_edit.EventCreateRule() + return_value = resources.RollupPropertySourceLink() # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -71026,38 +73369,41 @@ def test_create_event_create_rule_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = event_create_and_edit.EventCreateRule.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.RollupPropertySourceLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.create_event_create_rule(request) + response = client.create_rollup_property_source_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_create_event_create_rule_rest_unset_required_fields(): +def test_create_rollup_property_source_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.create_event_create_rule._get_unset_required_fields({}) + unset_fields = ( + transport.create_rollup_property_source_link._get_unset_required_fields({}) + ) assert set(unset_fields) == ( set(()) & set( ( "parent", - "eventCreateRule", + "rollupPropertySourceLink", ) ) ) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_create_event_create_rule_rest_interceptors(null_interceptor): +def test_create_rollup_property_source_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -71070,14 +73416,16 @@ def test_create_event_create_rule_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_create_event_create_rule" + transports.AnalyticsAdminServiceRestInterceptor, + "post_create_rollup_property_source_link", ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_create_event_create_rule" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_create_rollup_property_source_link", ) as pre: pre.assert_not_called() post.assert_not_called() - pb_message = analytics_admin.CreateEventCreateRuleRequest.pb( - analytics_admin.CreateEventCreateRuleRequest() + pb_message = analytics_admin.CreateRollupPropertySourceLinkRequest.pb( + analytics_admin.CreateRollupPropertySourceLinkRequest() ) transcode.return_value = { "method": "post", @@ -71089,19 +73437,19 @@ def test_create_event_create_rule_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = event_create_and_edit.EventCreateRule.to_json( - event_create_and_edit.EventCreateRule() + req.return_value._content = resources.RollupPropertySourceLink.to_json( + resources.RollupPropertySourceLink() ) - request = analytics_admin.CreateEventCreateRuleRequest() + request = analytics_admin.CreateRollupPropertySourceLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = event_create_and_edit.EventCreateRule() + post.return_value = resources.RollupPropertySourceLink() - client.create_event_create_rule( + client.create_rollup_property_source_link( request, metadata=[ ("key", "val"), @@ -71113,8 +73461,9 @@ def test_create_event_create_rule_rest_interceptors(null_interceptor): post.assert_called_once() -def test_create_event_create_rule_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.CreateEventCreateRuleRequest +def test_create_rollup_property_source_link_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.CreateRollupPropertySourceLinkRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -71122,23 +73471,7 @@ def test_create_event_create_rule_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = {"parent": "properties/sample1/dataStreams/sample2"} - request_init["event_create_rule"] = { - "name": "name_value", - "destination_event": "destination_event_value", - "event_conditions": [ - { - "field": "field_value", - "comparison_type": 1, - "value": "value_value", - "negated": True, - } - ], - "source_copy_parameters": True, - "parameter_mutations": [ - {"parameter": "parameter_value", "parameter_value": "parameter_value_value"} - ], - } + request_init = {"parent": "properties/sample1"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -71150,10 +73483,10 @@ def test_create_event_create_rule_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.create_event_create_rule(request) + client.create_rollup_property_source_link(request) -def test_create_event_create_rule_rest_flattened(): +def test_create_rollup_property_source_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -71162,40 +73495,45 @@ def test_create_event_create_rule_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = event_create_and_edit.EventCreateRule() + return_value = resources.RollupPropertySourceLink() # get arguments that satisfy an http rule for this method - sample_request = {"parent": "properties/sample1/dataStreams/sample2"} + sample_request = {"parent": "properties/sample1"} # get truthy value for each flattened field mock_args = dict( parent="parent_value", - event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + rollup_property_source_link=resources.RollupPropertySourceLink( + name="name_value" + ), ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = event_create_and_edit.EventCreateRule.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.RollupPropertySourceLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.create_event_create_rule(**mock_args) + client.create_rollup_property_source_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{parent=properties/*/dataStreams/*}/eventCreateRules" + "%s/v1alpha/{parent=properties/*}/rollupPropertySourceLinks" % client.transport._host, args[1], ) -def test_create_event_create_rule_rest_flattened_error(transport: str = "rest"): +def test_create_rollup_property_source_link_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -71204,14 +73542,16 @@ def test_create_event_create_rule_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_event_create_rule( - analytics_admin.CreateEventCreateRuleRequest(), + client.create_rollup_property_source_link( + analytics_admin.CreateRollupPropertySourceLinkRequest(), parent="parent_value", - event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), + rollup_property_source_link=resources.RollupPropertySourceLink( + name="name_value" + ), ) -def test_create_event_create_rule_rest_error(): +def test_create_rollup_property_source_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -71220,72 +73560,45 @@ def test_create_event_create_rule_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.UpdateEventCreateRuleRequest, + analytics_admin.DeleteRollupPropertySourceLinkRequest, dict, ], ) -def test_update_event_create_rule_rest(request_type): +def test_delete_rollup_property_source_link_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "event_create_rule": { - "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" - } - } - request_init["event_create_rule"] = { - "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3", - "destination_event": "destination_event_value", - "event_conditions": [ - { - "field": "field_value", - "comparison_type": 1, - "value": "value_value", - "negated": True, - } - ], - "source_copy_parameters": True, - "parameter_mutations": [ - {"parameter": "parameter_value", "parameter_value": "parameter_value_value"} - ], - } + request_init = {"name": "properties/sample1/rollupPropertySourceLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = event_create_and_edit.EventCreateRule( - name="name_value", - destination_event="destination_event_value", - source_copy_parameters=True, - ) + return_value = None # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = event_create_and_edit.EventCreateRule.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_event_create_rule(request) + response = client.delete_rollup_property_source_link(request) # Establish that the response is the type that we expect. - assert isinstance(response, event_create_and_edit.EventCreateRule) - assert response.name == "name_value" - assert response.destination_event == "destination_event_value" - assert response.source_copy_parameters is True + assert response is None -def test_update_event_create_rule_rest_required_fields( - request_type=analytics_admin.UpdateEventCreateRuleRequest, +def test_delete_rollup_property_source_link_rest_required_fields( + request_type=analytics_admin.DeleteRollupPropertySourceLinkRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport request_init = {} + request_init["name"] = "" request = request_type(**request_init) pb_request = request_type.pb(request) jsonified_request = json.loads( @@ -71300,19 +73613,21 @@ def test_update_event_create_rule_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_event_create_rule._get_unset_required_fields(jsonified_request) + ).delete_rollup_property_source_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present + jsonified_request["name"] = "name_value" + unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).update_event_create_rule._get_unset_required_fields(jsonified_request) - # Check that path parameters and body parameters are not mixing in. - assert not set(unset_fields) - set(("update_mask",)) + ).delete_rollup_property_source_link._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone + assert "name" in jsonified_request + assert jsonified_request["name"] == "name_value" client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -71321,7 +73636,7 @@ def test_update_event_create_rule_rest_required_fields( request = request_type(**request_init) # Designate an appropriate value for the returned response. - return_value = event_create_and_edit.EventCreateRule() + return_value = None # Mock the http request call within the method and fake a response. with mock.patch.object(Session, "request") as req: # We need to mock transcode() because providing default values @@ -71333,47 +73648,38 @@ def test_update_event_create_rule_rest_required_fields( pb_request = request_type.pb(request) transcode_result = { "uri": "v1/sample_method", - "method": "patch", + "method": "delete", "query_params": pb_request, } - transcode_result["body"] = pb_request transcode.return_value = transcode_result response_value = Response() response_value.status_code = 200 - - pb_return_value = event_create_and_edit.EventCreateRule.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.update_event_create_rule(request) + response = client.delete_rollup_property_source_link(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_update_event_create_rule_rest_unset_required_fields(): +def test_delete_rollup_property_source_link_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.update_event_create_rule._get_unset_required_fields({}) - assert set(unset_fields) == ( - set(("updateMask",)) - & set( - ( - "eventCreateRule", - "updateMask", - ) - ) + unset_fields = ( + transport.delete_rollup_property_source_link._get_unset_required_fields({}) ) + assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_update_event_create_rule_rest_interceptors(null_interceptor): +def test_delete_rollup_property_source_link_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -71386,14 +73692,12 @@ def test_update_event_create_rule_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "post_update_event_create_rule" - ) as post, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_update_event_create_rule" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_delete_rollup_property_source_link", ) as pre: pre.assert_not_called() - post.assert_not_called() - pb_message = analytics_admin.UpdateEventCreateRuleRequest.pb( - analytics_admin.UpdateEventCreateRuleRequest() + pb_message = analytics_admin.DeleteRollupPropertySourceLinkRequest.pb( + analytics_admin.DeleteRollupPropertySourceLinkRequest() ) transcode.return_value = { "method": "post", @@ -71405,19 +73709,15 @@ def test_update_event_create_rule_rest_interceptors(null_interceptor): req.return_value = Response() req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - req.return_value._content = event_create_and_edit.EventCreateRule.to_json( - event_create_and_edit.EventCreateRule() - ) - request = analytics_admin.UpdateEventCreateRuleRequest() + request = analytics_admin.DeleteRollupPropertySourceLinkRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - post.return_value = event_create_and_edit.EventCreateRule() - client.update_event_create_rule( + client.delete_rollup_property_source_link( request, metadata=[ ("key", "val"), @@ -71426,11 +73726,11 @@ def test_update_event_create_rule_rest_interceptors(null_interceptor): ) pre.assert_called_once() - post.assert_called_once() -def test_update_event_create_rule_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.UpdateEventCreateRuleRequest +def test_delete_rollup_property_source_link_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.DeleteRollupPropertySourceLinkRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -71438,27 +73738,7 @@ def test_update_event_create_rule_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "event_create_rule": { - "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" - } - } - request_init["event_create_rule"] = { - "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3", - "destination_event": "destination_event_value", - "event_conditions": [ - { - "field": "field_value", - "comparison_type": 1, - "value": "value_value", - "negated": True, - } - ], - "source_copy_parameters": True, - "parameter_mutations": [ - {"parameter": "parameter_value", "parameter_value": "parameter_value_value"} - ], - } + request_init = {"name": "properties/sample1/rollupPropertySourceLinks/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -71470,10 +73750,10 @@ def test_update_event_create_rule_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.update_event_create_rule(request) + client.delete_rollup_property_source_link(request) -def test_update_event_create_rule_rest_flattened(): +def test_delete_rollup_property_source_link_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -71482,44 +73762,42 @@ def test_update_event_create_rule_rest_flattened(): # Mock the http request call within the method and fake a response. with mock.patch.object(type(client.transport._session), "request") as req: # Designate an appropriate value for the returned response. - return_value = event_create_and_edit.EventCreateRule() + return_value = None # get arguments that satisfy an http rule for this method sample_request = { - "event_create_rule": { - "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" - } + "name": "properties/sample1/rollupPropertySourceLinks/sample2" } # get truthy value for each flattened field mock_args = dict( - event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + name="name_value", ) mock_args.update(sample_request) # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = event_create_and_edit.EventCreateRule.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = "" response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.update_event_create_rule(**mock_args) + client.delete_rollup_property_source_link(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{event_create_rule.name=properties/*/dataStreams/*/eventCreateRules/*}" + "%s/v1alpha/{name=properties/*/rollupPropertySourceLinks/*}" % client.transport._host, args[1], ) -def test_update_event_create_rule_rest_flattened_error(transport: str = "rest"): +def test_delete_rollup_property_source_link_rest_flattened_error( + transport: str = "rest", +): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -71528,14 +73806,13 @@ def test_update_event_create_rule_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_event_create_rule( - analytics_admin.UpdateEventCreateRuleRequest(), - event_create_rule=event_create_and_edit.EventCreateRule(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.delete_rollup_property_source_link( + analytics_admin.DeleteRollupPropertySourceLinkRequest(), + name="name_value", ) -def test_update_event_create_rule_rest_error(): +def test_delete_rollup_property_source_link_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -71544,20 +73821,238 @@ def test_update_event_create_rule_rest_error(): @pytest.mark.parametrize( "request_type", [ - analytics_admin.DeleteEventCreateRuleRequest, + analytics_admin.CreateSubpropertyRequest, dict, ], ) -def test_delete_event_create_rule_rest(request_type): +def test_create_subproperty_rest(request_type): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" - } + request_init = {} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = analytics_admin.CreateSubpropertyResponse() + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = analytics_admin.CreateSubpropertyResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.create_subproperty(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, analytics_admin.CreateSubpropertyResponse) + + +def test_create_subproperty_rest_required_fields( + request_type=analytics_admin.CreateSubpropertyRequest, +): + transport_class = transports.AnalyticsAdminServiceRestTransport + + request_init = {} + request_init["parent"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson( + pb_request, + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).create_subproperty._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["parent"] = "parent_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).create_subproperty._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" + + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = analytics_admin.CreateSubpropertyResponse() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": pb_request, + } + transcode_result["body"] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = analytics_admin.CreateSubpropertyResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.create_subproperty(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_create_subproperty_rest_unset_required_fields(): + transport = transports.AnalyticsAdminServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.create_subproperty._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "subproperty", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_create_subproperty_rest_interceptors(null_interceptor): + transport = transports.AnalyticsAdminServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.AnalyticsAdminServiceRestInterceptor(), + ) + client = AnalyticsAdminServiceClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "post_create_subproperty" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_create_subproperty" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = analytics_admin.CreateSubpropertyRequest.pb( + analytics_admin.CreateSubpropertyRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = analytics_admin.CreateSubpropertyResponse.to_json( + analytics_admin.CreateSubpropertyResponse() + ) + + request = analytics_admin.CreateSubpropertyRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = analytics_admin.CreateSubpropertyResponse() + + client.create_subproperty( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_create_subproperty_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.CreateSubpropertyRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.create_subproperty(request) + + +def test_create_subproperty_rest_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.DeleteSubpropertyEventFilterRequest, + dict, + ], +) +def test_delete_subproperty_event_filter_rest(request_type): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"name": "properties/sample1/subpropertyEventFilters/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -71572,14 +74067,14 @@ def test_delete_event_create_rule_rest(request_type): response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_event_create_rule(request) + response = client.delete_subproperty_event_filter(request) # Establish that the response is the type that we expect. assert response is None -def test_delete_event_create_rule_rest_required_fields( - request_type=analytics_admin.DeleteEventCreateRuleRequest, +def test_delete_subproperty_event_filter_rest_required_fields( + request_type=analytics_admin.DeleteSubpropertyEventFilterRequest, ): transport_class = transports.AnalyticsAdminServiceRestTransport @@ -71599,7 +74094,7 @@ def test_delete_event_create_rule_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_event_create_rule._get_unset_required_fields(jsonified_request) + ).delete_subproperty_event_filter._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with default values are now present @@ -71608,7 +74103,7 @@ def test_delete_event_create_rule_rest_required_fields( unset_fields = transport_class( credentials=ga_credentials.AnonymousCredentials() - ).delete_event_create_rule._get_unset_required_fields(jsonified_request) + ).delete_subproperty_event_filter._get_unset_required_fields(jsonified_request) jsonified_request.update(unset_fields) # verify required fields with non-default values are left alone @@ -71646,24 +74141,26 @@ def test_delete_event_create_rule_rest_required_fields( response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - response = client.delete_event_create_rule(request) + response = client.delete_subproperty_event_filter(request) expected_params = [("$alt", "json;enum-encoding=int")] actual_params = req.call_args.kwargs["params"] assert expected_params == actual_params -def test_delete_event_create_rule_rest_unset_required_fields(): +def test_delete_subproperty_event_filter_rest_unset_required_fields(): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials ) - unset_fields = transport.delete_event_create_rule._get_unset_required_fields({}) + unset_fields = transport.delete_subproperty_event_filter._get_unset_required_fields( + {} + ) assert set(unset_fields) == (set(()) & set(("name",))) @pytest.mark.parametrize("null_interceptor", [True, False]) -def test_delete_event_create_rule_rest_interceptors(null_interceptor): +def test_delete_subproperty_event_filter_rest_interceptors(null_interceptor): transport = transports.AnalyticsAdminServiceRestTransport( credentials=ga_credentials.AnonymousCredentials(), interceptor=None @@ -71676,11 +74173,12 @@ def test_delete_event_create_rule_rest_interceptors(null_interceptor): ) as req, mock.patch.object( path_template, "transcode" ) as transcode, mock.patch.object( - transports.AnalyticsAdminServiceRestInterceptor, "pre_delete_event_create_rule" + transports.AnalyticsAdminServiceRestInterceptor, + "pre_delete_subproperty_event_filter", ) as pre: pre.assert_not_called() - pb_message = analytics_admin.DeleteEventCreateRuleRequest.pb( - analytics_admin.DeleteEventCreateRuleRequest() + pb_message = analytics_admin.DeleteSubpropertyEventFilterRequest.pb( + analytics_admin.DeleteSubpropertyEventFilterRequest() ) transcode.return_value = { "method": "post", @@ -71693,14 +74191,14 @@ def test_delete_event_create_rule_rest_interceptors(null_interceptor): req.return_value.status_code = 200 req.return_value.request = PreparedRequest() - request = analytics_admin.DeleteEventCreateRuleRequest() + request = analytics_admin.DeleteSubpropertyEventFilterRequest() metadata = [ ("key", "val"), ("cephalopod", "squid"), ] pre.return_value = request, metadata - client.delete_event_create_rule( + client.delete_subproperty_event_filter( request, metadata=[ ("key", "val"), @@ -71711,8 +74209,9 @@ def test_delete_event_create_rule_rest_interceptors(null_interceptor): pre.assert_called_once() -def test_delete_event_create_rule_rest_bad_request( - transport: str = "rest", request_type=analytics_admin.DeleteEventCreateRuleRequest +def test_delete_subproperty_event_filter_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.DeleteSubpropertyEventFilterRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), @@ -71720,9 +74219,7 @@ def test_delete_event_create_rule_rest_bad_request( ) # send a request that will satisfy transcoding - request_init = { - "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" - } + request_init = {"name": "properties/sample1/subpropertyEventFilters/sample2"} request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -71734,10 +74231,10 @@ def test_delete_event_create_rule_rest_bad_request( response_value.status_code = 400 response_value.request = Request() req.return_value = response_value - client.delete_event_create_rule(request) + client.delete_subproperty_event_filter(request) -def test_delete_event_create_rule_rest_flattened(): +def test_delete_subproperty_event_filter_rest_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest", @@ -71749,9 +74246,7 @@ def test_delete_event_create_rule_rest_flattened(): return_value = None # get arguments that satisfy an http rule for this method - sample_request = { - "name": "properties/sample1/dataStreams/sample2/eventCreateRules/sample3" - } + sample_request = {"name": "properties/sample1/subpropertyEventFilters/sample2"} # get truthy value for each flattened field mock_args = dict( @@ -71766,20 +74261,20 @@ def test_delete_event_create_rule_rest_flattened(): response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value - client.delete_event_create_rule(**mock_args) + client.delete_subproperty_event_filter(**mock_args) # Establish that the underlying call was made with the expected # request object values. assert len(req.mock_calls) == 1 _, args, _ = req.mock_calls[0] assert path_template.validate( - "%s/v1alpha/{name=properties/*/dataStreams/*/eventCreateRules/*}" + "%s/v1alpha/{name=properties/*/subpropertyEventFilters/*}" % client.transport._host, args[1], ) -def test_delete_event_create_rule_rest_flattened_error(transport: str = "rest"): +def test_delete_subproperty_event_filter_rest_flattened_error(transport: str = "rest"): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -71788,13 +74283,407 @@ def test_delete_event_create_rule_rest_flattened_error(transport: str = "rest"): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.delete_event_create_rule( - analytics_admin.DeleteEventCreateRuleRequest(), + client.delete_subproperty_event_filter( + analytics_admin.DeleteSubpropertyEventFilterRequest(), name="name_value", ) -def test_delete_event_create_rule_rest_error(): +def test_delete_subproperty_event_filter_rest_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.CreateSubpropertyEventFilterRequest, + dict, + ], +) +def test_create_subproperty_event_filter_rest(request_type): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "properties/sample1"} + request_init["subproperty_event_filter"] = { + "name": "name_value", + "apply_to_property": "apply_to_property_value", + "filter_clauses": [ + { + "filter_clause_type": 1, + "filter_expression": { + "or_group": {"filter_expressions": {}}, + "not_expression": {}, + "filter_condition": { + "null_filter": True, + "string_filter": { + "match_type": 1, + "value": "value_value", + "case_sensitive": True, + }, + "field_name": "field_name_value", + }, + }, + } + ], + } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateSubpropertyEventFilterRequest.meta.fields[ + "subproperty_event_filter" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "subproperty_event_filter" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["subproperty_event_filter"][field])): + del request_init["subproperty_event_filter"][field][i][subfield] + else: + del request_init["subproperty_event_filter"][field][subfield] + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = gaa_subproperty_event_filter.SubpropertyEventFilter( + name="name_value", + apply_to_property="apply_to_property_value", + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = gaa_subproperty_event_filter.SubpropertyEventFilter.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.create_subproperty_event_filter(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, gaa_subproperty_event_filter.SubpropertyEventFilter) + assert response.name == "name_value" + assert response.apply_to_property == "apply_to_property_value" + + +def test_create_subproperty_event_filter_rest_required_fields( + request_type=analytics_admin.CreateSubpropertyEventFilterRequest, +): + transport_class = transports.AnalyticsAdminServiceRestTransport + + request_init = {} + request_init["parent"] = "" + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson( + pb_request, + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).create_subproperty_event_filter._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + jsonified_request["parent"] = "parent_value" + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).create_subproperty_event_filter._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + assert "parent" in jsonified_request + assert jsonified_request["parent"] == "parent_value" + + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = gaa_subproperty_event_filter.SubpropertyEventFilter() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "post", + "query_params": pb_request, + } + transcode_result["body"] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + # Convert return value to protobuf type + return_value = gaa_subproperty_event_filter.SubpropertyEventFilter.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.create_subproperty_event_filter(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_create_subproperty_event_filter_rest_unset_required_fields(): + transport = transports.AnalyticsAdminServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.create_subproperty_event_filter._get_unset_required_fields( + {} + ) + assert set(unset_fields) == ( + set(()) + & set( + ( + "parent", + "subpropertyEventFilter", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_create_subproperty_event_filter_rest_interceptors(null_interceptor): + transport = transports.AnalyticsAdminServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.AnalyticsAdminServiceRestInterceptor(), + ) + client = AnalyticsAdminServiceClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, + "post_create_subproperty_event_filter", + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, + "pre_create_subproperty_event_filter", + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = analytics_admin.CreateSubpropertyEventFilterRequest.pb( + analytics_admin.CreateSubpropertyEventFilterRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = ( + gaa_subproperty_event_filter.SubpropertyEventFilter.to_json( + gaa_subproperty_event_filter.SubpropertyEventFilter() + ) + ) + + request = analytics_admin.CreateSubpropertyEventFilterRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = gaa_subproperty_event_filter.SubpropertyEventFilter() + + client.create_subproperty_event_filter( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_create_subproperty_event_filter_rest_bad_request( + transport: str = "rest", + request_type=analytics_admin.CreateSubpropertyEventFilterRequest, +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = {"parent": "properties/sample1"} + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.create_subproperty_event_filter(request) + + +def test_create_subproperty_event_filter_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = gaa_subproperty_event_filter.SubpropertyEventFilter() + + # get arguments that satisfy an http rule for this method + sample_request = {"parent": "properties/sample1"} + + # get truthy value for each flattened field + mock_args = dict( + parent="parent_value", + subproperty_event_filter=gaa_subproperty_event_filter.SubpropertyEventFilter( + name="name_value" + ), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + # Convert return value to protobuf type + return_value = gaa_subproperty_event_filter.SubpropertyEventFilter.pb( + return_value + ) + json_return_value = json_format.MessageToJson(return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.create_subproperty_event_filter(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{parent=properties/*}/subpropertyEventFilters" + % client.transport._host, + args[1], + ) + + +def test_create_subproperty_event_filter_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_subproperty_event_filter( + analytics_admin.CreateSubpropertyEventFilterRequest(), + parent="parent_value", + subproperty_event_filter=gaa_subproperty_event_filter.SubpropertyEventFilter( + name="name_value" + ), + ) + + +def test_create_subproperty_event_filter_rest_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport="rest" ) @@ -71950,16 +74839,6 @@ def test_analytics_admin_service_base_transport(): "create_property", "delete_property", "update_property", - "get_user_link", - "batch_get_user_links", - "list_user_links", - "audit_user_links", - "create_user_link", - "batch_create_user_links", - "update_user_link", - "batch_update_user_links", - "delete_user_link", - "batch_delete_user_links", "create_firebase_link", "delete_firebase_link", "list_firebase_links", @@ -72067,6 +74946,16 @@ def test_analytics_admin_service_base_transport(): "create_event_create_rule", "update_event_create_rule", "delete_event_create_rule", + "update_data_redaction_settings", + "get_data_redaction_settings", + "create_rollup_property", + "get_rollup_property_source_link", + "list_rollup_property_source_links", + "create_rollup_property_source_link", + "delete_rollup_property_source_link", + "create_subproperty", + "delete_subproperty_event_filter", + "create_subproperty_event_filter", ) for method in methods: with pytest.raises(NotImplementedError): @@ -72382,36 +75271,6 @@ def test_analytics_admin_service_client_transport_session_collision(transport_na session1 = client1.transport.update_property._session session2 = client2.transport.update_property._session assert session1 != session2 - session1 = client1.transport.get_user_link._session - session2 = client2.transport.get_user_link._session - assert session1 != session2 - session1 = client1.transport.batch_get_user_links._session - session2 = client2.transport.batch_get_user_links._session - assert session1 != session2 - session1 = client1.transport.list_user_links._session - session2 = client2.transport.list_user_links._session - assert session1 != session2 - session1 = client1.transport.audit_user_links._session - session2 = client2.transport.audit_user_links._session - assert session1 != session2 - session1 = client1.transport.create_user_link._session - session2 = client2.transport.create_user_link._session - assert session1 != session2 - session1 = client1.transport.batch_create_user_links._session - session2 = client2.transport.batch_create_user_links._session - assert session1 != session2 - session1 = client1.transport.update_user_link._session - session2 = client2.transport.update_user_link._session - assert session1 != session2 - session1 = client1.transport.batch_update_user_links._session - session2 = client2.transport.batch_update_user_links._session - assert session1 != session2 - session1 = client1.transport.delete_user_link._session - session2 = client2.transport.delete_user_link._session - assert session1 != session2 - session1 = client1.transport.batch_delete_user_links._session - session2 = client2.transport.batch_delete_user_links._session - assert session1 != session2 session1 = client1.transport.create_firebase_link._session session2 = client2.transport.create_firebase_link._session assert session1 != session2 @@ -72753,6 +75612,36 @@ def test_analytics_admin_service_client_transport_session_collision(transport_na session1 = client1.transport.delete_event_create_rule._session session2 = client2.transport.delete_event_create_rule._session assert session1 != session2 + session1 = client1.transport.update_data_redaction_settings._session + session2 = client2.transport.update_data_redaction_settings._session + assert session1 != session2 + session1 = client1.transport.get_data_redaction_settings._session + session2 = client2.transport.get_data_redaction_settings._session + assert session1 != session2 + session1 = client1.transport.create_rollup_property._session + session2 = client2.transport.create_rollup_property._session + assert session1 != session2 + session1 = client1.transport.get_rollup_property_source_link._session + session2 = client2.transport.get_rollup_property_source_link._session + assert session1 != session2 + session1 = client1.transport.list_rollup_property_source_links._session + session2 = client2.transport.list_rollup_property_source_links._session + assert session1 != session2 + session1 = client1.transport.create_rollup_property_source_link._session + session2 = client2.transport.create_rollup_property_source_link._session + assert session1 != session2 + session1 = client1.transport.delete_rollup_property_source_link._session + session2 = client2.transport.delete_rollup_property_source_link._session + assert session1 != session2 + session1 = client1.transport.create_subproperty._session + session2 = client2.transport.create_subproperty._session + assert session1 != session2 + session1 = client1.transport.delete_subproperty_event_filter._session + session2 = client2.transport.delete_subproperty_event_filter._session + assert session1 != session2 + session1 = client1.transport.create_subproperty_event_filter._session + session2 = client2.transport.create_subproperty_event_filter._session + assert session1 != session2 def test_analytics_admin_service_grpc_transport_channel(): @@ -73129,8 +76018,35 @@ def test_parse_custom_metric_path(): assert expected == actual -def test_data_retention_settings_path(): +def test_data_redaction_settings_path(): property = "whelk" + data_stream = "octopus" + expected = ( + "properties/{property}/dataStreams/{data_stream}/dataRedactionSettings".format( + property=property, + data_stream=data_stream, + ) + ) + actual = AnalyticsAdminServiceClient.data_redaction_settings_path( + property, data_stream + ) + assert expected == actual + + +def test_parse_data_redaction_settings_path(): + expected = { + "property": "oyster", + "data_stream": "nudibranch", + } + path = AnalyticsAdminServiceClient.data_redaction_settings_path(**expected) + + # Check that the path construction is reversible. + actual = AnalyticsAdminServiceClient.parse_data_redaction_settings_path(path) + assert expected == actual + + +def test_data_retention_settings_path(): + property = "cuttlefish" expected = "properties/{property}/dataRetentionSettings".format( property=property, ) @@ -73140,7 +76056,7 @@ def test_data_retention_settings_path(): def test_parse_data_retention_settings_path(): expected = { - "property": "octopus", + "property": "mussel", } path = AnalyticsAdminServiceClient.data_retention_settings_path(**expected) @@ -73150,7 +76066,7 @@ def test_parse_data_retention_settings_path(): def test_data_sharing_settings_path(): - account = "oyster" + account = "winkle" expected = "accounts/{account}/dataSharingSettings".format( account=account, ) @@ -73160,7 +76076,7 @@ def test_data_sharing_settings_path(): def test_parse_data_sharing_settings_path(): expected = { - "account": "nudibranch", + "account": "nautilus", } path = AnalyticsAdminServiceClient.data_sharing_settings_path(**expected) @@ -73170,8 +76086,8 @@ def test_parse_data_sharing_settings_path(): def test_data_stream_path(): - property = "cuttlefish" - data_stream = "mussel" + property = "scallop" + data_stream = "abalone" expected = "properties/{property}/dataStreams/{data_stream}".format( property=property, data_stream=data_stream, @@ -73182,8 +76098,8 @@ def test_data_stream_path(): def test_parse_data_stream_path(): expected = { - "property": "winkle", - "data_stream": "nautilus", + "property": "squid", + "data_stream": "clam", } path = AnalyticsAdminServiceClient.data_stream_path(**expected) @@ -73193,8 +76109,8 @@ def test_parse_data_stream_path(): def test_display_video360_advertiser_link_path(): - property = "scallop" - display_video_360_advertiser_link = "abalone" + property = "whelk" + display_video_360_advertiser_link = "octopus" expected = "properties/{property}/displayVideo360AdvertiserLinks/{display_video_360_advertiser_link}".format( property=property, display_video_360_advertiser_link=display_video_360_advertiser_link, @@ -73207,8 +76123,8 @@ def test_display_video360_advertiser_link_path(): def test_parse_display_video360_advertiser_link_path(): expected = { - "property": "squid", - "display_video_360_advertiser_link": "clam", + "property": "oyster", + "display_video_360_advertiser_link": "nudibranch", } path = AnalyticsAdminServiceClient.display_video360_advertiser_link_path(**expected) @@ -73220,8 +76136,8 @@ def test_parse_display_video360_advertiser_link_path(): def test_display_video360_advertiser_link_proposal_path(): - property = "whelk" - display_video_360_advertiser_link_proposal = "octopus" + property = "cuttlefish" + display_video_360_advertiser_link_proposal = "mussel" expected = "properties/{property}/displayVideo360AdvertiserLinkProposals/{display_video_360_advertiser_link_proposal}".format( property=property, display_video_360_advertiser_link_proposal=display_video_360_advertiser_link_proposal, @@ -73234,8 +76150,8 @@ def test_display_video360_advertiser_link_proposal_path(): def test_parse_display_video360_advertiser_link_proposal_path(): expected = { - "property": "oyster", - "display_video_360_advertiser_link_proposal": "nudibranch", + "property": "winkle", + "display_video_360_advertiser_link_proposal": "nautilus", } path = AnalyticsAdminServiceClient.display_video360_advertiser_link_proposal_path( **expected @@ -73249,8 +76165,8 @@ def test_parse_display_video360_advertiser_link_proposal_path(): def test_enhanced_measurement_settings_path(): - property = "cuttlefish" - data_stream = "mussel" + property = "scallop" + data_stream = "abalone" expected = "properties/{property}/dataStreams/{data_stream}/enhancedMeasurementSettings".format( property=property, data_stream=data_stream, @@ -73263,8 +76179,8 @@ def test_enhanced_measurement_settings_path(): def test_parse_enhanced_measurement_settings_path(): expected = { - "property": "winkle", - "data_stream": "nautilus", + "property": "squid", + "data_stream": "clam", } path = AnalyticsAdminServiceClient.enhanced_measurement_settings_path(**expected) @@ -73274,9 +76190,9 @@ def test_parse_enhanced_measurement_settings_path(): def test_event_create_rule_path(): - property = "scallop" - data_stream = "abalone" - event_create_rule = "squid" + property = "whelk" + data_stream = "octopus" + event_create_rule = "oyster" expected = "properties/{property}/dataStreams/{data_stream}/eventCreateRules/{event_create_rule}".format( property=property, data_stream=data_stream, @@ -73290,9 +76206,9 @@ def test_event_create_rule_path(): def test_parse_event_create_rule_path(): expected = { - "property": "clam", - "data_stream": "whelk", - "event_create_rule": "octopus", + "property": "nudibranch", + "data_stream": "cuttlefish", + "event_create_rule": "mussel", } path = AnalyticsAdminServiceClient.event_create_rule_path(**expected) @@ -73302,8 +76218,8 @@ def test_parse_event_create_rule_path(): def test_expanded_data_set_path(): - property = "oyster" - expanded_data_set = "nudibranch" + property = "winkle" + expanded_data_set = "nautilus" expected = "properties/{property}/expandedDataSets/{expanded_data_set}".format( property=property, expanded_data_set=expanded_data_set, @@ -73316,8 +76232,8 @@ def test_expanded_data_set_path(): def test_parse_expanded_data_set_path(): expected = { - "property": "cuttlefish", - "expanded_data_set": "mussel", + "property": "scallop", + "expanded_data_set": "abalone", } path = AnalyticsAdminServiceClient.expanded_data_set_path(**expected) @@ -73327,8 +76243,8 @@ def test_parse_expanded_data_set_path(): def test_firebase_link_path(): - property = "winkle" - firebase_link = "nautilus" + property = "squid" + firebase_link = "clam" expected = "properties/{property}/firebaseLinks/{firebase_link}".format( property=property, firebase_link=firebase_link, @@ -73339,8 +76255,8 @@ def test_firebase_link_path(): def test_parse_firebase_link_path(): expected = { - "property": "scallop", - "firebase_link": "abalone", + "property": "whelk", + "firebase_link": "octopus", } path = AnalyticsAdminServiceClient.firebase_link_path(**expected) @@ -73350,8 +76266,8 @@ def test_parse_firebase_link_path(): def test_global_site_tag_path(): - property = "squid" - data_stream = "clam" + property = "oyster" + data_stream = "nudibranch" expected = "properties/{property}/dataStreams/{data_stream}/globalSiteTag".format( property=property, data_stream=data_stream, @@ -73362,8 +76278,8 @@ def test_global_site_tag_path(): def test_parse_global_site_tag_path(): expected = { - "property": "whelk", - "data_stream": "octopus", + "property": "cuttlefish", + "data_stream": "mussel", } path = AnalyticsAdminServiceClient.global_site_tag_path(**expected) @@ -73373,8 +76289,8 @@ def test_parse_global_site_tag_path(): def test_google_ads_link_path(): - property = "oyster" - google_ads_link = "nudibranch" + property = "winkle" + google_ads_link = "nautilus" expected = "properties/{property}/googleAdsLinks/{google_ads_link}".format( property=property, google_ads_link=google_ads_link, @@ -73385,8 +76301,8 @@ def test_google_ads_link_path(): def test_parse_google_ads_link_path(): expected = { - "property": "cuttlefish", - "google_ads_link": "mussel", + "property": "scallop", + "google_ads_link": "abalone", } path = AnalyticsAdminServiceClient.google_ads_link_path(**expected) @@ -73396,7 +76312,7 @@ def test_parse_google_ads_link_path(): def test_google_signals_settings_path(): - property = "winkle" + property = "squid" expected = "properties/{property}/googleSignalsSettings".format( property=property, ) @@ -73406,7 +76322,7 @@ def test_google_signals_settings_path(): def test_parse_google_signals_settings_path(): expected = { - "property": "nautilus", + "property": "clam", } path = AnalyticsAdminServiceClient.google_signals_settings_path(**expected) @@ -73416,9 +76332,9 @@ def test_parse_google_signals_settings_path(): def test_measurement_protocol_secret_path(): - property = "scallop" - data_stream = "abalone" - measurement_protocol_secret = "squid" + property = "whelk" + data_stream = "octopus" + measurement_protocol_secret = "oyster" expected = "properties/{property}/dataStreams/{data_stream}/measurementProtocolSecrets/{measurement_protocol_secret}".format( property=property, data_stream=data_stream, @@ -73432,9 +76348,9 @@ def test_measurement_protocol_secret_path(): def test_parse_measurement_protocol_secret_path(): expected = { - "property": "clam", - "data_stream": "whelk", - "measurement_protocol_secret": "octopus", + "property": "nudibranch", + "data_stream": "cuttlefish", + "measurement_protocol_secret": "mussel", } path = AnalyticsAdminServiceClient.measurement_protocol_secret_path(**expected) @@ -73444,7 +76360,7 @@ def test_parse_measurement_protocol_secret_path(): def test_property_path(): - property = "oyster" + property = "winkle" expected = "properties/{property}".format( property=property, ) @@ -73454,7 +76370,7 @@ def test_property_path(): def test_parse_property_path(): expected = { - "property": "nudibranch", + "property": "nautilus", } path = AnalyticsAdminServiceClient.property_path(**expected) @@ -73463,9 +76379,34 @@ def test_parse_property_path(): assert expected == actual +def test_rollup_property_source_link_path(): + property = "scallop" + rollup_property_source_link = "abalone" + expected = "properties/{property}/rollupPropertySourceLinks/{rollup_property_source_link}".format( + property=property, + rollup_property_source_link=rollup_property_source_link, + ) + actual = AnalyticsAdminServiceClient.rollup_property_source_link_path( + property, rollup_property_source_link + ) + assert expected == actual + + +def test_parse_rollup_property_source_link_path(): + expected = { + "property": "squid", + "rollup_property_source_link": "clam", + } + path = AnalyticsAdminServiceClient.rollup_property_source_link_path(**expected) + + # Check that the path construction is reversible. + actual = AnalyticsAdminServiceClient.parse_rollup_property_source_link_path(path) + assert expected == actual + + def test_search_ads360_link_path(): - property = "cuttlefish" - search_ads_360_link = "mussel" + property = "whelk" + search_ads_360_link = "octopus" expected = "properties/{property}/searchAds360Links/{search_ads_360_link}".format( property=property, search_ads_360_link=search_ads_360_link, @@ -73478,8 +76419,8 @@ def test_search_ads360_link_path(): def test_parse_search_ads360_link_path(): expected = { - "property": "winkle", - "search_ads_360_link": "nautilus", + "property": "oyster", + "search_ads_360_link": "nudibranch", } path = AnalyticsAdminServiceClient.search_ads360_link_path(**expected) @@ -73489,9 +76430,9 @@ def test_parse_search_ads360_link_path(): def test_sk_ad_network_conversion_value_schema_path(): - property = "scallop" - data_stream = "abalone" - skadnetwork_conversion_value_schema = "squid" + property = "cuttlefish" + data_stream = "mussel" + skadnetwork_conversion_value_schema = "winkle" expected = "properties/{property}/dataStreams/{data_stream}/sKAdNetworkConversionValueSchema/{skadnetwork_conversion_value_schema}".format( property=property, data_stream=data_stream, @@ -73505,9 +76446,9 @@ def test_sk_ad_network_conversion_value_schema_path(): def test_parse_sk_ad_network_conversion_value_schema_path(): expected = { - "property": "clam", - "data_stream": "whelk", - "skadnetwork_conversion_value_schema": "octopus", + "property": "nautilus", + "data_stream": "scallop", + "skadnetwork_conversion_value_schema": "abalone", } path = AnalyticsAdminServiceClient.sk_ad_network_conversion_value_schema_path( **expected @@ -73522,31 +76463,33 @@ def test_parse_sk_ad_network_conversion_value_schema_path(): assert expected == actual -def test_user_link_path(): - account = "oyster" - user_link = "nudibranch" - expected = "accounts/{account}/userLinks/{user_link}".format( - account=account, - user_link=user_link, +def test_subproperty_event_filter_path(): + property = "squid" + sub_property_event_filter = "clam" + expected = "properties/{property}/subpropertyEventFilters/{sub_property_event_filter}".format( + property=property, + sub_property_event_filter=sub_property_event_filter, + ) + actual = AnalyticsAdminServiceClient.subproperty_event_filter_path( + property, sub_property_event_filter ) - actual = AnalyticsAdminServiceClient.user_link_path(account, user_link) assert expected == actual -def test_parse_user_link_path(): +def test_parse_subproperty_event_filter_path(): expected = { - "account": "cuttlefish", - "user_link": "mussel", + "property": "whelk", + "sub_property_event_filter": "octopus", } - path = AnalyticsAdminServiceClient.user_link_path(**expected) + path = AnalyticsAdminServiceClient.subproperty_event_filter_path(**expected) # Check that the path construction is reversible. - actual = AnalyticsAdminServiceClient.parse_user_link_path(path) + actual = AnalyticsAdminServiceClient.parse_subproperty_event_filter_path(path) assert expected == actual def test_common_billing_account_path(): - billing_account = "winkle" + billing_account = "oyster" expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -73556,7 +76499,7 @@ def test_common_billing_account_path(): def test_parse_common_billing_account_path(): expected = { - "billing_account": "nautilus", + "billing_account": "nudibranch", } path = AnalyticsAdminServiceClient.common_billing_account_path(**expected) @@ -73566,7 +76509,7 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): - folder = "scallop" + folder = "cuttlefish" expected = "folders/{folder}".format( folder=folder, ) @@ -73576,7 +76519,7 @@ def test_common_folder_path(): def test_parse_common_folder_path(): expected = { - "folder": "abalone", + "folder": "mussel", } path = AnalyticsAdminServiceClient.common_folder_path(**expected) @@ -73586,7 +76529,7 @@ def test_parse_common_folder_path(): def test_common_organization_path(): - organization = "squid" + organization = "winkle" expected = "organizations/{organization}".format( organization=organization, ) @@ -73596,7 +76539,7 @@ def test_common_organization_path(): def test_parse_common_organization_path(): expected = { - "organization": "clam", + "organization": "nautilus", } path = AnalyticsAdminServiceClient.common_organization_path(**expected) @@ -73606,7 +76549,7 @@ def test_parse_common_organization_path(): def test_common_project_path(): - project = "whelk" + project = "scallop" expected = "projects/{project}".format( project=project, ) @@ -73616,7 +76559,7 @@ def test_common_project_path(): def test_parse_common_project_path(): expected = { - "project": "octopus", + "project": "abalone", } path = AnalyticsAdminServiceClient.common_project_path(**expected) @@ -73626,8 +76569,8 @@ def test_parse_common_project_path(): def test_common_location_path(): - project = "oyster" - location = "nudibranch" + project = "squid" + location = "clam" expected = "projects/{project}/locations/{location}".format( project=project, location=location, @@ -73638,8 +76581,8 @@ def test_common_location_path(): def test_parse_common_location_path(): expected = { - "project": "cuttlefish", - "location": "mussel", + "project": "whelk", + "location": "octopus", } path = AnalyticsAdminServiceClient.common_location_path(**expected) diff --git a/tests/unit/gapic/admin_v1beta/test_analytics_admin_service.py b/tests/unit/gapic/admin_v1beta/test_analytics_admin_service.py index 2ccc53ed..6e7a891c 100644 --- a/tests/unit/gapic/admin_v1beta/test_analytics_admin_service.py +++ b/tests/unit/gapic/admin_v1beta/test_analytics_admin_service.py @@ -14584,8 +14584,9 @@ def test_get_account_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Account.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Account.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -14663,8 +14664,9 @@ def test_get_account_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Account.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Account.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -14787,8 +14789,9 @@ def test_get_account_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Account.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Account.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -14851,8 +14854,9 @@ def test_list_accounts_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListAccountsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListAccountsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -15281,6 +15285,73 @@ def test_update_account_rest(request_type): "region_code": "region_code_value", "deleted": True, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateAccountRequest.meta.fields["account"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["account"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["account"][field])): + del request_init["account"][field][i][subfield] + else: + del request_init["account"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -15296,8 +15367,9 @@ def test_update_account_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Account.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Account.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -15373,8 +15445,9 @@ def test_update_account_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Account.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Account.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -15468,14 +15541,6 @@ def test_update_account_rest_bad_request( # send a request that will satisfy transcoding request_init = {"account": {"name": "accounts/sample1"}} - request_init["account"] = { - "name": "accounts/sample1", - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "display_name": "display_name_value", - "region_code": "region_code_value", - "deleted": True, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -15514,8 +15579,9 @@ def test_update_account_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Account.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Account.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -15579,10 +15645,9 @@ def test_provision_account_ticket_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ProvisionAccountTicketResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ProvisionAccountTicketResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -15709,8 +15774,9 @@ def test_list_account_summaries_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListAccountSummariesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListAccountSummariesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -15902,8 +15968,9 @@ def test_get_property_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -15986,8 +16053,9 @@ def test_get_property_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -16110,8 +16178,9 @@ def test_get_property_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -16174,8 +16243,9 @@ def test_list_properties_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListPropertiesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListPropertiesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -16262,8 +16332,9 @@ def test_list_properties_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListPropertiesResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListPropertiesResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -16474,6 +16545,73 @@ def test_create_property_rest(request_type): "expire_time": {}, "account": "account_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreatePropertyRequest.meta.fields["property"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["property"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["property"][field])): + del request_init["property"][field][i][subfield] + else: + del request_init["property"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -16494,8 +16632,9 @@ def test_create_property_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -16574,8 +16713,9 @@ def test_create_property_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -16661,21 +16801,6 @@ def test_create_property_rest_bad_request( # send a request that will satisfy transcoding request_init = {} - request_init["property"] = { - "name": "name_value", - "property_type": 1, - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "parent": "parent_value", - "display_name": "display_name_value", - "industry_category": 1, - "time_zone": "time_zone_value", - "currency_code": "currency_code_value", - "service_level": 1, - "delete_time": {}, - "expire_time": {}, - "account": "account_value", - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -16713,8 +16838,9 @@ def test_create_property_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -16785,8 +16911,9 @@ def test_delete_property_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -16869,8 +16996,9 @@ def test_delete_property_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -16993,8 +17121,9 @@ def test_delete_property_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -17060,6 +17189,73 @@ def test_update_property_rest(request_type): "expire_time": {}, "account": "account_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdatePropertyRequest.meta.fields["property"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["property"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["property"][field])): + del request_init["property"][field][i][subfield] + else: + del request_init["property"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -17080,8 +17276,9 @@ def test_update_property_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -17162,8 +17359,9 @@ def test_update_property_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -17257,21 +17455,6 @@ def test_update_property_rest_bad_request( # send a request that will satisfy transcoding request_init = {"property": {"name": "properties/sample1"}} - request_init["property"] = { - "name": "properties/sample1", - "property_type": 1, - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "parent": "parent_value", - "display_name": "display_name_value", - "industry_category": 1, - "time_zone": "time_zone_value", - "currency_code": "currency_code_value", - "service_level": 1, - "delete_time": {}, - "expire_time": {}, - "account": "account_value", - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -17310,8 +17493,9 @@ def test_update_property_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.Property.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.Property.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -17368,6 +17552,73 @@ def test_create_firebase_link_rest(request_type): "project": "project_value", "create_time": {"seconds": 751, "nanos": 543}, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateFirebaseLinkRequest.meta.fields["firebase_link"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["firebase_link"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["firebase_link"][field])): + del request_init["firebase_link"][field][i][subfield] + else: + del request_init["firebase_link"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -17381,8 +17632,9 @@ def test_create_firebase_link_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.FirebaseLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.FirebaseLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -17459,8 +17711,9 @@ def test_create_firebase_link_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.FirebaseLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.FirebaseLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -17556,11 +17809,6 @@ def test_create_firebase_link_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "properties/sample1"} - request_init["firebase_link"] = { - "name": "name_value", - "project": "project_value", - "create_time": {"seconds": 751, "nanos": 543}, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -17599,8 +17847,9 @@ def test_create_firebase_link_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.FirebaseLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.FirebaseLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -17917,8 +18166,9 @@ def test_list_firebase_links_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListFirebaseLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListFirebaseLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -18000,8 +18250,9 @@ def test_list_firebase_links_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListFirebaseLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListFirebaseLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -18134,8 +18385,9 @@ def test_list_firebase_links_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListFirebaseLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListFirebaseLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -18253,6 +18505,75 @@ def test_create_google_ads_link_rest(request_type): "update_time": {}, "creator_email_address": "creator_email_address_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateGoogleAdsLinkRequest.meta.fields[ + "google_ads_link" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["google_ads_link"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["google_ads_link"][field])): + del request_init["google_ads_link"][field][i][subfield] + else: + del request_init["google_ads_link"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -18268,8 +18589,9 @@ def test_create_google_ads_link_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleAdsLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleAdsLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -18348,8 +18670,9 @@ def test_create_google_ads_link_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleAdsLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleAdsLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -18445,15 +18768,6 @@ def test_create_google_ads_link_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "properties/sample1"} - request_init["google_ads_link"] = { - "name": "name_value", - "customer_id": "customer_id_value", - "can_manage_clients": True, - "ads_personalization_enabled": {"value": True}, - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "creator_email_address": "creator_email_address_value", - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -18492,8 +18806,9 @@ def test_create_google_ads_link_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleAdsLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleAdsLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -18557,6 +18872,75 @@ def test_update_google_ads_link_rest(request_type): "update_time": {}, "creator_email_address": "creator_email_address_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateGoogleAdsLinkRequest.meta.fields[ + "google_ads_link" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["google_ads_link"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["google_ads_link"][field])): + del request_init["google_ads_link"][field][i][subfield] + else: + del request_init["google_ads_link"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -18572,8 +18956,9 @@ def test_update_google_ads_link_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleAdsLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleAdsLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -18649,8 +19034,9 @@ def test_update_google_ads_link_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleAdsLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleAdsLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -18740,15 +19126,6 @@ def test_update_google_ads_link_rest_bad_request( request_init = { "google_ads_link": {"name": "properties/sample1/googleAdsLinks/sample2"} } - request_init["google_ads_link"] = { - "name": "properties/sample1/googleAdsLinks/sample2", - "customer_id": "customer_id_value", - "can_manage_clients": True, - "ads_personalization_enabled": {"value": True}, - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - "creator_email_address": "creator_email_address_value", - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -18789,8 +19166,9 @@ def test_update_google_ads_link_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.GoogleAdsLink.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.GoogleAdsLink.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -19108,8 +19486,9 @@ def test_list_google_ads_links_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListGoogleAdsLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListGoogleAdsLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -19191,10 +19570,9 @@ def test_list_google_ads_links_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListGoogleAdsLinksResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListGoogleAdsLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -19327,8 +19705,9 @@ def test_list_google_ads_links_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListGoogleAdsLinksResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListGoogleAdsLinksResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -19454,8 +19833,9 @@ def test_get_data_sharing_settings_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataSharingSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataSharingSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -19535,8 +19915,9 @@ def test_get_data_sharing_settings_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataSharingSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataSharingSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -19662,8 +20043,9 @@ def test_get_data_sharing_settings_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataSharingSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataSharingSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -19731,8 +20113,9 @@ def test_get_measurement_protocol_secret_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -19809,8 +20192,9 @@ def test_get_measurement_protocol_secret_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -19944,8 +20328,9 @@ def test_get_measurement_protocol_secret_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -20010,10 +20395,11 @@ def test_list_measurement_protocol_secrets_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListMeasurementProtocolSecretsResponse.pb( + # Convert return value to protobuf type + return_value = analytics_admin.ListMeasurementProtocolSecretsResponse.pb( return_value ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -20095,10 +20481,11 @@ def test_list_measurement_protocol_secrets_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListMeasurementProtocolSecretsResponse.pb( + # Convert return value to protobuf type + return_value = analytics_admin.ListMeasurementProtocolSecretsResponse.pb( return_value ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -20238,10 +20625,11 @@ def test_list_measurement_protocol_secrets_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListMeasurementProtocolSecretsResponse.pb( + # Convert return value to protobuf type + return_value = analytics_admin.ListMeasurementProtocolSecretsResponse.pb( return_value ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -20361,6 +20749,79 @@ def test_create_measurement_protocol_secret_rest(request_type): "display_name": "display_name_value", "secret_value": "secret_value_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateMeasurementProtocolSecretRequest.meta.fields[ + "measurement_protocol_secret" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "measurement_protocol_secret" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range( + 0, len(request_init["measurement_protocol_secret"][field]) + ): + del request_init["measurement_protocol_secret"][field][i][subfield] + else: + del request_init["measurement_protocol_secret"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -20375,8 +20836,9 @@ def test_create_measurement_protocol_secret_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -20454,8 +20916,9 @@ def test_create_measurement_protocol_secret_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -20556,11 +21019,6 @@ def test_create_measurement_protocol_secret_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "properties/sample1/dataStreams/sample2"} - request_init["measurement_protocol_secret"] = { - "name": "name_value", - "display_name": "display_name_value", - "secret_value": "secret_value_value", - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -20601,8 +21059,9 @@ def test_create_measurement_protocol_secret_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -20934,6 +21393,79 @@ def test_update_measurement_protocol_secret_rest(request_type): "display_name": "display_name_value", "secret_value": "secret_value_value", } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateMeasurementProtocolSecretRequest.meta.fields[ + "measurement_protocol_secret" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "measurement_protocol_secret" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range( + 0, len(request_init["measurement_protocol_secret"][field]) + ): + del request_init["measurement_protocol_secret"][field][i][subfield] + else: + del request_init["measurement_protocol_secret"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -20948,8 +21480,9 @@ def test_update_measurement_protocol_secret_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -21024,8 +21557,9 @@ def test_update_measurement_protocol_secret_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -21130,11 +21664,6 @@ def test_update_measurement_protocol_secret_rest_bad_request( "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3" } } - request_init["measurement_protocol_secret"] = { - "name": "properties/sample1/dataStreams/sample2/measurementProtocolSecrets/sample3", - "display_name": "display_name_value", - "secret_value": "secret_value_value", - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -21179,8 +21708,9 @@ def test_update_measurement_protocol_secret_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.MeasurementProtocolSecret.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.MeasurementProtocolSecret.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -21248,10 +21778,11 @@ def test_acknowledge_user_data_collection_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.AcknowledgeUserDataCollectionResponse.pb( + # Convert return value to protobuf type + return_value = analytics_admin.AcknowledgeUserDataCollectionResponse.pb( return_value ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -21330,10 +21861,11 @@ def test_acknowledge_user_data_collection_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.AcknowledgeUserDataCollectionResponse.pb( + # Convert return value to protobuf type + return_value = analytics_admin.AcknowledgeUserDataCollectionResponse.pb( return_value ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -21483,10 +22015,11 @@ def test_search_change_history_events_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.SearchChangeHistoryEventsResponse.pb( + # Convert return value to protobuf type + return_value = analytics_admin.SearchChangeHistoryEventsResponse.pb( return_value ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -21562,10 +22095,11 @@ def test_search_change_history_events_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.SearchChangeHistoryEventsResponse.pb( + # Convert return value to protobuf type + return_value = analytics_admin.SearchChangeHistoryEventsResponse.pb( return_value ) - json_return_value = json_format.MessageToJson(pb_return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -21759,6 +22293,75 @@ def test_create_conversion_event_rest(request_type): "custom": True, "counting_method": 1, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateConversionEventRequest.meta.fields[ + "conversion_event" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["conversion_event"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["conversion_event"][field])): + del request_init["conversion_event"][field][i][subfield] + else: + del request_init["conversion_event"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -21775,8 +22378,9 @@ def test_create_conversion_event_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -21859,8 +22463,9 @@ def test_create_conversion_event_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -21956,14 +22561,6 @@ def test_create_conversion_event_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "properties/sample1"} - request_init["conversion_event"] = { - "name": "name_value", - "event_name": "event_name_value", - "create_time": {"seconds": 751, "nanos": 543}, - "deletable": True, - "custom": True, - "counting_method": 1, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -22002,8 +22599,9 @@ def test_create_conversion_event_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -22066,6 +22664,75 @@ def test_update_conversion_event_rest(request_type): "custom": True, "counting_method": 1, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateConversionEventRequest.meta.fields[ + "conversion_event" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["conversion_event"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["conversion_event"][field])): + del request_init["conversion_event"][field][i][subfield] + else: + del request_init["conversion_event"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -22082,8 +22749,9 @@ def test_update_conversion_event_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -22163,8 +22831,9 @@ def test_update_conversion_event_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -22262,14 +22931,6 @@ def test_update_conversion_event_rest_bad_request( request_init = { "conversion_event": {"name": "properties/sample1/conversionEvents/sample2"} } - request_init["conversion_event"] = { - "name": "properties/sample1/conversionEvents/sample2", - "event_name": "event_name_value", - "create_time": {"seconds": 751, "nanos": 543}, - "deletable": True, - "custom": True, - "counting_method": 1, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -22310,8 +22971,9 @@ def test_update_conversion_event_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -22381,8 +23043,9 @@ def test_get_conversion_event_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -22464,8 +23127,9 @@ def test_get_conversion_event_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -22590,8 +23254,9 @@ def test_get_conversion_event_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.ConversionEvent.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -22907,8 +23572,9 @@ def test_list_conversion_events_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListConversionEventsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListConversionEventsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -22990,10 +23656,9 @@ def test_list_conversion_events_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListConversionEventsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListConversionEventsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -23128,8 +23793,9 @@ def test_list_conversion_events_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListConversionEventsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListConversionEventsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -23246,6 +23912,75 @@ def test_create_custom_dimension_rest(request_type): "scope": 1, "disallow_ads_personalization": True, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateCustomDimensionRequest.meta.fields[ + "custom_dimension" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["custom_dimension"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["custom_dimension"][field])): + del request_init["custom_dimension"][field][i][subfield] + else: + del request_init["custom_dimension"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -23263,8 +23998,9 @@ def test_create_custom_dimension_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -23345,8 +24081,9 @@ def test_create_custom_dimension_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -23442,14 +24179,6 @@ def test_create_custom_dimension_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "properties/sample1"} - request_init["custom_dimension"] = { - "name": "name_value", - "parameter_name": "parameter_name_value", - "display_name": "display_name_value", - "description": "description_value", - "scope": 1, - "disallow_ads_personalization": True, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -23488,8 +24217,9 @@ def test_create_custom_dimension_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -23552,6 +24282,75 @@ def test_update_custom_dimension_rest(request_type): "scope": 1, "disallow_ads_personalization": True, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateCustomDimensionRequest.meta.fields[ + "custom_dimension" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["custom_dimension"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["custom_dimension"][field])): + del request_init["custom_dimension"][field][i][subfield] + else: + del request_init["custom_dimension"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -23569,8 +24368,9 @@ def test_update_custom_dimension_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -23648,8 +24448,9 @@ def test_update_custom_dimension_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -23739,14 +24540,6 @@ def test_update_custom_dimension_rest_bad_request( request_init = { "custom_dimension": {"name": "properties/sample1/customDimensions/sample2"} } - request_init["custom_dimension"] = { - "name": "properties/sample1/customDimensions/sample2", - "parameter_name": "parameter_name_value", - "display_name": "display_name_value", - "description": "description_value", - "scope": 1, - "disallow_ads_personalization": True, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -23787,8 +24580,9 @@ def test_update_custom_dimension_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -23854,8 +24648,9 @@ def test_list_custom_dimensions_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListCustomDimensionsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListCustomDimensionsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -23937,10 +24732,9 @@ def test_list_custom_dimensions_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListCustomDimensionsResponse.pb( - return_value - ) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListCustomDimensionsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -24075,8 +24869,9 @@ def test_list_custom_dimensions_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListCustomDimensionsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListCustomDimensionsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -24456,8 +25251,9 @@ def test_get_custom_dimension_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -24537,8 +25333,9 @@ def test_get_custom_dimension_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -24663,8 +25460,9 @@ def test_get_custom_dimension_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomDimension.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomDimension.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -24725,6 +25523,73 @@ def test_create_custom_metric_rest(request_type): "scope": 1, "restricted_metric_type": [1], } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateCustomMetricRequest.meta.fields["custom_metric"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["custom_metric"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["custom_metric"][field])): + del request_init["custom_metric"][field][i][subfield] + else: + del request_init["custom_metric"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -24745,8 +25610,9 @@ def test_create_custom_metric_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -24830,8 +25696,9 @@ def test_create_custom_metric_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -24927,15 +25794,6 @@ def test_create_custom_metric_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "properties/sample1"} - request_init["custom_metric"] = { - "name": "name_value", - "parameter_name": "parameter_name_value", - "display_name": "display_name_value", - "description": "description_value", - "measurement_unit": 1, - "scope": 1, - "restricted_metric_type": [1], - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -24974,8 +25832,9 @@ def test_create_custom_metric_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -25039,6 +25898,73 @@ def test_update_custom_metric_rest(request_type): "scope": 1, "restricted_metric_type": [1], } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateCustomMetricRequest.meta.fields["custom_metric"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["custom_metric"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["custom_metric"][field])): + del request_init["custom_metric"][field][i][subfield] + else: + del request_init["custom_metric"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -25059,8 +25985,9 @@ def test_update_custom_metric_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -25141,8 +26068,9 @@ def test_update_custom_metric_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -25232,15 +26160,6 @@ def test_update_custom_metric_rest_bad_request( request_init = { "custom_metric": {"name": "properties/sample1/customMetrics/sample2"} } - request_init["custom_metric"] = { - "name": "properties/sample1/customMetrics/sample2", - "parameter_name": "parameter_name_value", - "display_name": "display_name_value", - "description": "description_value", - "measurement_unit": 1, - "scope": 1, - "restricted_metric_type": [1], - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -25281,8 +26200,9 @@ def test_update_custom_metric_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -25348,8 +26268,9 @@ def test_list_custom_metrics_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListCustomMetricsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListCustomMetricsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -25431,8 +26352,9 @@ def test_list_custom_metrics_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListCustomMetricsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListCustomMetricsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -25565,8 +26487,9 @@ def test_list_custom_metrics_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListCustomMetricsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListCustomMetricsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -25949,8 +26872,9 @@ def test_get_custom_metric_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -26033,8 +26957,9 @@ def test_get_custom_metric_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -26159,8 +27084,9 @@ def test_get_custom_metric_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.CustomMetric.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.CustomMetric.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -26226,8 +27152,9 @@ def test_get_data_retention_settings_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataRetentionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataRetentionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -26307,8 +27234,9 @@ def test_get_data_retention_settings_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataRetentionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataRetentionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -26436,8 +27364,9 @@ def test_get_data_retention_settings_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataRetentionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataRetentionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -26497,6 +27426,77 @@ def test_update_data_retention_settings_rest(request_type): "event_data_retention": 1, "reset_user_data_on_new_activity": True, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateDataRetentionSettingsRequest.meta.fields[ + "data_retention_settings" + ] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init[ + "data_retention_settings" + ].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["data_retention_settings"][field])): + del request_init["data_retention_settings"][field][i][subfield] + else: + del request_init["data_retention_settings"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -26511,8 +27511,9 @@ def test_update_data_retention_settings_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataRetentionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataRetentionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -26590,8 +27591,9 @@ def test_update_data_retention_settings_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataRetentionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataRetentionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -26694,11 +27696,6 @@ def test_update_data_retention_settings_rest_bad_request( request_init = { "data_retention_settings": {"name": "properties/sample1/dataRetentionSettings"} } - request_init["data_retention_settings"] = { - "name": "properties/sample1/dataRetentionSettings", - "event_data_retention": 1, - "reset_user_data_on_new_activity": True, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -26741,8 +27738,9 @@ def test_update_data_retention_settings_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataRetentionSettings.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataRetentionSettings.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -26816,6 +27814,73 @@ def test_create_data_stream_rest(request_type): "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.CreateDataStreamRequest.meta.fields["data_stream"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["data_stream"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["data_stream"][field])): + del request_init["data_stream"][field][i][subfield] + else: + del request_init["data_stream"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -26830,8 +27895,9 @@ def test_create_data_stream_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -26909,8 +27975,9 @@ def test_create_data_stream_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -27004,26 +28071,6 @@ def test_create_data_stream_rest_bad_request( # send a request that will satisfy transcoding request_init = {"parent": "properties/sample1"} - request_init["data_stream"] = { - "web_stream_data": { - "measurement_id": "measurement_id_value", - "firebase_app_id": "firebase_app_id_value", - "default_uri": "default_uri_value", - }, - "android_app_stream_data": { - "firebase_app_id": "firebase_app_id_value", - "package_name": "package_name_value", - }, - "ios_app_stream_data": { - "firebase_app_id": "firebase_app_id_value", - "bundle_id": "bundle_id_value", - }, - "name": "name_value", - "type_": 1, - "display_name": "display_name_value", - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -27066,8 +28113,9 @@ def test_create_data_stream_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -27396,6 +28444,73 @@ def test_update_data_stream_rest(request_type): "create_time": {"seconds": 751, "nanos": 543}, "update_time": {}, } + # The version of a generated dependency at test runtime may differ from the version used during generation. + # Delete any fields which are not present in the current runtime dependency + # See https://github.com/googleapis/gapic-generator-python/issues/1748 + + # Determine if the message type is proto-plus or protobuf + test_field = analytics_admin.UpdateDataStreamRequest.meta.fields["data_stream"] + + def get_message_fields(field): + # Given a field which is a message (composite type), return a list with + # all the fields of the message. + # If the field is not a composite type, return an empty list. + message_fields = [] + + if hasattr(field, "message") and field.message: + is_field_type_proto_plus_type = not hasattr(field.message, "DESCRIPTOR") + + if is_field_type_proto_plus_type: + message_fields = field.message.meta.fields.values() + # Add `# pragma: NO COVER` because there may not be any `*_pb2` field types + else: # pragma: NO COVER + message_fields = field.message.DESCRIPTOR.fields + return message_fields + + runtime_nested_fields = [ + (field.name, nested_field.name) + for field in get_message_fields(test_field) + for nested_field in get_message_fields(field) + ] + + subfields_not_in_runtime = [] + + # For each item in the sample request, create a list of sub fields which are not present at runtime + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for field, value in request_init["data_stream"].items(): # pragma: NO COVER + result = None + is_repeated = False + # For repeated fields + if isinstance(value, list) and len(value): + is_repeated = True + result = value[0] + # For fields where the type is another message + if isinstance(value, dict): + result = value + + if result and hasattr(result, "keys"): + for subfield in result.keys(): + if (field, subfield) not in runtime_nested_fields: + subfields_not_in_runtime.append( + { + "field": field, + "subfield": subfield, + "is_repeated": is_repeated, + } + ) + + # Remove fields from the sample request which are not present in the runtime version of the dependency + # Add `# pragma: NO COVER` because this test code will not run if all subfields are present at runtime + for subfield_to_delete in subfields_not_in_runtime: # pragma: NO COVER + field = subfield_to_delete.get("field") + field_repeated = subfield_to_delete.get("is_repeated") + subfield = subfield_to_delete.get("subfield") + if subfield: + if field_repeated: + for i in range(0, len(request_init["data_stream"][field])): + del request_init["data_stream"][field][i][subfield] + else: + del request_init["data_stream"][field][subfield] request = request_type(**request_init) # Mock the http request call within the method and fake a response. @@ -27410,8 +28525,9 @@ def test_update_data_stream_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -27486,8 +28602,9 @@ def test_update_data_stream_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -27573,26 +28690,6 @@ def test_update_data_stream_rest_bad_request( # send a request that will satisfy transcoding request_init = {"data_stream": {"name": "properties/sample1/dataStreams/sample2"}} - request_init["data_stream"] = { - "web_stream_data": { - "measurement_id": "measurement_id_value", - "firebase_app_id": "firebase_app_id_value", - "default_uri": "default_uri_value", - }, - "android_app_stream_data": { - "firebase_app_id": "firebase_app_id_value", - "package_name": "package_name_value", - }, - "ios_app_stream_data": { - "firebase_app_id": "firebase_app_id_value", - "bundle_id": "bundle_id_value", - }, - "name": "properties/sample1/dataStreams/sample2", - "type_": 1, - "display_name": "display_name_value", - "create_time": {"seconds": 751, "nanos": 543}, - "update_time": {}, - } request = request_type(**request_init) # Mock the http request call within the method and fake a BadRequest error. @@ -27637,8 +28734,9 @@ def test_update_data_stream_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -27708,8 +28806,9 @@ def test_list_data_streams_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListDataStreamsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListDataStreamsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -27791,8 +28890,9 @@ def test_list_data_streams_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListDataStreamsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListDataStreamsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -27925,8 +29025,9 @@ def test_list_data_streams_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.ListDataStreamsResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.ListDataStreamsResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -28049,8 +29150,9 @@ def test_get_data_stream_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -28127,8 +29229,9 @@ def test_get_data_stream_rest_required_fields( response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -28251,8 +29354,9 @@ def test_get_data_stream_rest_flattened(): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = resources.DataStream.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = resources.DataStream.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value @@ -28316,8 +29420,9 @@ def test_run_access_report_rest(request_type): # Wrap the value into a proper Response obj response_value = Response() response_value.status_code = 200 - pb_return_value = analytics_admin.RunAccessReportResponse.pb(return_value) - json_return_value = json_format.MessageToJson(pb_return_value) + # Convert return value to protobuf type + return_value = analytics_admin.RunAccessReportResponse.pb(return_value) + json_return_value = json_format.MessageToJson(return_value) response_value._content = json_return_value.encode("UTF-8") req.return_value = response_value