From fbf86a8db2aa59234030e87a19c70e3884278a48 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 24 Jun 2022 20:04:14 +0000 Subject: [PATCH] chore: update gapic-generator-java (#402) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 454939894 Source-Link: https://github.com/googleapis/googleapis/commit/519ca445965b3f94f9e32ae511c154488d2054e9 Source-Link: https://github.com/googleapis/googleapis-gen/commit/fc639d21a7cbc30aa0a9b862586942a0fb46c5c8 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZmM2MzlkMjFhN2NiYzMwYWEwYTliODYyNTg2OTQyYTBmYjQ2YzVjOCJ9 feat: Add Java REST transport to analytics, servicecontrol, servicemanagement, serviceusage and langauge APIs PiperOrigin-RevId: 454254635 Source-Link: https://github.com/googleapis/googleapis/commit/84fb82208e15c45d1732b5eeba7f70828935b97b Source-Link: https://github.com/googleapis/googleapis-gen/commit/4ffb61264d6fb634c430829dd2da75c5bed08304 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNGZmYjYxMjY0ZDZmYjYzNGM0MzA4MjlkZDJkYTc1YzViZWQwODMwNCJ9 chore: Integrate new gapic-generator-java and rules_gapic PiperOrigin-RevId: 454027580 Source-Link: https://github.com/googleapis/googleapis/commit/1b222777baa702e7135610355706570ed2b56318 Source-Link: https://github.com/googleapis/googleapis-gen/commit/e04cea20d0d12eb5c3bdb360a9e72b654edcb638 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTA0Y2VhMjBkMGQxMmViNWMzYmRiMzYwYTllNzJiNjU0ZWRjYjYzOCJ9 chore(deps): upgrade gapic-generator-java to 2.8.0 and update gax-java to 2.18.1 PiperOrigin-RevId: 450543911 Source-Link: https://github.com/googleapis/googleapis/commit/55283447ab72f10b6c2571d770af0498b593e84f Source-Link: https://github.com/googleapis/googleapis-gen/commit/9f6775cab1958982b88967a43e5e806af0f135db Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiOWY2Nzc1Y2FiMTk1ODk4MmI4ODk2N2E0M2U1ZTgwNmFmMGYxMzVkYiJ9 fix: CustomDimension and CustomMetric resource configuration in Analytics Admin API PiperOrigin-RevId: 448304423 Source-Link: https://github.com/googleapis/googleapis/commit/d018d545db5eeddcd43920d91133629a592b5e57 Source-Link: https://github.com/googleapis/googleapis-gen/commit/6c363eea0f99d00a216a4efc8015e69272ccaa83 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNmMzNjNlZWEwZjk5ZDAwYTIxNmE0ZWZjODAxNWU2OTI3MmNjYWE4MyJ9 --- .../google-analytics-admin/pom.xml | 16 + .../v1alpha/AnalyticsAdminServiceClient.java | 82 +- .../AnalyticsAdminServiceSettings.java | 23 +- .../AnalyticsAdminServiceStubSettings.java | 54 +- ...nAnalyticsAdminServiceCallableFactory.java | 105 + .../HttpJsonAnalyticsAdminServiceStub.java | 4505 ++++++++++++ ...alyticsAdminServiceClientHttpJsonTest.java | 6164 +++++++++++++++++ .../AnalyticsAdminServiceClientTest.java | 36 +- .../clirr-ignored-differences.xml | 21 + .../admin/v1alpha/CustomDimensionName.java | 54 +- .../admin/v1alpha/CustomMetricName.java | 48 +- .../admin/v1alpha/ResourcesProto.java | 169 +- .../analytics/admin/v1alpha/resources.proto | 4 +- 13 files changed, 11113 insertions(+), 168 deletions(-) create mode 100644 java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/stub/HttpJsonAnalyticsAdminServiceCallableFactory.java create mode 100644 java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/stub/HttpJsonAnalyticsAdminServiceStub.java create mode 100644 java-analytics-admin/google-analytics-admin/src/test/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceClientHttpJsonTest.java diff --git a/java-analytics-admin/google-analytics-admin/pom.xml b/java-analytics-admin/google-analytics-admin/pom.xml index 56d72c380139..e28a6dfe52fd 100644 --- a/java-analytics-admin/google-analytics-admin/pom.xml +++ b/java-analytics-admin/google-analytics-admin/pom.xml @@ -58,6 +58,10 @@ com.google.api gax-grpc + + com.google.api + gax-httpjson + org.threeten threetenbp @@ -76,12 +80,24 @@ test + + com.google.api + gax + testlib + test + com.google.api gax-grpc testlib test + + com.google.api + gax-httpjson + testlib + test + diff --git a/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceClient.java b/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceClient.java index 71bc4b552321..fe4023fbfb5f 100644 --- a/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceClient.java +++ b/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceClient.java @@ -103,6 +103,21 @@ * AnalyticsAdminServiceClient.create(analyticsAdminServiceSettings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * AnalyticsAdminServiceSettings analyticsAdminServiceSettings =
+ *     AnalyticsAdminServiceSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             AnalyticsAdminServiceSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * AnalyticsAdminServiceClient analyticsAdminServiceClient =
+ *     AnalyticsAdminServiceClient.create(analyticsAdminServiceSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @BetaApi @@ -129,7 +144,6 @@ public static final AnalyticsAdminServiceClient create(AnalyticsAdminServiceSett * Constructs an instance of AnalyticsAdminServiceClient, using the given stub for making calls. * This is for advanced usage - prefer using create(AnalyticsAdminServiceSettings). */ - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public static final AnalyticsAdminServiceClient create(AnalyticsAdminServiceStub stub) { return new AnalyticsAdminServiceClient(stub); } @@ -144,7 +158,6 @@ protected AnalyticsAdminServiceClient(AnalyticsAdminServiceSettings settings) th this.stub = ((AnalyticsAdminServiceStubSettings) settings.getStubSettings()).createStub(); } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") protected AnalyticsAdminServiceClient(AnalyticsAdminServiceStub stub) { this.settings = null; this.stub = stub; @@ -154,7 +167,6 @@ public final AnalyticsAdminServiceSettings getSettings() { return settings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public AnalyticsAdminServiceStub getStub() { return stub; } @@ -351,7 +363,7 @@ public final ListAccountsPagedResponse listAccounts(ListAccountsRequest request) * while (true) { * ListAccountsResponse response = * analyticsAdminServiceClient.listAccountsCallable().call(request); - * for (Account element : response.getResponsesList()) { + * for (Account element : response.getAccountsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -724,7 +736,7 @@ public final ListAccountSummariesPagedResponse listAccountSummaries( * while (true) { * ListAccountSummariesResponse response = * analyticsAdminServiceClient.listAccountSummariesCallable().call(request); - * for (AccountSummary element : response.getResponsesList()) { + * for (AccountSummary element : response.getAccountSummariesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -937,7 +949,7 @@ public final ListPropertiesPagedResponse listProperties(ListPropertiesRequest re * while (true) { * ListPropertiesResponse response = * analyticsAdminServiceClient.listPropertiesCallable().call(request); - * for (Property element : response.getResponsesList()) { + * for (Property element : response.getPropertiesList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1573,7 +1585,7 @@ public final ListUserLinksPagedResponse listUserLinks(ListUserLinksRequest reque * while (true) { * ListUserLinksResponse response = * analyticsAdminServiceClient.listUserLinksCallable().call(request); - * for (UserLink element : response.getResponsesList()) { + * for (UserLink element : response.getUserLinksList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -1690,7 +1702,7 @@ public final AuditUserLinksPagedResponse auditUserLinks(AuditUserLinksRequest re * while (true) { * AuditUserLinksResponse response = * analyticsAdminServiceClient.auditUserLinksCallable().call(request); - * for (AuditUserLink element : response.getResponsesList()) { + * for (AuditUserLink element : response.getUserLinksList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -2589,7 +2601,7 @@ public final ListFirebaseLinksPagedResponse listFirebaseLinks(ListFirebaseLinksR * while (true) { * ListFirebaseLinksResponse response = * analyticsAdminServiceClient.listFirebaseLinksCallable().call(request); - * for (FirebaseLink element : response.getResponsesList()) { + * for (FirebaseLink element : response.getFirebaseLinksList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -3165,7 +3177,7 @@ public final ListGoogleAdsLinksPagedResponse listGoogleAdsLinks( * while (true) { * ListGoogleAdsLinksResponse response = * analyticsAdminServiceClient.listGoogleAdsLinksCallable().call(request); - * for (GoogleAdsLink element : response.getResponsesList()) { + * for (GoogleAdsLink element : response.getGoogleAdsLinksList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -3561,7 +3573,7 @@ public final ListMeasurementProtocolSecretsPagedResponse listMeasurementProtocol * while (true) { * ListMeasurementProtocolSecretsResponse response = * analyticsAdminServiceClient.listMeasurementProtocolSecretsCallable().call(request); - * for (MeasurementProtocolSecret element : response.getResponsesList()) { + * for (MeasurementProtocolSecret element : response.getMeasurementProtocolSecretsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -4083,7 +4095,7 @@ public final SearchChangeHistoryEventsPagedResponse searchChangeHistoryEvents( * while (true) { * SearchChangeHistoryEventsResponse response = * analyticsAdminServiceClient.searchChangeHistoryEventsCallable().call(request); - * for (ChangeHistoryEvent element : response.getResponsesList()) { + * for (ChangeHistoryEvent element : response.getChangeHistoryEventsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -4792,7 +4804,7 @@ public final ListConversionEventsPagedResponse listConversionEvents( * while (true) { * ListConversionEventsResponse response = * analyticsAdminServiceClient.listConversionEventsCallable().call(request); - * for (ConversionEvent element : response.getResponsesList()) { + * for (ConversionEvent element : response.getConversionEventsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -5080,7 +5092,8 @@ public final ListDisplayVideo360AdvertiserLinksPagedResponse listDisplayVideo360 * while (true) { * ListDisplayVideo360AdvertiserLinksResponse response = * analyticsAdminServiceClient.listDisplayVideo360AdvertiserLinksCallable().call(request); - * for (DisplayVideo360AdvertiserLink element : response.getResponsesList()) { + * for (DisplayVideo360AdvertiserLink element : + * response.getDisplayVideo360AdvertiserLinksList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -5737,7 +5750,8 @@ public final DisplayVideo360AdvertiserLinkProposal getDisplayVideo360AdvertiserL * analyticsAdminServiceClient * .listDisplayVideo360AdvertiserLinkProposalsCallable() * .call(request); - * for (DisplayVideo360AdvertiserLinkProposal element : response.getResponsesList()) { + * for (DisplayVideo360AdvertiserLinkProposal element : + * response.getDisplayVideo360AdvertiserLinkProposalsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -6501,7 +6515,7 @@ public final ListCustomDimensionsPagedResponse listCustomDimensions( * while (true) { * ListCustomDimensionsResponse response = * analyticsAdminServiceClient.listCustomDimensionsCallable().call(request); - * for (CustomDimension element : response.getResponsesList()) { + * for (CustomDimension element : response.getCustomDimensionsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -6530,7 +6544,7 @@ public final ListCustomDimensionsPagedResponse listCustomDimensions( * // It may require modifications to work in your environment. * try (AnalyticsAdminServiceClient analyticsAdminServiceClient = * AnalyticsAdminServiceClient.create()) { - * CustomDimensionName name = CustomDimensionName.of("[PROPERTY]"); + * CustomDimensionName name = CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]"); * analyticsAdminServiceClient.archiveCustomDimension(name); * } * } @@ -6558,7 +6572,7 @@ public final void archiveCustomDimension(CustomDimensionName name) { * // It may require modifications to work in your environment. * try (AnalyticsAdminServiceClient analyticsAdminServiceClient = * AnalyticsAdminServiceClient.create()) { - * String name = CustomDimensionName.of("[PROPERTY]").toString(); + * String name = CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString(); * analyticsAdminServiceClient.archiveCustomDimension(name); * } * } @@ -6586,7 +6600,7 @@ public final void archiveCustomDimension(String name) { * AnalyticsAdminServiceClient.create()) { * ArchiveCustomDimensionRequest request = * ArchiveCustomDimensionRequest.newBuilder() - * .setName(CustomDimensionName.of("[PROPERTY]").toString()) + * .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) * .build(); * analyticsAdminServiceClient.archiveCustomDimension(request); * } @@ -6612,7 +6626,7 @@ public final void archiveCustomDimension(ArchiveCustomDimensionRequest request) * AnalyticsAdminServiceClient.create()) { * ArchiveCustomDimensionRequest request = * ArchiveCustomDimensionRequest.newBuilder() - * .setName(CustomDimensionName.of("[PROPERTY]").toString()) + * .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) * .build(); * ApiFuture future = * analyticsAdminServiceClient.archiveCustomDimensionCallable().futureCall(request); @@ -6637,7 +6651,7 @@ public final void archiveCustomDimension(ArchiveCustomDimensionRequest request) * // It may require modifications to work in your environment. * try (AnalyticsAdminServiceClient analyticsAdminServiceClient = * AnalyticsAdminServiceClient.create()) { - * CustomDimensionName name = CustomDimensionName.of("[PROPERTY]"); + * CustomDimensionName name = CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]"); * CustomDimension response = analyticsAdminServiceClient.getCustomDimension(name); * } * } @@ -6665,7 +6679,7 @@ public final CustomDimension getCustomDimension(CustomDimensionName name) { * // It may require modifications to work in your environment. * try (AnalyticsAdminServiceClient analyticsAdminServiceClient = * AnalyticsAdminServiceClient.create()) { - * String name = CustomDimensionName.of("[PROPERTY]").toString(); + * String name = CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString(); * CustomDimension response = analyticsAdminServiceClient.getCustomDimension(name); * } * } @@ -6693,7 +6707,7 @@ public final CustomDimension getCustomDimension(String name) { * AnalyticsAdminServiceClient.create()) { * GetCustomDimensionRequest request = * GetCustomDimensionRequest.newBuilder() - * .setName(CustomDimensionName.of("[PROPERTY]").toString()) + * .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) * .build(); * CustomDimension response = analyticsAdminServiceClient.getCustomDimension(request); * } @@ -6719,7 +6733,7 @@ public final CustomDimension getCustomDimension(GetCustomDimensionRequest reques * AnalyticsAdminServiceClient.create()) { * GetCustomDimensionRequest request = * GetCustomDimensionRequest.newBuilder() - * .setName(CustomDimensionName.of("[PROPERTY]").toString()) + * .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) * .build(); * ApiFuture future = * analyticsAdminServiceClient.getCustomDimensionCallable().futureCall(request); @@ -7074,7 +7088,7 @@ public final ListCustomMetricsPagedResponse listCustomMetrics(ListCustomMetricsR * while (true) { * ListCustomMetricsResponse response = * analyticsAdminServiceClient.listCustomMetricsCallable().call(request); - * for (CustomMetric element : response.getResponsesList()) { + * for (CustomMetric element : response.getCustomMetricsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); @@ -7103,7 +7117,7 @@ public final ListCustomMetricsPagedResponse listCustomMetrics(ListCustomMetricsR * // It may require modifications to work in your environment. * try (AnalyticsAdminServiceClient analyticsAdminServiceClient = * AnalyticsAdminServiceClient.create()) { - * CustomMetricName name = CustomMetricName.of("[PROPERTY]"); + * CustomMetricName name = CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]"); * analyticsAdminServiceClient.archiveCustomMetric(name); * } * } @@ -7131,7 +7145,7 @@ public final void archiveCustomMetric(CustomMetricName name) { * // It may require modifications to work in your environment. * try (AnalyticsAdminServiceClient analyticsAdminServiceClient = * AnalyticsAdminServiceClient.create()) { - * String name = CustomMetricName.of("[PROPERTY]").toString(); + * String name = CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString(); * analyticsAdminServiceClient.archiveCustomMetric(name); * } * } @@ -7159,7 +7173,7 @@ public final void archiveCustomMetric(String name) { * AnalyticsAdminServiceClient.create()) { * ArchiveCustomMetricRequest request = * ArchiveCustomMetricRequest.newBuilder() - * .setName(CustomMetricName.of("[PROPERTY]").toString()) + * .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) * .build(); * analyticsAdminServiceClient.archiveCustomMetric(request); * } @@ -7185,7 +7199,7 @@ public final void archiveCustomMetric(ArchiveCustomMetricRequest request) { * AnalyticsAdminServiceClient.create()) { * ArchiveCustomMetricRequest request = * ArchiveCustomMetricRequest.newBuilder() - * .setName(CustomMetricName.of("[PROPERTY]").toString()) + * .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) * .build(); * ApiFuture future = * analyticsAdminServiceClient.archiveCustomMetricCallable().futureCall(request); @@ -7209,7 +7223,7 @@ public final UnaryCallable archiveCustomMetri * // It may require modifications to work in your environment. * try (AnalyticsAdminServiceClient analyticsAdminServiceClient = * AnalyticsAdminServiceClient.create()) { - * CustomMetricName name = CustomMetricName.of("[PROPERTY]"); + * CustomMetricName name = CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]"); * CustomMetric response = analyticsAdminServiceClient.getCustomMetric(name); * } * } @@ -7235,7 +7249,7 @@ public final CustomMetric getCustomMetric(CustomMetricName name) { * // It may require modifications to work in your environment. * try (AnalyticsAdminServiceClient analyticsAdminServiceClient = * AnalyticsAdminServiceClient.create()) { - * String name = CustomMetricName.of("[PROPERTY]").toString(); + * String name = CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString(); * CustomMetric response = analyticsAdminServiceClient.getCustomMetric(name); * } * } @@ -7262,7 +7276,7 @@ public final CustomMetric getCustomMetric(String name) { * AnalyticsAdminServiceClient.create()) { * GetCustomMetricRequest request = * GetCustomMetricRequest.newBuilder() - * .setName(CustomMetricName.of("[PROPERTY]").toString()) + * .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) * .build(); * CustomMetric response = analyticsAdminServiceClient.getCustomMetric(request); * } @@ -7288,7 +7302,7 @@ public final CustomMetric getCustomMetric(GetCustomMetricRequest request) { * AnalyticsAdminServiceClient.create()) { * GetCustomMetricRequest request = * GetCustomMetricRequest.newBuilder() - * .setName(CustomMetricName.of("[PROPERTY]").toString()) + * .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) * .build(); * ApiFuture future = * analyticsAdminServiceClient.getCustomMetricCallable().futureCall(request); @@ -7941,7 +7955,7 @@ public final ListDataStreamsPagedResponse listDataStreams(ListDataStreamsRequest * while (true) { * ListDataStreamsResponse response = * analyticsAdminServiceClient.listDataStreamsCallable().call(request); - * for (DataStream element : response.getResponsesList()) { + * for (DataStream element : response.getDataStreamsList()) { * // doThingsWith(element); * } * String nextPageToken = response.getNextPageToken(); diff --git a/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceSettings.java b/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceSettings.java index b8d36ed3a08a..e8fefe83f2ae 100644 --- a/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceSettings.java +++ b/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceSettings.java @@ -38,6 +38,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -589,11 +590,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return AnalyticsAdminServiceStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return AnalyticsAdminServiceStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return AnalyticsAdminServiceStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return AnalyticsAdminServiceStubSettings.defaultTransportChannelProvider(); } @@ -603,11 +611,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return AnalyticsAdminServiceStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -646,6 +660,11 @@ private static Builder createDefault() { return new Builder(AnalyticsAdminServiceStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(AnalyticsAdminServiceStubSettings.newHttpJsonBuilder()); + } + public AnalyticsAdminServiceStubSettings.Builder getStubSettingsBuilder() { return ((AnalyticsAdminServiceStubSettings.Builder) getStubSettings()); } diff --git a/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/stub/AnalyticsAdminServiceStubSettings.java b/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/stub/AnalyticsAdminServiceStubSettings.java index 20e86b233a25..d2d87e5ff029 100644 --- a/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/stub/AnalyticsAdminServiceStubSettings.java +++ b/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/stub/AnalyticsAdminServiceStubSettings.java @@ -152,6 +152,9 @@ import com.google.api.gax.grpc.GaxGrpcProperties; import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.retrying.RetrySettings; import com.google.api.gax.rpc.ApiCallContext; import com.google.api.gax.rpc.ApiClientHeaderProvider; @@ -1811,13 +1814,17 @@ public UnaryCallSettings getDataStreamSettings return getDataStreamSettings; } - @BetaApi("A restructuring of stub classes is planned, so this may break in the future") public AnalyticsAdminServiceStub createStub() throws IOException { if (getTransportChannelProvider() .getTransportName() .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcAnalyticsAdminServiceStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonAnalyticsAdminServiceStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -1850,18 +1857,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(AnalyticsAdminServiceStubSettings.class)) @@ -1869,11 +1883,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(AnalyticsAdminServiceStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return AnalyticsAdminServiceStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -2546,6 +2579,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .getAccountSettings() diff --git a/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/stub/HttpJsonAnalyticsAdminServiceCallableFactory.java b/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/stub/HttpJsonAnalyticsAdminServiceCallableFactory.java new file mode 100644 index 000000000000..6a28742c90c0 --- /dev/null +++ b/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/stub/HttpJsonAnalyticsAdminServiceCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.analytics.admin.v1alpha.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the AnalyticsAdminService service API. + * + *

This class is for advanced usage. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonAnalyticsAdminServiceCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/stub/HttpJsonAnalyticsAdminServiceStub.java b/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/stub/HttpJsonAnalyticsAdminServiceStub.java new file mode 100644 index 000000000000..06b153f7a698 --- /dev/null +++ b/java-analytics-admin/google-analytics-admin/src/main/java/com/google/analytics/admin/v1alpha/stub/HttpJsonAnalyticsAdminServiceStub.java @@ -0,0 +1,4505 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.analytics.admin.v1alpha.stub; + +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.AuditUserLinksPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListAccountSummariesPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListAccountsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListConversionEventsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListCustomDimensionsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListCustomMetricsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListDataStreamsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListDisplayVideo360AdvertiserLinkProposalsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListDisplayVideo360AdvertiserLinksPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListFirebaseLinksPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListGoogleAdsLinksPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListMeasurementProtocolSecretsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListPropertiesPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListUserLinksPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.SearchChangeHistoryEventsPagedResponse; + +import com.google.analytics.admin.v1alpha.Account; +import com.google.analytics.admin.v1alpha.AcknowledgeUserDataCollectionRequest; +import com.google.analytics.admin.v1alpha.AcknowledgeUserDataCollectionResponse; +import com.google.analytics.admin.v1alpha.ApproveDisplayVideo360AdvertiserLinkProposalRequest; +import com.google.analytics.admin.v1alpha.ApproveDisplayVideo360AdvertiserLinkProposalResponse; +import com.google.analytics.admin.v1alpha.ArchiveCustomDimensionRequest; +import com.google.analytics.admin.v1alpha.ArchiveCustomMetricRequest; +import com.google.analytics.admin.v1alpha.AuditUserLinksRequest; +import com.google.analytics.admin.v1alpha.AuditUserLinksResponse; +import com.google.analytics.admin.v1alpha.BatchCreateUserLinksRequest; +import com.google.analytics.admin.v1alpha.BatchCreateUserLinksResponse; +import com.google.analytics.admin.v1alpha.BatchDeleteUserLinksRequest; +import com.google.analytics.admin.v1alpha.BatchGetUserLinksRequest; +import com.google.analytics.admin.v1alpha.BatchGetUserLinksResponse; +import com.google.analytics.admin.v1alpha.BatchUpdateUserLinksRequest; +import com.google.analytics.admin.v1alpha.BatchUpdateUserLinksResponse; +import com.google.analytics.admin.v1alpha.CancelDisplayVideo360AdvertiserLinkProposalRequest; +import com.google.analytics.admin.v1alpha.ConversionEvent; +import com.google.analytics.admin.v1alpha.CreateConversionEventRequest; +import com.google.analytics.admin.v1alpha.CreateCustomDimensionRequest; +import com.google.analytics.admin.v1alpha.CreateCustomMetricRequest; +import com.google.analytics.admin.v1alpha.CreateDataStreamRequest; +import com.google.analytics.admin.v1alpha.CreateDisplayVideo360AdvertiserLinkProposalRequest; +import com.google.analytics.admin.v1alpha.CreateDisplayVideo360AdvertiserLinkRequest; +import com.google.analytics.admin.v1alpha.CreateFirebaseLinkRequest; +import com.google.analytics.admin.v1alpha.CreateGoogleAdsLinkRequest; +import com.google.analytics.admin.v1alpha.CreateMeasurementProtocolSecretRequest; +import com.google.analytics.admin.v1alpha.CreatePropertyRequest; +import com.google.analytics.admin.v1alpha.CreateUserLinkRequest; +import com.google.analytics.admin.v1alpha.CustomDimension; +import com.google.analytics.admin.v1alpha.CustomMetric; +import com.google.analytics.admin.v1alpha.DataRetentionSettings; +import com.google.analytics.admin.v1alpha.DataSharingSettings; +import com.google.analytics.admin.v1alpha.DataStream; +import com.google.analytics.admin.v1alpha.DeleteAccountRequest; +import com.google.analytics.admin.v1alpha.DeleteConversionEventRequest; +import com.google.analytics.admin.v1alpha.DeleteDataStreamRequest; +import com.google.analytics.admin.v1alpha.DeleteDisplayVideo360AdvertiserLinkProposalRequest; +import com.google.analytics.admin.v1alpha.DeleteDisplayVideo360AdvertiserLinkRequest; +import com.google.analytics.admin.v1alpha.DeleteFirebaseLinkRequest; +import com.google.analytics.admin.v1alpha.DeleteGoogleAdsLinkRequest; +import com.google.analytics.admin.v1alpha.DeleteMeasurementProtocolSecretRequest; +import com.google.analytics.admin.v1alpha.DeletePropertyRequest; +import com.google.analytics.admin.v1alpha.DeleteUserLinkRequest; +import com.google.analytics.admin.v1alpha.DisplayVideo360AdvertiserLink; +import com.google.analytics.admin.v1alpha.DisplayVideo360AdvertiserLinkProposal; +import com.google.analytics.admin.v1alpha.FirebaseLink; +import com.google.analytics.admin.v1alpha.GetAccountRequest; +import com.google.analytics.admin.v1alpha.GetConversionEventRequest; +import com.google.analytics.admin.v1alpha.GetCustomDimensionRequest; +import com.google.analytics.admin.v1alpha.GetCustomMetricRequest; +import com.google.analytics.admin.v1alpha.GetDataRetentionSettingsRequest; +import com.google.analytics.admin.v1alpha.GetDataSharingSettingsRequest; +import com.google.analytics.admin.v1alpha.GetDataStreamRequest; +import com.google.analytics.admin.v1alpha.GetDisplayVideo360AdvertiserLinkProposalRequest; +import com.google.analytics.admin.v1alpha.GetDisplayVideo360AdvertiserLinkRequest; +import com.google.analytics.admin.v1alpha.GetGlobalSiteTagRequest; +import com.google.analytics.admin.v1alpha.GetGoogleSignalsSettingsRequest; +import com.google.analytics.admin.v1alpha.GetMeasurementProtocolSecretRequest; +import com.google.analytics.admin.v1alpha.GetPropertyRequest; +import com.google.analytics.admin.v1alpha.GetUserLinkRequest; +import com.google.analytics.admin.v1alpha.GlobalSiteTag; +import com.google.analytics.admin.v1alpha.GoogleAdsLink; +import com.google.analytics.admin.v1alpha.GoogleSignalsSettings; +import com.google.analytics.admin.v1alpha.ListAccountSummariesRequest; +import com.google.analytics.admin.v1alpha.ListAccountSummariesResponse; +import com.google.analytics.admin.v1alpha.ListAccountsRequest; +import com.google.analytics.admin.v1alpha.ListAccountsResponse; +import com.google.analytics.admin.v1alpha.ListConversionEventsRequest; +import com.google.analytics.admin.v1alpha.ListConversionEventsResponse; +import com.google.analytics.admin.v1alpha.ListCustomDimensionsRequest; +import com.google.analytics.admin.v1alpha.ListCustomDimensionsResponse; +import com.google.analytics.admin.v1alpha.ListCustomMetricsRequest; +import com.google.analytics.admin.v1alpha.ListCustomMetricsResponse; +import com.google.analytics.admin.v1alpha.ListDataStreamsRequest; +import com.google.analytics.admin.v1alpha.ListDataStreamsResponse; +import com.google.analytics.admin.v1alpha.ListDisplayVideo360AdvertiserLinkProposalsRequest; +import com.google.analytics.admin.v1alpha.ListDisplayVideo360AdvertiserLinkProposalsResponse; +import com.google.analytics.admin.v1alpha.ListDisplayVideo360AdvertiserLinksRequest; +import com.google.analytics.admin.v1alpha.ListDisplayVideo360AdvertiserLinksResponse; +import com.google.analytics.admin.v1alpha.ListFirebaseLinksRequest; +import com.google.analytics.admin.v1alpha.ListFirebaseLinksResponse; +import com.google.analytics.admin.v1alpha.ListGoogleAdsLinksRequest; +import com.google.analytics.admin.v1alpha.ListGoogleAdsLinksResponse; +import com.google.analytics.admin.v1alpha.ListMeasurementProtocolSecretsRequest; +import com.google.analytics.admin.v1alpha.ListMeasurementProtocolSecretsResponse; +import com.google.analytics.admin.v1alpha.ListPropertiesRequest; +import com.google.analytics.admin.v1alpha.ListPropertiesResponse; +import com.google.analytics.admin.v1alpha.ListUserLinksRequest; +import com.google.analytics.admin.v1alpha.ListUserLinksResponse; +import com.google.analytics.admin.v1alpha.MeasurementProtocolSecret; +import com.google.analytics.admin.v1alpha.Property; +import com.google.analytics.admin.v1alpha.ProvisionAccountTicketRequest; +import com.google.analytics.admin.v1alpha.ProvisionAccountTicketResponse; +import com.google.analytics.admin.v1alpha.SearchChangeHistoryEventsRequest; +import com.google.analytics.admin.v1alpha.SearchChangeHistoryEventsResponse; +import com.google.analytics.admin.v1alpha.UpdateAccountRequest; +import com.google.analytics.admin.v1alpha.UpdateCustomDimensionRequest; +import com.google.analytics.admin.v1alpha.UpdateCustomMetricRequest; +import com.google.analytics.admin.v1alpha.UpdateDataRetentionSettingsRequest; +import com.google.analytics.admin.v1alpha.UpdateDataStreamRequest; +import com.google.analytics.admin.v1alpha.UpdateDisplayVideo360AdvertiserLinkRequest; +import com.google.analytics.admin.v1alpha.UpdateGoogleAdsLinkRequest; +import com.google.analytics.admin.v1alpha.UpdateGoogleSignalsSettingsRequest; +import com.google.analytics.admin.v1alpha.UpdateMeasurementProtocolSecretRequest; +import com.google.analytics.admin.v1alpha.UpdatePropertyRequest; +import com.google.analytics.admin.v1alpha.UpdateUserLinkRequest; +import com.google.analytics.admin.v1alpha.UserLink; +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the AnalyticsAdminService service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@BetaApi +@Generated("by gapic-generator-java") +public class HttpJsonAnalyticsAdminServiceStub extends AnalyticsAdminServiceStub { + private static final TypeRegistry typeRegistry = TypeRegistry.newBuilder().build(); + + private static final ApiMethodDescriptor getAccountMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.analytics.admin.v1alpha.AnalyticsAdminService/GetAccount") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=accounts/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Account.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listAccountsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListAccounts") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/accounts", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam( + fields, "showDeleted", request.getShowDeleted()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListAccountsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteAccountMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteAccount") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=accounts/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateAccountMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateAccount") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{account.name=accounts/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "account.name", request.getAccount().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("account", request.getAccount())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Account.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ProvisionAccountTicketRequest, ProvisionAccountTicketResponse> + provisionAccountTicketMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ProvisionAccountTicket") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/accounts:provisionAccountTicket", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create().toBody("*", request.toBuilder().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ProvisionAccountTicketResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListAccountSummariesRequest, ListAccountSummariesResponse> + listAccountSummariesMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListAccountSummaries") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/accountSummaries", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListAccountSummariesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getPropertyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.analytics.admin.v1alpha.AnalyticsAdminService/GetProperty") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Property.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listPropertiesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListProperties") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/properties", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam( + fields, "showDeleted", request.getShowDeleted()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListPropertiesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createPropertyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/CreateProperty") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/properties", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("property", request.getProperty())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Property.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deletePropertyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteProperty") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Property.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updatePropertyMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateProperty") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{property.name=properties/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "property.name", request.getProperty().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("property", request.getProperty())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Property.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getUserLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.analytics.admin.v1alpha.AnalyticsAdminService/GetUserLink") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=accounts/*/userLinks/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setAdditionalPaths("/v1alpha/{name=properties/*/userLinks/*}") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(UserLink.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + batchGetUserLinksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/BatchGetUserLinks") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=accounts/*}/userLinks:batchGet", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths("/v1alpha/{parent=properties/*}/userLinks:batchGet") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "names", request.getNamesList()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(BatchGetUserLinksResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listUserLinksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListUserLinks") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=accounts/*}/userLinks", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths("/v1alpha/{parent=properties/*}/userLinks") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListUserLinksResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + auditUserLinksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/AuditUserLinks") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=accounts/*}/userLinks:audit", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths("/v1alpha/{parent=properties/*}/userLinks:audit") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(AuditUserLinksResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createUserLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/CreateUserLink") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=accounts/*}/userLinks", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths("/v1alpha/{parent=properties/*}/userLinks") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "notifyNewUser", request.getNotifyNewUser()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("userLink", request.getUserLink())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(UserLink.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + BatchCreateUserLinksRequest, BatchCreateUserLinksResponse> + batchCreateUserLinksMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/BatchCreateUserLinks") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=accounts/*}/userLinks:batchCreate", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths("/v1alpha/{parent=properties/*}/userLinks:batchCreate") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(BatchCreateUserLinksResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateUserLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateUserLink") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{userLink.name=accounts/*/userLinks/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "userLink.name", request.getUserLink().getName()); + return fields; + }) + .setAdditionalPaths("/v1alpha/{userLink.name=properties/*/userLinks/*}") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("userLink", request.getUserLink())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(UserLink.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + BatchUpdateUserLinksRequest, BatchUpdateUserLinksResponse> + batchUpdateUserLinksMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/BatchUpdateUserLinks") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=accounts/*}/userLinks:batchUpdate", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths("/v1alpha/{parent=properties/*}/userLinks:batchUpdate") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(BatchUpdateUserLinksResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteUserLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteUserLink") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=accounts/*/userLinks/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setAdditionalPaths("/v1alpha/{name=properties/*/userLinks/*}") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + batchDeleteUserLinksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/BatchDeleteUserLinks") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=accounts/*}/userLinks:batchDelete", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setAdditionalPaths("/v1alpha/{parent=properties/*}/userLinks:batchDelete") + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createFirebaseLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/CreateFirebaseLink") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/firebaseLinks", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("firebaseLink", request.getFirebaseLink())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(FirebaseLink.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteFirebaseLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteFirebaseLink") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/firebaseLinks/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listFirebaseLinksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListFirebaseLinks") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/firebaseLinks", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListFirebaseLinksResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getGlobalSiteTagMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/GetGlobalSiteTag") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/dataStreams/*/globalSiteTag}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(GlobalSiteTag.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createGoogleAdsLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/CreateGoogleAdsLink") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/googleAdsLinks", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("googleAdsLink", request.getGoogleAdsLink())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(GoogleAdsLink.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateGoogleAdsLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateGoogleAdsLink") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{googleAdsLink.name=properties/*/googleAdsLinks/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "googleAdsLink.name", request.getGoogleAdsLink().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("googleAdsLink", request.getGoogleAdsLink())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(GoogleAdsLink.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteGoogleAdsLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteGoogleAdsLink") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/googleAdsLinks/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listGoogleAdsLinksMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListGoogleAdsLinks") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/googleAdsLinks", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListGoogleAdsLinksResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getDataSharingSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/GetDataSharingSettings") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=accounts/*/dataSharingSettings}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DataSharingSettings.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + GetMeasurementProtocolSecretRequest, MeasurementProtocolSecret> + getMeasurementProtocolSecretMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/GetMeasurementProtocolSecret") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/dataStreams/*/measurementProtocolSecrets/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(MeasurementProtocolSecret.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListMeasurementProtocolSecretsRequest, ListMeasurementProtocolSecretsResponse> + listMeasurementProtocolSecretsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListMeasurementProtocolSecrets") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*/dataStreams/*}/measurementProtocolSecrets", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + ListMeasurementProtocolSecretsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + CreateMeasurementProtocolSecretRequest, MeasurementProtocolSecret> + createMeasurementProtocolSecretMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/CreateMeasurementProtocolSecret") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*/dataStreams/*}/measurementProtocolSecrets", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "measurementProtocolSecret", + request.getMeasurementProtocolSecret())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(MeasurementProtocolSecret.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteMeasurementProtocolSecretMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteMeasurementProtocolSecret") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/dataStreams/*/measurementProtocolSecrets/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + UpdateMeasurementProtocolSecretRequest, MeasurementProtocolSecret> + updateMeasurementProtocolSecretMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateMeasurementProtocolSecret") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{measurementProtocolSecret.name=properties/*/dataStreams/*/measurementProtocolSecrets/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "measurementProtocolSecret.name", + request.getMeasurementProtocolSecret().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "measurementProtocolSecret", + request.getMeasurementProtocolSecret())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(MeasurementProtocolSecret.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + AcknowledgeUserDataCollectionRequest, AcknowledgeUserDataCollectionResponse> + acknowledgeUserDataCollectionMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/AcknowledgeUserDataCollection") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{property=properties/*}:acknowledgeUserDataCollection", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "property", request.getProperty()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearProperty().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + AcknowledgeUserDataCollectionResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + SearchChangeHistoryEventsRequest, SearchChangeHistoryEventsResponse> + searchChangeHistoryEventsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/SearchChangeHistoryEvents") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{account=accounts/*}:searchChangeHistoryEvents", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "account", request.getAccount()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearAccount().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(SearchChangeHistoryEventsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getGoogleSignalsSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/GetGoogleSignalsSettings") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/googleSignalsSettings}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(GoogleSignalsSettings.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + UpdateGoogleSignalsSettingsRequest, GoogleSignalsSettings> + updateGoogleSignalsSettingsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateGoogleSignalsSettings") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{googleSignalsSettings.name=properties/*/googleSignalsSettings}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "googleSignalsSettings.name", + request.getGoogleSignalsSettings().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "googleSignalsSettings", request.getGoogleSignalsSettings())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(GoogleSignalsSettings.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createConversionEventMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/CreateConversionEvent") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/conversionEvents", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("conversionEvent", request.getConversionEvent())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ConversionEvent.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getConversionEventMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/GetConversionEvent") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/conversionEvents/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ConversionEvent.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteConversionEventMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteConversionEvent") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/conversionEvents/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListConversionEventsRequest, ListConversionEventsResponse> + listConversionEventsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListConversionEvents") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/conversionEvents", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListConversionEventsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + GetDisplayVideo360AdvertiserLinkRequest, DisplayVideo360AdvertiserLink> + getDisplayVideo360AdvertiserLinkMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/GetDisplayVideo360AdvertiserLink") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/displayVideo360AdvertiserLinks/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DisplayVideo360AdvertiserLink.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListDisplayVideo360AdvertiserLinksRequest, ListDisplayVideo360AdvertiserLinksResponse> + listDisplayVideo360AdvertiserLinksMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListDisplayVideo360AdvertiserLinks") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/displayVideo360AdvertiserLinks", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser + .newBuilder() + .setDefaultInstance( + ListDisplayVideo360AdvertiserLinksResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + CreateDisplayVideo360AdvertiserLinkRequest, DisplayVideo360AdvertiserLink> + createDisplayVideo360AdvertiserLinkMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/CreateDisplayVideo360AdvertiserLink") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/displayVideo360AdvertiserLinks", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "displayVideo360AdvertiserLink", + request.getDisplayVideo360AdvertiserLink())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DisplayVideo360AdvertiserLink.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteDisplayVideo360AdvertiserLinkMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteDisplayVideo360AdvertiserLink") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1alpha/{name=properties/*/displayVideo360AdvertiserLinks/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + UpdateDisplayVideo360AdvertiserLinkRequest, DisplayVideo360AdvertiserLink> + updateDisplayVideo360AdvertiserLinkMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateDisplayVideo360AdvertiserLink") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1alpha/{displayVideo360AdvertiserLink.name=properties/*/displayVideo360AdvertiserLinks/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "displayVideo360AdvertiserLink.name", + request.getDisplayVideo360AdvertiserLink().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "displayVideo360AdvertiserLink", + request.getDisplayVideo360AdvertiserLink())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DisplayVideo360AdvertiserLink.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + GetDisplayVideo360AdvertiserLinkProposalRequest, DisplayVideo360AdvertiserLinkProposal> + getDisplayVideo360AdvertiserLinkProposalMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/GetDisplayVideo360AdvertiserLinkProposal") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1alpha/{name=properties/*/displayVideo360AdvertiserLinkProposals/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + DisplayVideo360AdvertiserLinkProposal.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListDisplayVideo360AdvertiserLinkProposalsRequest, + ListDisplayVideo360AdvertiserLinkProposalsResponse> + listDisplayVideo360AdvertiserLinkProposalsMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListDisplayVideo360AdvertiserLinkProposals") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/displayVideo360AdvertiserLinkProposals", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser + .newBuilder() + .setDefaultInstance( + ListDisplayVideo360AdvertiserLinkProposalsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + CreateDisplayVideo360AdvertiserLinkProposalRequest, DisplayVideo360AdvertiserLinkProposal> + createDisplayVideo360AdvertiserLinkProposalMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/CreateDisplayVideo360AdvertiserLinkProposal") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/displayVideo360AdvertiserLinkProposals", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "displayVideo360AdvertiserLinkProposal", + request.getDisplayVideo360AdvertiserLinkProposal())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + DisplayVideo360AdvertiserLinkProposal.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + DeleteDisplayVideo360AdvertiserLinkProposalRequest, Empty> + deleteDisplayVideo360AdvertiserLinkProposalMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteDisplayVideo360AdvertiserLinkProposal") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1alpha/{name=properties/*/displayVideo360AdvertiserLinkProposals/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ApproveDisplayVideo360AdvertiserLinkProposalRequest, + ApproveDisplayVideo360AdvertiserLinkProposalResponse> + approveDisplayVideo360AdvertiserLinkProposalMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ApproveDisplayVideo360AdvertiserLinkProposal") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1alpha/{name=properties/*/displayVideo360AdvertiserLinkProposals/*}:approve", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser + .newBuilder() + .setDefaultInstance( + ApproveDisplayVideo360AdvertiserLinkProposalResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + CancelDisplayVideo360AdvertiserLinkProposalRequest, DisplayVideo360AdvertiserLinkProposal> + cancelDisplayVideo360AdvertiserLinkProposalMethodDescriptor = + ApiMethodDescriptor + . + newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/CancelDisplayVideo360AdvertiserLinkProposal") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter + .newBuilder() + .setPath( + "/v1alpha/{name=properties/*/displayVideo360AdvertiserLinkProposals/*}:cancel", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer + serializer = ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance( + DisplayVideo360AdvertiserLinkProposal.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createCustomDimensionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/CreateCustomDimension") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/customDimensions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("customDimension", request.getCustomDimension())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CustomDimension.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateCustomDimensionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateCustomDimension") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{customDimension.name=properties/*/customDimensions/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "customDimension.name", + request.getCustomDimension().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("customDimension", request.getCustomDimension())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CustomDimension.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + ListCustomDimensionsRequest, ListCustomDimensionsResponse> + listCustomDimensionsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListCustomDimensions") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/customDimensions", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListCustomDimensionsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + archiveCustomDimensionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ArchiveCustomDimension") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/customDimensions/*}:archive", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getCustomDimensionMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/GetCustomDimension") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/customDimensions/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CustomDimension.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createCustomMetricMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/CreateCustomMetric") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/customMetrics", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("customMetric", request.getCustomMetric())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CustomMetric.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateCustomMetricMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateCustomMetric") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{customMetric.name=properties/*/customMetrics/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "customMetric.name", request.getCustomMetric().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("customMetric", request.getCustomMetric())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CustomMetric.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listCustomMetricsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListCustomMetrics") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/customMetrics", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListCustomMetricsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + archiveCustomMetricMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ArchiveCustomMetric") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/customMetrics/*}:archive", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getCustomMetricMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/GetCustomMetric") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/customMetrics/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CustomMetric.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getDataRetentionSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/GetDataRetentionSettings") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/dataRetentionSettings}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DataRetentionSettings.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + UpdateDataRetentionSettingsRequest, DataRetentionSettings> + updateDataRetentionSettingsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateDataRetentionSettings") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{dataRetentionSettings.name=properties/*/dataRetentionSettings}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, + "dataRetentionSettings.name", + request.getDataRetentionSettings().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody( + "dataRetentionSettings", request.getDataRetentionSettings())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DataRetentionSettings.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createDataStreamMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/CreateDataStream") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/dataStreams", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("dataStream", request.getDataStream())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DataStream.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteDataStreamMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteDataStream") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/dataStreams/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateDataStreamMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateDataStream") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{dataStream.name=properties/*/dataStreams/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "dataStream.name", request.getDataStream().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("dataStream", request.getDataStream())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DataStream.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listDataStreamsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/ListDataStreams") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{parent=properties/*}/dataStreams", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListDataStreamsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getDataStreamMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.analytics.admin.v1alpha.AnalyticsAdminService/GetDataStream") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1alpha/{name=properties/*/dataStreams/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(DataStream.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable getAccountCallable; + private final UnaryCallable listAccountsCallable; + private final UnaryCallable + listAccountsPagedCallable; + private final UnaryCallable deleteAccountCallable; + private final UnaryCallable updateAccountCallable; + private final UnaryCallable + provisionAccountTicketCallable; + private final UnaryCallable + listAccountSummariesCallable; + private final UnaryCallable + listAccountSummariesPagedCallable; + private final UnaryCallable getPropertyCallable; + private final UnaryCallable listPropertiesCallable; + private final UnaryCallable + listPropertiesPagedCallable; + private final UnaryCallable createPropertyCallable; + private final UnaryCallable deletePropertyCallable; + private final UnaryCallable updatePropertyCallable; + private final UnaryCallable getUserLinkCallable; + private final UnaryCallable + batchGetUserLinksCallable; + private final UnaryCallable listUserLinksCallable; + private final UnaryCallable + listUserLinksPagedCallable; + private final UnaryCallable auditUserLinksCallable; + private final UnaryCallable + auditUserLinksPagedCallable; + private final UnaryCallable createUserLinkCallable; + private final UnaryCallable + batchCreateUserLinksCallable; + private final UnaryCallable updateUserLinkCallable; + private final UnaryCallable + batchUpdateUserLinksCallable; + private final UnaryCallable deleteUserLinkCallable; + private final UnaryCallable batchDeleteUserLinksCallable; + private final UnaryCallable createFirebaseLinkCallable; + private final UnaryCallable deleteFirebaseLinkCallable; + private final UnaryCallable + listFirebaseLinksCallable; + private final UnaryCallable + listFirebaseLinksPagedCallable; + private final UnaryCallable getGlobalSiteTagCallable; + private final UnaryCallable + createGoogleAdsLinkCallable; + private final UnaryCallable + updateGoogleAdsLinkCallable; + private final UnaryCallable deleteGoogleAdsLinkCallable; + private final UnaryCallable + listGoogleAdsLinksCallable; + private final UnaryCallable + listGoogleAdsLinksPagedCallable; + private final UnaryCallable + getDataSharingSettingsCallable; + private final UnaryCallable + getMeasurementProtocolSecretCallable; + private final UnaryCallable< + ListMeasurementProtocolSecretsRequest, ListMeasurementProtocolSecretsResponse> + listMeasurementProtocolSecretsCallable; + private final UnaryCallable< + ListMeasurementProtocolSecretsRequest, ListMeasurementProtocolSecretsPagedResponse> + listMeasurementProtocolSecretsPagedCallable; + private final UnaryCallable + createMeasurementProtocolSecretCallable; + private final UnaryCallable + deleteMeasurementProtocolSecretCallable; + private final UnaryCallable + updateMeasurementProtocolSecretCallable; + private final UnaryCallable< + AcknowledgeUserDataCollectionRequest, AcknowledgeUserDataCollectionResponse> + acknowledgeUserDataCollectionCallable; + private final UnaryCallable + searchChangeHistoryEventsCallable; + private final UnaryCallable< + SearchChangeHistoryEventsRequest, SearchChangeHistoryEventsPagedResponse> + searchChangeHistoryEventsPagedCallable; + private final UnaryCallable + getGoogleSignalsSettingsCallable; + private final UnaryCallable + updateGoogleSignalsSettingsCallable; + private final UnaryCallable + createConversionEventCallable; + private final UnaryCallable + getConversionEventCallable; + private final UnaryCallable deleteConversionEventCallable; + private final UnaryCallable + listConversionEventsCallable; + private final UnaryCallable + listConversionEventsPagedCallable; + private final UnaryCallable< + GetDisplayVideo360AdvertiserLinkRequest, DisplayVideo360AdvertiserLink> + getDisplayVideo360AdvertiserLinkCallable; + private final UnaryCallable< + ListDisplayVideo360AdvertiserLinksRequest, ListDisplayVideo360AdvertiserLinksResponse> + listDisplayVideo360AdvertiserLinksCallable; + private final UnaryCallable< + ListDisplayVideo360AdvertiserLinksRequest, + ListDisplayVideo360AdvertiserLinksPagedResponse> + listDisplayVideo360AdvertiserLinksPagedCallable; + private final UnaryCallable< + CreateDisplayVideo360AdvertiserLinkRequest, DisplayVideo360AdvertiserLink> + createDisplayVideo360AdvertiserLinkCallable; + private final UnaryCallable + deleteDisplayVideo360AdvertiserLinkCallable; + private final UnaryCallable< + UpdateDisplayVideo360AdvertiserLinkRequest, DisplayVideo360AdvertiserLink> + updateDisplayVideo360AdvertiserLinkCallable; + private final UnaryCallable< + GetDisplayVideo360AdvertiserLinkProposalRequest, DisplayVideo360AdvertiserLinkProposal> + getDisplayVideo360AdvertiserLinkProposalCallable; + private final UnaryCallable< + ListDisplayVideo360AdvertiserLinkProposalsRequest, + ListDisplayVideo360AdvertiserLinkProposalsResponse> + listDisplayVideo360AdvertiserLinkProposalsCallable; + private final UnaryCallable< + ListDisplayVideo360AdvertiserLinkProposalsRequest, + ListDisplayVideo360AdvertiserLinkProposalsPagedResponse> + listDisplayVideo360AdvertiserLinkProposalsPagedCallable; + private final UnaryCallable< + CreateDisplayVideo360AdvertiserLinkProposalRequest, DisplayVideo360AdvertiserLinkProposal> + createDisplayVideo360AdvertiserLinkProposalCallable; + private final UnaryCallable + deleteDisplayVideo360AdvertiserLinkProposalCallable; + private final UnaryCallable< + ApproveDisplayVideo360AdvertiserLinkProposalRequest, + ApproveDisplayVideo360AdvertiserLinkProposalResponse> + approveDisplayVideo360AdvertiserLinkProposalCallable; + private final UnaryCallable< + CancelDisplayVideo360AdvertiserLinkProposalRequest, DisplayVideo360AdvertiserLinkProposal> + cancelDisplayVideo360AdvertiserLinkProposalCallable; + private final UnaryCallable + createCustomDimensionCallable; + private final UnaryCallable + updateCustomDimensionCallable; + private final UnaryCallable + listCustomDimensionsCallable; + private final UnaryCallable + listCustomDimensionsPagedCallable; + private final UnaryCallable archiveCustomDimensionCallable; + private final UnaryCallable + getCustomDimensionCallable; + private final UnaryCallable createCustomMetricCallable; + private final UnaryCallable updateCustomMetricCallable; + private final UnaryCallable + listCustomMetricsCallable; + private final UnaryCallable + listCustomMetricsPagedCallable; + private final UnaryCallable archiveCustomMetricCallable; + private final UnaryCallable getCustomMetricCallable; + private final UnaryCallable + getDataRetentionSettingsCallable; + private final UnaryCallable + updateDataRetentionSettingsCallable; + private final UnaryCallable createDataStreamCallable; + private final UnaryCallable deleteDataStreamCallable; + private final UnaryCallable updateDataStreamCallable; + private final UnaryCallable + listDataStreamsCallable; + private final UnaryCallable + listDataStreamsPagedCallable; + private final UnaryCallable getDataStreamCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonAnalyticsAdminServiceStub create( + AnalyticsAdminServiceStubSettings settings) throws IOException { + return new HttpJsonAnalyticsAdminServiceStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonAnalyticsAdminServiceStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonAnalyticsAdminServiceStub( + AnalyticsAdminServiceStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonAnalyticsAdminServiceStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonAnalyticsAdminServiceStub( + AnalyticsAdminServiceStubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonAnalyticsAdminServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonAnalyticsAdminServiceStub( + AnalyticsAdminServiceStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonAnalyticsAdminServiceCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonAnalyticsAdminServiceStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonAnalyticsAdminServiceStub( + AnalyticsAdminServiceStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + + HttpJsonCallSettings getAccountTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAccountMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listAccountsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listAccountsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteAccountTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteAccountMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateAccountTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateAccountMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + provisionAccountTicketTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(provisionAccountTicketMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listAccountSummariesTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listAccountSummariesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getPropertyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getPropertyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listPropertiesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listPropertiesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createPropertyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createPropertyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deletePropertyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deletePropertyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updatePropertyTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updatePropertyMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getUserLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getUserLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + batchGetUserLinksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(batchGetUserLinksMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listUserLinksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listUserLinksMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + auditUserLinksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(auditUserLinksMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createUserLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createUserLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + batchCreateUserLinksTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(batchCreateUserLinksMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateUserLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateUserLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + batchUpdateUserLinksTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(batchUpdateUserLinksMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteUserLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteUserLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings batchDeleteUserLinksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(batchDeleteUserLinksMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createFirebaseLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createFirebaseLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteFirebaseLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteFirebaseLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listFirebaseLinksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listFirebaseLinksMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getGlobalSiteTagTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getGlobalSiteTagMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createGoogleAdsLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createGoogleAdsLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateGoogleAdsLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateGoogleAdsLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteGoogleAdsLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteGoogleAdsLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listGoogleAdsLinksTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listGoogleAdsLinksMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getDataSharingSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getDataSharingSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getMeasurementProtocolSecretTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getMeasurementProtocolSecretMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + ListMeasurementProtocolSecretsRequest, ListMeasurementProtocolSecretsResponse> + listMeasurementProtocolSecretsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listMeasurementProtocolSecretsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createMeasurementProtocolSecretTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(createMeasurementProtocolSecretMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteMeasurementProtocolSecretTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteMeasurementProtocolSecretMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateMeasurementProtocolSecretTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(updateMeasurementProtocolSecretMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + AcknowledgeUserDataCollectionRequest, AcknowledgeUserDataCollectionResponse> + acknowledgeUserDataCollectionTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(acknowledgeUserDataCollectionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + searchChangeHistoryEventsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(searchChangeHistoryEventsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getGoogleSignalsSettingsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getGoogleSignalsSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateGoogleSignalsSettingsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(updateGoogleSignalsSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createConversionEventTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createConversionEventMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getConversionEventTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getConversionEventMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteConversionEventTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteConversionEventMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listConversionEventsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listConversionEventsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getDisplayVideo360AdvertiserLinkTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(getDisplayVideo360AdvertiserLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + ListDisplayVideo360AdvertiserLinksRequest, ListDisplayVideo360AdvertiserLinksResponse> + listDisplayVideo360AdvertiserLinksTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listDisplayVideo360AdvertiserLinksMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createDisplayVideo360AdvertiserLinkTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(createDisplayVideo360AdvertiserLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteDisplayVideo360AdvertiserLinkTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteDisplayVideo360AdvertiserLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateDisplayVideo360AdvertiserLinkTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(updateDisplayVideo360AdvertiserLinkMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + GetDisplayVideo360AdvertiserLinkProposalRequest, DisplayVideo360AdvertiserLinkProposal> + getDisplayVideo360AdvertiserLinkProposalTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(getDisplayVideo360AdvertiserLinkProposalMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + ListDisplayVideo360AdvertiserLinkProposalsRequest, + ListDisplayVideo360AdvertiserLinkProposalsResponse> + listDisplayVideo360AdvertiserLinkProposalsTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(listDisplayVideo360AdvertiserLinkProposalsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + CreateDisplayVideo360AdvertiserLinkProposalRequest, + DisplayVideo360AdvertiserLinkProposal> + createDisplayVideo360AdvertiserLinkProposalTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(createDisplayVideo360AdvertiserLinkProposalMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + deleteDisplayVideo360AdvertiserLinkProposalTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(deleteDisplayVideo360AdvertiserLinkProposalMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + ApproveDisplayVideo360AdvertiserLinkProposalRequest, + ApproveDisplayVideo360AdvertiserLinkProposalResponse> + approveDisplayVideo360AdvertiserLinkProposalTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(approveDisplayVideo360AdvertiserLinkProposalMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings< + CancelDisplayVideo360AdvertiserLinkProposalRequest, + DisplayVideo360AdvertiserLinkProposal> + cancelDisplayVideo360AdvertiserLinkProposalTransportSettings = + HttpJsonCallSettings + . + newBuilder() + .setMethodDescriptor(cancelDisplayVideo360AdvertiserLinkProposalMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createCustomDimensionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCustomDimensionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateCustomDimensionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCustomDimensionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listCustomDimensionsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(listCustomDimensionsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + archiveCustomDimensionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(archiveCustomDimensionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getCustomDimensionTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCustomDimensionMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createCustomMetricTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createCustomMetricMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateCustomMetricTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateCustomMetricMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listCustomMetricsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listCustomMetricsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings archiveCustomMetricTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(archiveCustomMetricMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getCustomMetricTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getCustomMetricMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + getDataRetentionSettingsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(getDataRetentionSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateDataRetentionSettingsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(updateDataRetentionSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createDataStreamTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createDataStreamMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteDataStreamTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteDataStreamMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateDataStreamTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateDataStreamMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listDataStreamsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listDataStreamsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getDataStreamTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getDataStreamMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.getAccountCallable = + callableFactory.createUnaryCallable( + getAccountTransportSettings, settings.getAccountSettings(), clientContext); + this.listAccountsCallable = + callableFactory.createUnaryCallable( + listAccountsTransportSettings, settings.listAccountsSettings(), clientContext); + this.listAccountsPagedCallable = + callableFactory.createPagedCallable( + listAccountsTransportSettings, settings.listAccountsSettings(), clientContext); + this.deleteAccountCallable = + callableFactory.createUnaryCallable( + deleteAccountTransportSettings, settings.deleteAccountSettings(), clientContext); + this.updateAccountCallable = + callableFactory.createUnaryCallable( + updateAccountTransportSettings, settings.updateAccountSettings(), clientContext); + this.provisionAccountTicketCallable = + callableFactory.createUnaryCallable( + provisionAccountTicketTransportSettings, + settings.provisionAccountTicketSettings(), + clientContext); + this.listAccountSummariesCallable = + callableFactory.createUnaryCallable( + listAccountSummariesTransportSettings, + settings.listAccountSummariesSettings(), + clientContext); + this.listAccountSummariesPagedCallable = + callableFactory.createPagedCallable( + listAccountSummariesTransportSettings, + settings.listAccountSummariesSettings(), + clientContext); + this.getPropertyCallable = + callableFactory.createUnaryCallable( + getPropertyTransportSettings, settings.getPropertySettings(), clientContext); + this.listPropertiesCallable = + callableFactory.createUnaryCallable( + listPropertiesTransportSettings, settings.listPropertiesSettings(), clientContext); + this.listPropertiesPagedCallable = + callableFactory.createPagedCallable( + listPropertiesTransportSettings, settings.listPropertiesSettings(), clientContext); + this.createPropertyCallable = + callableFactory.createUnaryCallable( + createPropertyTransportSettings, settings.createPropertySettings(), clientContext); + this.deletePropertyCallable = + callableFactory.createUnaryCallable( + deletePropertyTransportSettings, settings.deletePropertySettings(), clientContext); + this.updatePropertyCallable = + callableFactory.createUnaryCallable( + updatePropertyTransportSettings, settings.updatePropertySettings(), clientContext); + this.getUserLinkCallable = + callableFactory.createUnaryCallable( + getUserLinkTransportSettings, settings.getUserLinkSettings(), clientContext); + this.batchGetUserLinksCallable = + callableFactory.createUnaryCallable( + batchGetUserLinksTransportSettings, + settings.batchGetUserLinksSettings(), + clientContext); + this.listUserLinksCallable = + callableFactory.createUnaryCallable( + listUserLinksTransportSettings, settings.listUserLinksSettings(), clientContext); + this.listUserLinksPagedCallable = + callableFactory.createPagedCallable( + listUserLinksTransportSettings, settings.listUserLinksSettings(), clientContext); + this.auditUserLinksCallable = + callableFactory.createUnaryCallable( + auditUserLinksTransportSettings, settings.auditUserLinksSettings(), clientContext); + this.auditUserLinksPagedCallable = + callableFactory.createPagedCallable( + auditUserLinksTransportSettings, settings.auditUserLinksSettings(), clientContext); + this.createUserLinkCallable = + callableFactory.createUnaryCallable( + createUserLinkTransportSettings, settings.createUserLinkSettings(), clientContext); + this.batchCreateUserLinksCallable = + callableFactory.createUnaryCallable( + batchCreateUserLinksTransportSettings, + settings.batchCreateUserLinksSettings(), + clientContext); + this.updateUserLinkCallable = + callableFactory.createUnaryCallable( + updateUserLinkTransportSettings, settings.updateUserLinkSettings(), clientContext); + this.batchUpdateUserLinksCallable = + callableFactory.createUnaryCallable( + batchUpdateUserLinksTransportSettings, + settings.batchUpdateUserLinksSettings(), + clientContext); + this.deleteUserLinkCallable = + callableFactory.createUnaryCallable( + deleteUserLinkTransportSettings, settings.deleteUserLinkSettings(), clientContext); + this.batchDeleteUserLinksCallable = + callableFactory.createUnaryCallable( + batchDeleteUserLinksTransportSettings, + settings.batchDeleteUserLinksSettings(), + clientContext); + this.createFirebaseLinkCallable = + callableFactory.createUnaryCallable( + createFirebaseLinkTransportSettings, + settings.createFirebaseLinkSettings(), + clientContext); + this.deleteFirebaseLinkCallable = + callableFactory.createUnaryCallable( + deleteFirebaseLinkTransportSettings, + settings.deleteFirebaseLinkSettings(), + clientContext); + this.listFirebaseLinksCallable = + callableFactory.createUnaryCallable( + listFirebaseLinksTransportSettings, + settings.listFirebaseLinksSettings(), + clientContext); + this.listFirebaseLinksPagedCallable = + callableFactory.createPagedCallable( + listFirebaseLinksTransportSettings, + settings.listFirebaseLinksSettings(), + clientContext); + this.getGlobalSiteTagCallable = + callableFactory.createUnaryCallable( + getGlobalSiteTagTransportSettings, settings.getGlobalSiteTagSettings(), clientContext); + this.createGoogleAdsLinkCallable = + callableFactory.createUnaryCallable( + createGoogleAdsLinkTransportSettings, + settings.createGoogleAdsLinkSettings(), + clientContext); + this.updateGoogleAdsLinkCallable = + callableFactory.createUnaryCallable( + updateGoogleAdsLinkTransportSettings, + settings.updateGoogleAdsLinkSettings(), + clientContext); + this.deleteGoogleAdsLinkCallable = + callableFactory.createUnaryCallable( + deleteGoogleAdsLinkTransportSettings, + settings.deleteGoogleAdsLinkSettings(), + clientContext); + this.listGoogleAdsLinksCallable = + callableFactory.createUnaryCallable( + listGoogleAdsLinksTransportSettings, + settings.listGoogleAdsLinksSettings(), + clientContext); + this.listGoogleAdsLinksPagedCallable = + callableFactory.createPagedCallable( + listGoogleAdsLinksTransportSettings, + settings.listGoogleAdsLinksSettings(), + clientContext); + this.getDataSharingSettingsCallable = + callableFactory.createUnaryCallable( + getDataSharingSettingsTransportSettings, + settings.getDataSharingSettingsSettings(), + clientContext); + this.getMeasurementProtocolSecretCallable = + callableFactory.createUnaryCallable( + getMeasurementProtocolSecretTransportSettings, + settings.getMeasurementProtocolSecretSettings(), + clientContext); + this.listMeasurementProtocolSecretsCallable = + callableFactory.createUnaryCallable( + listMeasurementProtocolSecretsTransportSettings, + settings.listMeasurementProtocolSecretsSettings(), + clientContext); + this.listMeasurementProtocolSecretsPagedCallable = + callableFactory.createPagedCallable( + listMeasurementProtocolSecretsTransportSettings, + settings.listMeasurementProtocolSecretsSettings(), + clientContext); + this.createMeasurementProtocolSecretCallable = + callableFactory.createUnaryCallable( + createMeasurementProtocolSecretTransportSettings, + settings.createMeasurementProtocolSecretSettings(), + clientContext); + this.deleteMeasurementProtocolSecretCallable = + callableFactory.createUnaryCallable( + deleteMeasurementProtocolSecretTransportSettings, + settings.deleteMeasurementProtocolSecretSettings(), + clientContext); + this.updateMeasurementProtocolSecretCallable = + callableFactory.createUnaryCallable( + updateMeasurementProtocolSecretTransportSettings, + settings.updateMeasurementProtocolSecretSettings(), + clientContext); + this.acknowledgeUserDataCollectionCallable = + callableFactory.createUnaryCallable( + acknowledgeUserDataCollectionTransportSettings, + settings.acknowledgeUserDataCollectionSettings(), + clientContext); + this.searchChangeHistoryEventsCallable = + callableFactory.createUnaryCallable( + searchChangeHistoryEventsTransportSettings, + settings.searchChangeHistoryEventsSettings(), + clientContext); + this.searchChangeHistoryEventsPagedCallable = + callableFactory.createPagedCallable( + searchChangeHistoryEventsTransportSettings, + settings.searchChangeHistoryEventsSettings(), + clientContext); + this.getGoogleSignalsSettingsCallable = + callableFactory.createUnaryCallable( + getGoogleSignalsSettingsTransportSettings, + settings.getGoogleSignalsSettingsSettings(), + clientContext); + this.updateGoogleSignalsSettingsCallable = + callableFactory.createUnaryCallable( + updateGoogleSignalsSettingsTransportSettings, + settings.updateGoogleSignalsSettingsSettings(), + clientContext); + this.createConversionEventCallable = + callableFactory.createUnaryCallable( + createConversionEventTransportSettings, + settings.createConversionEventSettings(), + clientContext); + this.getConversionEventCallable = + callableFactory.createUnaryCallable( + getConversionEventTransportSettings, + settings.getConversionEventSettings(), + clientContext); + this.deleteConversionEventCallable = + callableFactory.createUnaryCallable( + deleteConversionEventTransportSettings, + settings.deleteConversionEventSettings(), + clientContext); + this.listConversionEventsCallable = + callableFactory.createUnaryCallable( + listConversionEventsTransportSettings, + settings.listConversionEventsSettings(), + clientContext); + this.listConversionEventsPagedCallable = + callableFactory.createPagedCallable( + listConversionEventsTransportSettings, + settings.listConversionEventsSettings(), + clientContext); + this.getDisplayVideo360AdvertiserLinkCallable = + callableFactory.createUnaryCallable( + getDisplayVideo360AdvertiserLinkTransportSettings, + settings.getDisplayVideo360AdvertiserLinkSettings(), + clientContext); + this.listDisplayVideo360AdvertiserLinksCallable = + callableFactory.createUnaryCallable( + listDisplayVideo360AdvertiserLinksTransportSettings, + settings.listDisplayVideo360AdvertiserLinksSettings(), + clientContext); + this.listDisplayVideo360AdvertiserLinksPagedCallable = + callableFactory.createPagedCallable( + listDisplayVideo360AdvertiserLinksTransportSettings, + settings.listDisplayVideo360AdvertiserLinksSettings(), + clientContext); + this.createDisplayVideo360AdvertiserLinkCallable = + callableFactory.createUnaryCallable( + createDisplayVideo360AdvertiserLinkTransportSettings, + settings.createDisplayVideo360AdvertiserLinkSettings(), + clientContext); + this.deleteDisplayVideo360AdvertiserLinkCallable = + callableFactory.createUnaryCallable( + deleteDisplayVideo360AdvertiserLinkTransportSettings, + settings.deleteDisplayVideo360AdvertiserLinkSettings(), + clientContext); + this.updateDisplayVideo360AdvertiserLinkCallable = + callableFactory.createUnaryCallable( + updateDisplayVideo360AdvertiserLinkTransportSettings, + settings.updateDisplayVideo360AdvertiserLinkSettings(), + clientContext); + this.getDisplayVideo360AdvertiserLinkProposalCallable = + callableFactory.createUnaryCallable( + getDisplayVideo360AdvertiserLinkProposalTransportSettings, + settings.getDisplayVideo360AdvertiserLinkProposalSettings(), + clientContext); + this.listDisplayVideo360AdvertiserLinkProposalsCallable = + callableFactory.createUnaryCallable( + listDisplayVideo360AdvertiserLinkProposalsTransportSettings, + settings.listDisplayVideo360AdvertiserLinkProposalsSettings(), + clientContext); + this.listDisplayVideo360AdvertiserLinkProposalsPagedCallable = + callableFactory.createPagedCallable( + listDisplayVideo360AdvertiserLinkProposalsTransportSettings, + settings.listDisplayVideo360AdvertiserLinkProposalsSettings(), + clientContext); + this.createDisplayVideo360AdvertiserLinkProposalCallable = + callableFactory.createUnaryCallable( + createDisplayVideo360AdvertiserLinkProposalTransportSettings, + settings.createDisplayVideo360AdvertiserLinkProposalSettings(), + clientContext); + this.deleteDisplayVideo360AdvertiserLinkProposalCallable = + callableFactory.createUnaryCallable( + deleteDisplayVideo360AdvertiserLinkProposalTransportSettings, + settings.deleteDisplayVideo360AdvertiserLinkProposalSettings(), + clientContext); + this.approveDisplayVideo360AdvertiserLinkProposalCallable = + callableFactory.createUnaryCallable( + approveDisplayVideo360AdvertiserLinkProposalTransportSettings, + settings.approveDisplayVideo360AdvertiserLinkProposalSettings(), + clientContext); + this.cancelDisplayVideo360AdvertiserLinkProposalCallable = + callableFactory.createUnaryCallable( + cancelDisplayVideo360AdvertiserLinkProposalTransportSettings, + settings.cancelDisplayVideo360AdvertiserLinkProposalSettings(), + clientContext); + this.createCustomDimensionCallable = + callableFactory.createUnaryCallable( + createCustomDimensionTransportSettings, + settings.createCustomDimensionSettings(), + clientContext); + this.updateCustomDimensionCallable = + callableFactory.createUnaryCallable( + updateCustomDimensionTransportSettings, + settings.updateCustomDimensionSettings(), + clientContext); + this.listCustomDimensionsCallable = + callableFactory.createUnaryCallable( + listCustomDimensionsTransportSettings, + settings.listCustomDimensionsSettings(), + clientContext); + this.listCustomDimensionsPagedCallable = + callableFactory.createPagedCallable( + listCustomDimensionsTransportSettings, + settings.listCustomDimensionsSettings(), + clientContext); + this.archiveCustomDimensionCallable = + callableFactory.createUnaryCallable( + archiveCustomDimensionTransportSettings, + settings.archiveCustomDimensionSettings(), + clientContext); + this.getCustomDimensionCallable = + callableFactory.createUnaryCallable( + getCustomDimensionTransportSettings, + settings.getCustomDimensionSettings(), + clientContext); + this.createCustomMetricCallable = + callableFactory.createUnaryCallable( + createCustomMetricTransportSettings, + settings.createCustomMetricSettings(), + clientContext); + this.updateCustomMetricCallable = + callableFactory.createUnaryCallable( + updateCustomMetricTransportSettings, + settings.updateCustomMetricSettings(), + clientContext); + this.listCustomMetricsCallable = + callableFactory.createUnaryCallable( + listCustomMetricsTransportSettings, + settings.listCustomMetricsSettings(), + clientContext); + this.listCustomMetricsPagedCallable = + callableFactory.createPagedCallable( + listCustomMetricsTransportSettings, + settings.listCustomMetricsSettings(), + clientContext); + this.archiveCustomMetricCallable = + callableFactory.createUnaryCallable( + archiveCustomMetricTransportSettings, + settings.archiveCustomMetricSettings(), + clientContext); + this.getCustomMetricCallable = + callableFactory.createUnaryCallable( + getCustomMetricTransportSettings, settings.getCustomMetricSettings(), clientContext); + this.getDataRetentionSettingsCallable = + callableFactory.createUnaryCallable( + getDataRetentionSettingsTransportSettings, + settings.getDataRetentionSettingsSettings(), + clientContext); + this.updateDataRetentionSettingsCallable = + callableFactory.createUnaryCallable( + updateDataRetentionSettingsTransportSettings, + settings.updateDataRetentionSettingsSettings(), + clientContext); + this.createDataStreamCallable = + callableFactory.createUnaryCallable( + createDataStreamTransportSettings, settings.createDataStreamSettings(), clientContext); + this.deleteDataStreamCallable = + callableFactory.createUnaryCallable( + deleteDataStreamTransportSettings, settings.deleteDataStreamSettings(), clientContext); + this.updateDataStreamCallable = + callableFactory.createUnaryCallable( + updateDataStreamTransportSettings, settings.updateDataStreamSettings(), clientContext); + this.listDataStreamsCallable = + callableFactory.createUnaryCallable( + listDataStreamsTransportSettings, settings.listDataStreamsSettings(), clientContext); + this.listDataStreamsPagedCallable = + callableFactory.createPagedCallable( + listDataStreamsTransportSettings, settings.listDataStreamsSettings(), clientContext); + this.getDataStreamCallable = + callableFactory.createUnaryCallable( + getDataStreamTransportSettings, settings.getDataStreamSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(getAccountMethodDescriptor); + methodDescriptors.add(listAccountsMethodDescriptor); + methodDescriptors.add(deleteAccountMethodDescriptor); + methodDescriptors.add(updateAccountMethodDescriptor); + methodDescriptors.add(provisionAccountTicketMethodDescriptor); + methodDescriptors.add(listAccountSummariesMethodDescriptor); + methodDescriptors.add(getPropertyMethodDescriptor); + methodDescriptors.add(listPropertiesMethodDescriptor); + methodDescriptors.add(createPropertyMethodDescriptor); + methodDescriptors.add(deletePropertyMethodDescriptor); + methodDescriptors.add(updatePropertyMethodDescriptor); + methodDescriptors.add(getUserLinkMethodDescriptor); + methodDescriptors.add(batchGetUserLinksMethodDescriptor); + methodDescriptors.add(listUserLinksMethodDescriptor); + methodDescriptors.add(auditUserLinksMethodDescriptor); + methodDescriptors.add(createUserLinkMethodDescriptor); + methodDescriptors.add(batchCreateUserLinksMethodDescriptor); + methodDescriptors.add(updateUserLinkMethodDescriptor); + methodDescriptors.add(batchUpdateUserLinksMethodDescriptor); + methodDescriptors.add(deleteUserLinkMethodDescriptor); + methodDescriptors.add(batchDeleteUserLinksMethodDescriptor); + methodDescriptors.add(createFirebaseLinkMethodDescriptor); + methodDescriptors.add(deleteFirebaseLinkMethodDescriptor); + methodDescriptors.add(listFirebaseLinksMethodDescriptor); + methodDescriptors.add(getGlobalSiteTagMethodDescriptor); + methodDescriptors.add(createGoogleAdsLinkMethodDescriptor); + methodDescriptors.add(updateGoogleAdsLinkMethodDescriptor); + methodDescriptors.add(deleteGoogleAdsLinkMethodDescriptor); + methodDescriptors.add(listGoogleAdsLinksMethodDescriptor); + methodDescriptors.add(getDataSharingSettingsMethodDescriptor); + methodDescriptors.add(getMeasurementProtocolSecretMethodDescriptor); + methodDescriptors.add(listMeasurementProtocolSecretsMethodDescriptor); + methodDescriptors.add(createMeasurementProtocolSecretMethodDescriptor); + methodDescriptors.add(deleteMeasurementProtocolSecretMethodDescriptor); + methodDescriptors.add(updateMeasurementProtocolSecretMethodDescriptor); + methodDescriptors.add(acknowledgeUserDataCollectionMethodDescriptor); + methodDescriptors.add(searchChangeHistoryEventsMethodDescriptor); + methodDescriptors.add(getGoogleSignalsSettingsMethodDescriptor); + methodDescriptors.add(updateGoogleSignalsSettingsMethodDescriptor); + methodDescriptors.add(createConversionEventMethodDescriptor); + methodDescriptors.add(getConversionEventMethodDescriptor); + methodDescriptors.add(deleteConversionEventMethodDescriptor); + methodDescriptors.add(listConversionEventsMethodDescriptor); + methodDescriptors.add(getDisplayVideo360AdvertiserLinkMethodDescriptor); + methodDescriptors.add(listDisplayVideo360AdvertiserLinksMethodDescriptor); + methodDescriptors.add(createDisplayVideo360AdvertiserLinkMethodDescriptor); + methodDescriptors.add(deleteDisplayVideo360AdvertiserLinkMethodDescriptor); + methodDescriptors.add(updateDisplayVideo360AdvertiserLinkMethodDescriptor); + methodDescriptors.add(getDisplayVideo360AdvertiserLinkProposalMethodDescriptor); + methodDescriptors.add(listDisplayVideo360AdvertiserLinkProposalsMethodDescriptor); + methodDescriptors.add(createDisplayVideo360AdvertiserLinkProposalMethodDescriptor); + methodDescriptors.add(deleteDisplayVideo360AdvertiserLinkProposalMethodDescriptor); + methodDescriptors.add(approveDisplayVideo360AdvertiserLinkProposalMethodDescriptor); + methodDescriptors.add(cancelDisplayVideo360AdvertiserLinkProposalMethodDescriptor); + methodDescriptors.add(createCustomDimensionMethodDescriptor); + methodDescriptors.add(updateCustomDimensionMethodDescriptor); + methodDescriptors.add(listCustomDimensionsMethodDescriptor); + methodDescriptors.add(archiveCustomDimensionMethodDescriptor); + methodDescriptors.add(getCustomDimensionMethodDescriptor); + methodDescriptors.add(createCustomMetricMethodDescriptor); + methodDescriptors.add(updateCustomMetricMethodDescriptor); + methodDescriptors.add(listCustomMetricsMethodDescriptor); + methodDescriptors.add(archiveCustomMetricMethodDescriptor); + methodDescriptors.add(getCustomMetricMethodDescriptor); + methodDescriptors.add(getDataRetentionSettingsMethodDescriptor); + methodDescriptors.add(updateDataRetentionSettingsMethodDescriptor); + methodDescriptors.add(createDataStreamMethodDescriptor); + methodDescriptors.add(deleteDataStreamMethodDescriptor); + methodDescriptors.add(updateDataStreamMethodDescriptor); + methodDescriptors.add(listDataStreamsMethodDescriptor); + methodDescriptors.add(getDataStreamMethodDescriptor); + return methodDescriptors; + } + + @Override + public UnaryCallable getAccountCallable() { + return getAccountCallable; + } + + @Override + public UnaryCallable listAccountsCallable() { + return listAccountsCallable; + } + + @Override + public UnaryCallable listAccountsPagedCallable() { + return listAccountsPagedCallable; + } + + @Override + public UnaryCallable deleteAccountCallable() { + return deleteAccountCallable; + } + + @Override + public UnaryCallable updateAccountCallable() { + return updateAccountCallable; + } + + @Override + public UnaryCallable + provisionAccountTicketCallable() { + return provisionAccountTicketCallable; + } + + @Override + public UnaryCallable + listAccountSummariesCallable() { + return listAccountSummariesCallable; + } + + @Override + public UnaryCallable + listAccountSummariesPagedCallable() { + return listAccountSummariesPagedCallable; + } + + @Override + public UnaryCallable getPropertyCallable() { + return getPropertyCallable; + } + + @Override + public UnaryCallable listPropertiesCallable() { + return listPropertiesCallable; + } + + @Override + public UnaryCallable + listPropertiesPagedCallable() { + return listPropertiesPagedCallable; + } + + @Override + public UnaryCallable createPropertyCallable() { + return createPropertyCallable; + } + + @Override + public UnaryCallable deletePropertyCallable() { + return deletePropertyCallable; + } + + @Override + public UnaryCallable updatePropertyCallable() { + return updatePropertyCallable; + } + + @Override + public UnaryCallable getUserLinkCallable() { + return getUserLinkCallable; + } + + @Override + public UnaryCallable + batchGetUserLinksCallable() { + return batchGetUserLinksCallable; + } + + @Override + public UnaryCallable listUserLinksCallable() { + return listUserLinksCallable; + } + + @Override + public UnaryCallable + listUserLinksPagedCallable() { + return listUserLinksPagedCallable; + } + + @Override + public UnaryCallable auditUserLinksCallable() { + return auditUserLinksCallable; + } + + @Override + public UnaryCallable + auditUserLinksPagedCallable() { + return auditUserLinksPagedCallable; + } + + @Override + public UnaryCallable createUserLinkCallable() { + return createUserLinkCallable; + } + + @Override + public UnaryCallable + batchCreateUserLinksCallable() { + return batchCreateUserLinksCallable; + } + + @Override + public UnaryCallable updateUserLinkCallable() { + return updateUserLinkCallable; + } + + @Override + public UnaryCallable + batchUpdateUserLinksCallable() { + return batchUpdateUserLinksCallable; + } + + @Override + public UnaryCallable deleteUserLinkCallable() { + return deleteUserLinkCallable; + } + + @Override + public UnaryCallable batchDeleteUserLinksCallable() { + return batchDeleteUserLinksCallable; + } + + @Override + public UnaryCallable createFirebaseLinkCallable() { + return createFirebaseLinkCallable; + } + + @Override + public UnaryCallable deleteFirebaseLinkCallable() { + return deleteFirebaseLinkCallable; + } + + @Override + public UnaryCallable + listFirebaseLinksCallable() { + return listFirebaseLinksCallable; + } + + @Override + public UnaryCallable + listFirebaseLinksPagedCallable() { + return listFirebaseLinksPagedCallable; + } + + @Override + public UnaryCallable getGlobalSiteTagCallable() { + return getGlobalSiteTagCallable; + } + + @Override + public UnaryCallable createGoogleAdsLinkCallable() { + return createGoogleAdsLinkCallable; + } + + @Override + public UnaryCallable updateGoogleAdsLinkCallable() { + return updateGoogleAdsLinkCallable; + } + + @Override + public UnaryCallable deleteGoogleAdsLinkCallable() { + return deleteGoogleAdsLinkCallable; + } + + @Override + public UnaryCallable + listGoogleAdsLinksCallable() { + return listGoogleAdsLinksCallable; + } + + @Override + public UnaryCallable + listGoogleAdsLinksPagedCallable() { + return listGoogleAdsLinksPagedCallable; + } + + @Override + public UnaryCallable + getDataSharingSettingsCallable() { + return getDataSharingSettingsCallable; + } + + @Override + public UnaryCallable + getMeasurementProtocolSecretCallable() { + return getMeasurementProtocolSecretCallable; + } + + @Override + public UnaryCallable< + ListMeasurementProtocolSecretsRequest, ListMeasurementProtocolSecretsResponse> + listMeasurementProtocolSecretsCallable() { + return listMeasurementProtocolSecretsCallable; + } + + @Override + public UnaryCallable< + ListMeasurementProtocolSecretsRequest, ListMeasurementProtocolSecretsPagedResponse> + listMeasurementProtocolSecretsPagedCallable() { + return listMeasurementProtocolSecretsPagedCallable; + } + + @Override + public UnaryCallable + createMeasurementProtocolSecretCallable() { + return createMeasurementProtocolSecretCallable; + } + + @Override + public UnaryCallable + deleteMeasurementProtocolSecretCallable() { + return deleteMeasurementProtocolSecretCallable; + } + + @Override + public UnaryCallable + updateMeasurementProtocolSecretCallable() { + return updateMeasurementProtocolSecretCallable; + } + + @Override + public UnaryCallable + acknowledgeUserDataCollectionCallable() { + return acknowledgeUserDataCollectionCallable; + } + + @Override + public UnaryCallable + searchChangeHistoryEventsCallable() { + return searchChangeHistoryEventsCallable; + } + + @Override + public UnaryCallable + searchChangeHistoryEventsPagedCallable() { + return searchChangeHistoryEventsPagedCallable; + } + + @Override + public UnaryCallable + getGoogleSignalsSettingsCallable() { + return getGoogleSignalsSettingsCallable; + } + + @Override + public UnaryCallable + updateGoogleSignalsSettingsCallable() { + return updateGoogleSignalsSettingsCallable; + } + + @Override + public UnaryCallable + createConversionEventCallable() { + return createConversionEventCallable; + } + + @Override + public UnaryCallable getConversionEventCallable() { + return getConversionEventCallable; + } + + @Override + public UnaryCallable deleteConversionEventCallable() { + return deleteConversionEventCallable; + } + + @Override + public UnaryCallable + listConversionEventsCallable() { + return listConversionEventsCallable; + } + + @Override + public UnaryCallable + listConversionEventsPagedCallable() { + return listConversionEventsPagedCallable; + } + + @Override + public UnaryCallable + getDisplayVideo360AdvertiserLinkCallable() { + return getDisplayVideo360AdvertiserLinkCallable; + } + + @Override + public UnaryCallable< + ListDisplayVideo360AdvertiserLinksRequest, ListDisplayVideo360AdvertiserLinksResponse> + listDisplayVideo360AdvertiserLinksCallable() { + return listDisplayVideo360AdvertiserLinksCallable; + } + + @Override + public UnaryCallable< + ListDisplayVideo360AdvertiserLinksRequest, + ListDisplayVideo360AdvertiserLinksPagedResponse> + listDisplayVideo360AdvertiserLinksPagedCallable() { + return listDisplayVideo360AdvertiserLinksPagedCallable; + } + + @Override + public UnaryCallable + createDisplayVideo360AdvertiserLinkCallable() { + return createDisplayVideo360AdvertiserLinkCallable; + } + + @Override + public UnaryCallable + deleteDisplayVideo360AdvertiserLinkCallable() { + return deleteDisplayVideo360AdvertiserLinkCallable; + } + + @Override + public UnaryCallable + updateDisplayVideo360AdvertiserLinkCallable() { + return updateDisplayVideo360AdvertiserLinkCallable; + } + + @Override + public UnaryCallable< + GetDisplayVideo360AdvertiserLinkProposalRequest, DisplayVideo360AdvertiserLinkProposal> + getDisplayVideo360AdvertiserLinkProposalCallable() { + return getDisplayVideo360AdvertiserLinkProposalCallable; + } + + @Override + public UnaryCallable< + ListDisplayVideo360AdvertiserLinkProposalsRequest, + ListDisplayVideo360AdvertiserLinkProposalsResponse> + listDisplayVideo360AdvertiserLinkProposalsCallable() { + return listDisplayVideo360AdvertiserLinkProposalsCallable; + } + + @Override + public UnaryCallable< + ListDisplayVideo360AdvertiserLinkProposalsRequest, + ListDisplayVideo360AdvertiserLinkProposalsPagedResponse> + listDisplayVideo360AdvertiserLinkProposalsPagedCallable() { + return listDisplayVideo360AdvertiserLinkProposalsPagedCallable; + } + + @Override + public UnaryCallable< + CreateDisplayVideo360AdvertiserLinkProposalRequest, DisplayVideo360AdvertiserLinkProposal> + createDisplayVideo360AdvertiserLinkProposalCallable() { + return createDisplayVideo360AdvertiserLinkProposalCallable; + } + + @Override + public UnaryCallable + deleteDisplayVideo360AdvertiserLinkProposalCallable() { + return deleteDisplayVideo360AdvertiserLinkProposalCallable; + } + + @Override + public UnaryCallable< + ApproveDisplayVideo360AdvertiserLinkProposalRequest, + ApproveDisplayVideo360AdvertiserLinkProposalResponse> + approveDisplayVideo360AdvertiserLinkProposalCallable() { + return approveDisplayVideo360AdvertiserLinkProposalCallable; + } + + @Override + public UnaryCallable< + CancelDisplayVideo360AdvertiserLinkProposalRequest, DisplayVideo360AdvertiserLinkProposal> + cancelDisplayVideo360AdvertiserLinkProposalCallable() { + return cancelDisplayVideo360AdvertiserLinkProposalCallable; + } + + @Override + public UnaryCallable + createCustomDimensionCallable() { + return createCustomDimensionCallable; + } + + @Override + public UnaryCallable + updateCustomDimensionCallable() { + return updateCustomDimensionCallable; + } + + @Override + public UnaryCallable + listCustomDimensionsCallable() { + return listCustomDimensionsCallable; + } + + @Override + public UnaryCallable + listCustomDimensionsPagedCallable() { + return listCustomDimensionsPagedCallable; + } + + @Override + public UnaryCallable archiveCustomDimensionCallable() { + return archiveCustomDimensionCallable; + } + + @Override + public UnaryCallable getCustomDimensionCallable() { + return getCustomDimensionCallable; + } + + @Override + public UnaryCallable createCustomMetricCallable() { + return createCustomMetricCallable; + } + + @Override + public UnaryCallable updateCustomMetricCallable() { + return updateCustomMetricCallable; + } + + @Override + public UnaryCallable + listCustomMetricsCallable() { + return listCustomMetricsCallable; + } + + @Override + public UnaryCallable + listCustomMetricsPagedCallable() { + return listCustomMetricsPagedCallable; + } + + @Override + public UnaryCallable archiveCustomMetricCallable() { + return archiveCustomMetricCallable; + } + + @Override + public UnaryCallable getCustomMetricCallable() { + return getCustomMetricCallable; + } + + @Override + public UnaryCallable + getDataRetentionSettingsCallable() { + return getDataRetentionSettingsCallable; + } + + @Override + public UnaryCallable + updateDataRetentionSettingsCallable() { + return updateDataRetentionSettingsCallable; + } + + @Override + public UnaryCallable createDataStreamCallable() { + return createDataStreamCallable; + } + + @Override + public UnaryCallable deleteDataStreamCallable() { + return deleteDataStreamCallable; + } + + @Override + public UnaryCallable updateDataStreamCallable() { + return updateDataStreamCallable; + } + + @Override + public UnaryCallable listDataStreamsCallable() { + return listDataStreamsCallable; + } + + @Override + public UnaryCallable + listDataStreamsPagedCallable() { + return listDataStreamsPagedCallable; + } + + @Override + public UnaryCallable getDataStreamCallable() { + return getDataStreamCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-analytics-admin/google-analytics-admin/src/test/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceClientHttpJsonTest.java b/java-analytics-admin/google-analytics-admin/src/test/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceClientHttpJsonTest.java new file mode 100644 index 000000000000..fad2f9421f41 --- /dev/null +++ b/java-analytics-admin/google-analytics-admin/src/test/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceClientHttpJsonTest.java @@ -0,0 +1,6164 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.analytics.admin.v1alpha; + +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.AuditUserLinksPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListAccountSummariesPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListAccountsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListConversionEventsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListCustomDimensionsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListCustomMetricsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListDataStreamsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListDisplayVideo360AdvertiserLinkProposalsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListDisplayVideo360AdvertiserLinksPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListFirebaseLinksPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListGoogleAdsLinksPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListMeasurementProtocolSecretsPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListPropertiesPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.ListUserLinksPagedResponse; +import static com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClient.SearchChangeHistoryEventsPagedResponse; + +import com.google.analytics.admin.v1alpha.stub.HttpJsonAnalyticsAdminServiceStub; +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.common.collect.Lists; +import com.google.protobuf.BoolValue; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class AnalyticsAdminServiceClientHttpJsonTest { + private static MockHttpService mockService; + private static AnalyticsAdminServiceClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonAnalyticsAdminServiceStub.getMethodDescriptors(), + AnalyticsAdminServiceSettings.getDefaultEndpoint()); + AnalyticsAdminServiceSettings settings = + AnalyticsAdminServiceSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + AnalyticsAdminServiceSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = AnalyticsAdminServiceClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void getAccountTest() throws Exception { + Account expectedResponse = + Account.newBuilder() + .setName(AccountName.of("[ACCOUNT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .setRegionCode("regionCode-1991004415") + .setDeleted(true) + .build(); + mockService.addResponse(expectedResponse); + + AccountName name = AccountName.of("[ACCOUNT]"); + + Account actualResponse = client.getAccount(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAccountExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AccountName name = AccountName.of("[ACCOUNT]"); + client.getAccount(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAccountTest2() throws Exception { + Account expectedResponse = + Account.newBuilder() + .setName(AccountName.of("[ACCOUNT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .setRegionCode("regionCode-1991004415") + .setDeleted(true) + .build(); + mockService.addResponse(expectedResponse); + + String name = "accounts/account-3500"; + + Account actualResponse = client.getAccount(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAccountExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "accounts/account-3500"; + client.getAccount(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAccountsTest() throws Exception { + Account responsesElement = Account.newBuilder().build(); + ListAccountsResponse expectedResponse = + ListAccountsResponse.newBuilder() + .setNextPageToken("") + .addAllAccounts(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListAccountsRequest request = + ListAccountsRequest.newBuilder() + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + + ListAccountsPagedResponse pagedListResponse = client.listAccounts(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAccountsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAccountsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListAccountsRequest request = + ListAccountsRequest.newBuilder() + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + client.listAccounts(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAccountTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + AccountName name = AccountName.of("[ACCOUNT]"); + + client.deleteAccount(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAccountExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AccountName name = AccountName.of("[ACCOUNT]"); + client.deleteAccount(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAccountTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "accounts/account-3500"; + + client.deleteAccount(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAccountExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "accounts/account-3500"; + client.deleteAccount(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateAccountTest() throws Exception { + Account expectedResponse = + Account.newBuilder() + .setName(AccountName.of("[ACCOUNT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .setRegionCode("regionCode-1991004415") + .setDeleted(true) + .build(); + mockService.addResponse(expectedResponse); + + Account account = + Account.newBuilder() + .setName(AccountName.of("[ACCOUNT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .setRegionCode("regionCode-1991004415") + .setDeleted(true) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Account actualResponse = client.updateAccount(account, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateAccountExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Account account = + Account.newBuilder() + .setName(AccountName.of("[ACCOUNT]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .setRegionCode("regionCode-1991004415") + .setDeleted(true) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateAccount(account, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void provisionAccountTicketTest() throws Exception { + ProvisionAccountTicketResponse expectedResponse = + ProvisionAccountTicketResponse.newBuilder() + .setAccountTicketId("accountTicketId-1576709484") + .build(); + mockService.addResponse(expectedResponse); + + ProvisionAccountTicketRequest request = + ProvisionAccountTicketRequest.newBuilder() + .setAccount(Account.newBuilder().build()) + .setRedirectUri("redirectUri1970337776") + .build(); + + ProvisionAccountTicketResponse actualResponse = client.provisionAccountTicket(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void provisionAccountTicketExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ProvisionAccountTicketRequest request = + ProvisionAccountTicketRequest.newBuilder() + .setAccount(Account.newBuilder().build()) + .setRedirectUri("redirectUri1970337776") + .build(); + client.provisionAccountTicket(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAccountSummariesTest() throws Exception { + AccountSummary responsesElement = AccountSummary.newBuilder().build(); + ListAccountSummariesResponse expectedResponse = + ListAccountSummariesResponse.newBuilder() + .setNextPageToken("") + .addAllAccountSummaries(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListAccountSummariesRequest request = + ListAccountSummariesRequest.newBuilder() + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + ListAccountSummariesPagedResponse pagedListResponse = client.listAccountSummaries(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAccountSummariesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAccountSummariesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListAccountSummariesRequest request = + ListAccountSummariesRequest.newBuilder() + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.listAccountSummaries(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPropertyTest() throws Exception { + Property expectedResponse = + Property.newBuilder() + .setName(PropertyName.of("[PROPERTY]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setParent("parent-995424086") + .setDisplayName("displayName1714148973") + .setIndustryCategory(IndustryCategory.forNumber(0)) + .setTimeZone("timeZone-2077180903") + .setCurrencyCode("currencyCode1004773790") + .setServiceLevel(ServiceLevel.forNumber(0)) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setAccount(AccountName.of("[ACCOUNT]").toString()) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName name = PropertyName.of("[PROPERTY]"); + + Property actualResponse = client.getProperty(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPropertyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName name = PropertyName.of("[PROPERTY]"); + client.getProperty(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPropertyTest2() throws Exception { + Property expectedResponse = + Property.newBuilder() + .setName(PropertyName.of("[PROPERTY]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setParent("parent-995424086") + .setDisplayName("displayName1714148973") + .setIndustryCategory(IndustryCategory.forNumber(0)) + .setTimeZone("timeZone-2077180903") + .setCurrencyCode("currencyCode1004773790") + .setServiceLevel(ServiceLevel.forNumber(0)) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setAccount(AccountName.of("[ACCOUNT]").toString()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-7337"; + + Property actualResponse = client.getProperty(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPropertyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-7337"; + client.getProperty(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPropertiesTest() throws Exception { + Property responsesElement = Property.newBuilder().build(); + ListPropertiesResponse expectedResponse = + ListPropertiesResponse.newBuilder() + .setNextPageToken("") + .addAllProperties(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ListPropertiesRequest request = + ListPropertiesRequest.newBuilder() + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + + ListPropertiesPagedResponse pagedListResponse = client.listProperties(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPropertiesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listPropertiesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ListPropertiesRequest request = + ListPropertiesRequest.newBuilder() + .setFilter("filter-1274492040") + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setShowDeleted(true) + .build(); + client.listProperties(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createPropertyTest() throws Exception { + Property expectedResponse = + Property.newBuilder() + .setName(PropertyName.of("[PROPERTY]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setParent("parent-995424086") + .setDisplayName("displayName1714148973") + .setIndustryCategory(IndustryCategory.forNumber(0)) + .setTimeZone("timeZone-2077180903") + .setCurrencyCode("currencyCode1004773790") + .setServiceLevel(ServiceLevel.forNumber(0)) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setAccount(AccountName.of("[ACCOUNT]").toString()) + .build(); + mockService.addResponse(expectedResponse); + + Property property = Property.newBuilder().build(); + + Property actualResponse = client.createProperty(property); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createPropertyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Property property = Property.newBuilder().build(); + client.createProperty(property); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deletePropertyTest() throws Exception { + Property expectedResponse = + Property.newBuilder() + .setName(PropertyName.of("[PROPERTY]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setParent("parent-995424086") + .setDisplayName("displayName1714148973") + .setIndustryCategory(IndustryCategory.forNumber(0)) + .setTimeZone("timeZone-2077180903") + .setCurrencyCode("currencyCode1004773790") + .setServiceLevel(ServiceLevel.forNumber(0)) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setAccount(AccountName.of("[ACCOUNT]").toString()) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName name = PropertyName.of("[PROPERTY]"); + + Property actualResponse = client.deleteProperty(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deletePropertyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName name = PropertyName.of("[PROPERTY]"); + client.deleteProperty(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deletePropertyTest2() throws Exception { + Property expectedResponse = + Property.newBuilder() + .setName(PropertyName.of("[PROPERTY]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setParent("parent-995424086") + .setDisplayName("displayName1714148973") + .setIndustryCategory(IndustryCategory.forNumber(0)) + .setTimeZone("timeZone-2077180903") + .setCurrencyCode("currencyCode1004773790") + .setServiceLevel(ServiceLevel.forNumber(0)) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setAccount(AccountName.of("[ACCOUNT]").toString()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-7337"; + + Property actualResponse = client.deleteProperty(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deletePropertyExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-7337"; + client.deleteProperty(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updatePropertyTest() throws Exception { + Property expectedResponse = + Property.newBuilder() + .setName(PropertyName.of("[PROPERTY]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setParent("parent-995424086") + .setDisplayName("displayName1714148973") + .setIndustryCategory(IndustryCategory.forNumber(0)) + .setTimeZone("timeZone-2077180903") + .setCurrencyCode("currencyCode1004773790") + .setServiceLevel(ServiceLevel.forNumber(0)) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setAccount(AccountName.of("[ACCOUNT]").toString()) + .build(); + mockService.addResponse(expectedResponse); + + Property property = + Property.newBuilder() + .setName(PropertyName.of("[PROPERTY]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setParent("parent-995424086") + .setDisplayName("displayName1714148973") + .setIndustryCategory(IndustryCategory.forNumber(0)) + .setTimeZone("timeZone-2077180903") + .setCurrencyCode("currencyCode1004773790") + .setServiceLevel(ServiceLevel.forNumber(0)) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setAccount(AccountName.of("[ACCOUNT]").toString()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Property actualResponse = client.updateProperty(property, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updatePropertyExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Property property = + Property.newBuilder() + .setName(PropertyName.of("[PROPERTY]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setParent("parent-995424086") + .setDisplayName("displayName1714148973") + .setIndustryCategory(IndustryCategory.forNumber(0)) + .setTimeZone("timeZone-2077180903") + .setCurrencyCode("currencyCode1004773790") + .setServiceLevel(ServiceLevel.forNumber(0)) + .setDeleteTime(Timestamp.newBuilder().build()) + .setExpireTime(Timestamp.newBuilder().build()) + .setAccount(AccountName.of("[ACCOUNT]").toString()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateProperty(property, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getUserLinkTest() throws Exception { + UserLink expectedResponse = + UserLink.newBuilder() + .setName(UserLinkName.ofAccountUserLinkName("[ACCOUNT]", "[USER_LINK]").toString()) + .setEmailAddress("emailAddress-1070931784") + .addAllDirectRoles(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + UserLinkName name = UserLinkName.ofAccountUserLinkName("[ACCOUNT]", "[USER_LINK]"); + + UserLink actualResponse = client.getUserLink(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getUserLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + UserLinkName name = UserLinkName.ofAccountUserLinkName("[ACCOUNT]", "[USER_LINK]"); + client.getUserLink(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getUserLinkTest2() throws Exception { + UserLink expectedResponse = + UserLink.newBuilder() + .setName(UserLinkName.ofAccountUserLinkName("[ACCOUNT]", "[USER_LINK]").toString()) + .setEmailAddress("emailAddress-1070931784") + .addAllDirectRoles(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "accounts/account-2326/userLinks/userLink-2326"; + + UserLink actualResponse = client.getUserLink(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getUserLinkExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "accounts/account-2326/userLinks/userLink-2326"; + client.getUserLink(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void batchGetUserLinksTest() throws Exception { + BatchGetUserLinksResponse expectedResponse = + BatchGetUserLinksResponse.newBuilder().addAllUserLinks(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + BatchGetUserLinksRequest request = + BatchGetUserLinksRequest.newBuilder() + .setParent(AccountName.of("[ACCOUNT]").toString()) + .addAllNames(new ArrayList()) + .build(); + + BatchGetUserLinksResponse actualResponse = client.batchGetUserLinks(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void batchGetUserLinksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + BatchGetUserLinksRequest request = + BatchGetUserLinksRequest.newBuilder() + .setParent(AccountName.of("[ACCOUNT]").toString()) + .addAllNames(new ArrayList()) + .build(); + client.batchGetUserLinks(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listUserLinksTest() throws Exception { + UserLink responsesElement = UserLink.newBuilder().build(); + ListUserLinksResponse expectedResponse = + ListUserLinksResponse.newBuilder() + .setNextPageToken("") + .addAllUserLinks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + AccountName parent = AccountName.of("[ACCOUNT]"); + + ListUserLinksPagedResponse pagedListResponse = client.listUserLinks(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getUserLinksList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listUserLinksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AccountName parent = AccountName.of("[ACCOUNT]"); + client.listUserLinks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listUserLinksTest2() throws Exception { + UserLink responsesElement = UserLink.newBuilder().build(); + ListUserLinksResponse expectedResponse = + ListUserLinksResponse.newBuilder() + .setNextPageToken("") + .addAllUserLinks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + + ListUserLinksPagedResponse pagedListResponse = client.listUserLinks(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getUserLinksList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listUserLinksExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + client.listUserLinks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listUserLinksTest3() throws Exception { + UserLink responsesElement = UserLink.newBuilder().build(); + ListUserLinksResponse expectedResponse = + ListUserLinksResponse.newBuilder() + .setNextPageToken("") + .addAllUserLinks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "accounts/account-4811"; + + ListUserLinksPagedResponse pagedListResponse = client.listUserLinks(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getUserLinksList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listUserLinksExceptionTest3() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "accounts/account-4811"; + client.listUserLinks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void auditUserLinksTest() throws Exception { + AuditUserLink responsesElement = AuditUserLink.newBuilder().build(); + AuditUserLinksResponse expectedResponse = + AuditUserLinksResponse.newBuilder() + .setNextPageToken("") + .addAllUserLinks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + AuditUserLinksRequest request = + AuditUserLinksRequest.newBuilder() + .setParent(AccountName.of("[ACCOUNT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + AuditUserLinksPagedResponse pagedListResponse = client.auditUserLinks(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getUserLinksList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void auditUserLinksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AuditUserLinksRequest request = + AuditUserLinksRequest.newBuilder() + .setParent(AccountName.of("[ACCOUNT]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.auditUserLinks(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createUserLinkTest() throws Exception { + UserLink expectedResponse = + UserLink.newBuilder() + .setName(UserLinkName.ofAccountUserLinkName("[ACCOUNT]", "[USER_LINK]").toString()) + .setEmailAddress("emailAddress-1070931784") + .addAllDirectRoles(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + AccountName parent = AccountName.of("[ACCOUNT]"); + UserLink userLink = UserLink.newBuilder().build(); + + UserLink actualResponse = client.createUserLink(parent, userLink); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createUserLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AccountName parent = AccountName.of("[ACCOUNT]"); + UserLink userLink = UserLink.newBuilder().build(); + client.createUserLink(parent, userLink); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createUserLinkTest2() throws Exception { + UserLink expectedResponse = + UserLink.newBuilder() + .setName(UserLinkName.ofAccountUserLinkName("[ACCOUNT]", "[USER_LINK]").toString()) + .setEmailAddress("emailAddress-1070931784") + .addAllDirectRoles(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + UserLink userLink = UserLink.newBuilder().build(); + + UserLink actualResponse = client.createUserLink(parent, userLink); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createUserLinkExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + UserLink userLink = UserLink.newBuilder().build(); + client.createUserLink(parent, userLink); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createUserLinkTest3() throws Exception { + UserLink expectedResponse = + UserLink.newBuilder() + .setName(UserLinkName.ofAccountUserLinkName("[ACCOUNT]", "[USER_LINK]").toString()) + .setEmailAddress("emailAddress-1070931784") + .addAllDirectRoles(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "accounts/account-4811"; + UserLink userLink = UserLink.newBuilder().build(); + + UserLink actualResponse = client.createUserLink(parent, userLink); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createUserLinkExceptionTest3() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "accounts/account-4811"; + UserLink userLink = UserLink.newBuilder().build(); + client.createUserLink(parent, userLink); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void batchCreateUserLinksTest() throws Exception { + BatchCreateUserLinksResponse expectedResponse = + BatchCreateUserLinksResponse.newBuilder() + .addAllUserLinks(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + BatchCreateUserLinksRequest request = + BatchCreateUserLinksRequest.newBuilder() + .setParent(AccountName.of("[ACCOUNT]").toString()) + .setNotifyNewUsers(true) + .addAllRequests(new ArrayList()) + .build(); + + BatchCreateUserLinksResponse actualResponse = client.batchCreateUserLinks(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void batchCreateUserLinksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + BatchCreateUserLinksRequest request = + BatchCreateUserLinksRequest.newBuilder() + .setParent(AccountName.of("[ACCOUNT]").toString()) + .setNotifyNewUsers(true) + .addAllRequests(new ArrayList()) + .build(); + client.batchCreateUserLinks(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateUserLinkTest() throws Exception { + UserLink expectedResponse = + UserLink.newBuilder() + .setName(UserLinkName.ofAccountUserLinkName("[ACCOUNT]", "[USER_LINK]").toString()) + .setEmailAddress("emailAddress-1070931784") + .addAllDirectRoles(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + UserLink userLink = + UserLink.newBuilder() + .setName(UserLinkName.ofAccountUserLinkName("[ACCOUNT]", "[USER_LINK]").toString()) + .setEmailAddress("emailAddress-1070931784") + .addAllDirectRoles(new ArrayList()) + .build(); + + UserLink actualResponse = client.updateUserLink(userLink); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateUserLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + UserLink userLink = + UserLink.newBuilder() + .setName(UserLinkName.ofAccountUserLinkName("[ACCOUNT]", "[USER_LINK]").toString()) + .setEmailAddress("emailAddress-1070931784") + .addAllDirectRoles(new ArrayList()) + .build(); + client.updateUserLink(userLink); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void batchUpdateUserLinksTest() throws Exception { + BatchUpdateUserLinksResponse expectedResponse = + BatchUpdateUserLinksResponse.newBuilder() + .addAllUserLinks(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + BatchUpdateUserLinksRequest request = + BatchUpdateUserLinksRequest.newBuilder() + .setParent(AccountName.of("[ACCOUNT]").toString()) + .addAllRequests(new ArrayList()) + .build(); + + BatchUpdateUserLinksResponse actualResponse = client.batchUpdateUserLinks(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void batchUpdateUserLinksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + BatchUpdateUserLinksRequest request = + BatchUpdateUserLinksRequest.newBuilder() + .setParent(AccountName.of("[ACCOUNT]").toString()) + .addAllRequests(new ArrayList()) + .build(); + client.batchUpdateUserLinks(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteUserLinkTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + UserLinkName name = UserLinkName.ofAccountUserLinkName("[ACCOUNT]", "[USER_LINK]"); + + client.deleteUserLink(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteUserLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + UserLinkName name = UserLinkName.ofAccountUserLinkName("[ACCOUNT]", "[USER_LINK]"); + client.deleteUserLink(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteUserLinkTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "accounts/account-2326/userLinks/userLink-2326"; + + client.deleteUserLink(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteUserLinkExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "accounts/account-2326/userLinks/userLink-2326"; + client.deleteUserLink(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void batchDeleteUserLinksTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + BatchDeleteUserLinksRequest request = + BatchDeleteUserLinksRequest.newBuilder() + .setParent(AccountName.of("[ACCOUNT]").toString()) + .addAllRequests(new ArrayList()) + .build(); + + client.batchDeleteUserLinks(request); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void batchDeleteUserLinksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + BatchDeleteUserLinksRequest request = + BatchDeleteUserLinksRequest.newBuilder() + .setParent(AccountName.of("[ACCOUNT]").toString()) + .addAllRequests(new ArrayList()) + .build(); + client.batchDeleteUserLinks(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createFirebaseLinkTest() throws Exception { + FirebaseLink expectedResponse = + FirebaseLink.newBuilder() + .setName(FirebaseLinkName.of("[PROPERTY]", "[FIREBASE_LINK]").toString()) + .setProject("project-309310695") + .setCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + FirebaseLink firebaseLink = FirebaseLink.newBuilder().build(); + + FirebaseLink actualResponse = client.createFirebaseLink(parent, firebaseLink); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createFirebaseLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + FirebaseLink firebaseLink = FirebaseLink.newBuilder().build(); + client.createFirebaseLink(parent, firebaseLink); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createFirebaseLinkTest2() throws Exception { + FirebaseLink expectedResponse = + FirebaseLink.newBuilder() + .setName(FirebaseLinkName.of("[PROPERTY]", "[FIREBASE_LINK]").toString()) + .setProject("project-309310695") + .setCreateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + FirebaseLink firebaseLink = FirebaseLink.newBuilder().build(); + + FirebaseLink actualResponse = client.createFirebaseLink(parent, firebaseLink); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createFirebaseLinkExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + FirebaseLink firebaseLink = FirebaseLink.newBuilder().build(); + client.createFirebaseLink(parent, firebaseLink); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteFirebaseLinkTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + FirebaseLinkName name = FirebaseLinkName.of("[PROPERTY]", "[FIREBASE_LINK]"); + + client.deleteFirebaseLink(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteFirebaseLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + FirebaseLinkName name = FirebaseLinkName.of("[PROPERTY]", "[FIREBASE_LINK]"); + client.deleteFirebaseLink(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteFirebaseLinkTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-2649/firebaseLinks/firebaseLink-2649"; + + client.deleteFirebaseLink(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteFirebaseLinkExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-2649/firebaseLinks/firebaseLink-2649"; + client.deleteFirebaseLink(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listFirebaseLinksTest() throws Exception { + FirebaseLink responsesElement = FirebaseLink.newBuilder().build(); + ListFirebaseLinksResponse expectedResponse = + ListFirebaseLinksResponse.newBuilder() + .setNextPageToken("") + .addAllFirebaseLinks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + + ListFirebaseLinksPagedResponse pagedListResponse = client.listFirebaseLinks(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getFirebaseLinksList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listFirebaseLinksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + client.listFirebaseLinks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listFirebaseLinksTest2() throws Exception { + FirebaseLink responsesElement = FirebaseLink.newBuilder().build(); + ListFirebaseLinksResponse expectedResponse = + ListFirebaseLinksResponse.newBuilder() + .setNextPageToken("") + .addAllFirebaseLinks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + + ListFirebaseLinksPagedResponse pagedListResponse = client.listFirebaseLinks(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getFirebaseLinksList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listFirebaseLinksExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + client.listFirebaseLinks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getGlobalSiteTagTest() throws Exception { + GlobalSiteTag expectedResponse = + GlobalSiteTag.newBuilder() + .setName(GlobalSiteTagName.of("[PROPERTY]", "[DATA_STREAM]").toString()) + .setSnippet("snippet-2061635299") + .build(); + mockService.addResponse(expectedResponse); + + GlobalSiteTagName name = GlobalSiteTagName.of("[PROPERTY]", "[DATA_STREAM]"); + + GlobalSiteTag actualResponse = client.getGlobalSiteTag(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getGlobalSiteTagExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GlobalSiteTagName name = GlobalSiteTagName.of("[PROPERTY]", "[DATA_STREAM]"); + client.getGlobalSiteTag(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getGlobalSiteTagTest2() throws Exception { + GlobalSiteTag expectedResponse = + GlobalSiteTag.newBuilder() + .setName(GlobalSiteTagName.of("[PROPERTY]", "[DATA_STREAM]").toString()) + .setSnippet("snippet-2061635299") + .build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-1615/dataStreams/dataStream-1615/globalSiteTag"; + + GlobalSiteTag actualResponse = client.getGlobalSiteTag(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getGlobalSiteTagExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-1615/dataStreams/dataStream-1615/globalSiteTag"; + client.getGlobalSiteTag(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createGoogleAdsLinkTest() throws Exception { + GoogleAdsLink expectedResponse = + GoogleAdsLink.newBuilder() + .setName(GoogleAdsLinkName.of("[PROPERTY]", "[GOOGLE_ADS_LINK]").toString()) + .setCustomerId("customerId-1581184615") + .setCanManageClients(true) + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCreatorEmailAddress("creatorEmailAddress67752708") + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + GoogleAdsLink googleAdsLink = GoogleAdsLink.newBuilder().build(); + + GoogleAdsLink actualResponse = client.createGoogleAdsLink(parent, googleAdsLink); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createGoogleAdsLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + GoogleAdsLink googleAdsLink = GoogleAdsLink.newBuilder().build(); + client.createGoogleAdsLink(parent, googleAdsLink); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createGoogleAdsLinkTest2() throws Exception { + GoogleAdsLink expectedResponse = + GoogleAdsLink.newBuilder() + .setName(GoogleAdsLinkName.of("[PROPERTY]", "[GOOGLE_ADS_LINK]").toString()) + .setCustomerId("customerId-1581184615") + .setCanManageClients(true) + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCreatorEmailAddress("creatorEmailAddress67752708") + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + GoogleAdsLink googleAdsLink = GoogleAdsLink.newBuilder().build(); + + GoogleAdsLink actualResponse = client.createGoogleAdsLink(parent, googleAdsLink); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createGoogleAdsLinkExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + GoogleAdsLink googleAdsLink = GoogleAdsLink.newBuilder().build(); + client.createGoogleAdsLink(parent, googleAdsLink); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateGoogleAdsLinkTest() throws Exception { + GoogleAdsLink expectedResponse = + GoogleAdsLink.newBuilder() + .setName(GoogleAdsLinkName.of("[PROPERTY]", "[GOOGLE_ADS_LINK]").toString()) + .setCustomerId("customerId-1581184615") + .setCanManageClients(true) + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCreatorEmailAddress("creatorEmailAddress67752708") + .build(); + mockService.addResponse(expectedResponse); + + GoogleAdsLink googleAdsLink = + GoogleAdsLink.newBuilder() + .setName(GoogleAdsLinkName.of("[PROPERTY]", "[GOOGLE_ADS_LINK]").toString()) + .setCustomerId("customerId-1581184615") + .setCanManageClients(true) + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCreatorEmailAddress("creatorEmailAddress67752708") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + GoogleAdsLink actualResponse = client.updateGoogleAdsLink(googleAdsLink, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateGoogleAdsLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GoogleAdsLink googleAdsLink = + GoogleAdsLink.newBuilder() + .setName(GoogleAdsLinkName.of("[PROPERTY]", "[GOOGLE_ADS_LINK]").toString()) + .setCustomerId("customerId-1581184615") + .setCanManageClients(true) + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setCreatorEmailAddress("creatorEmailAddress67752708") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateGoogleAdsLink(googleAdsLink, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteGoogleAdsLinkTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + GoogleAdsLinkName name = GoogleAdsLinkName.of("[PROPERTY]", "[GOOGLE_ADS_LINK]"); + + client.deleteGoogleAdsLink(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteGoogleAdsLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GoogleAdsLinkName name = GoogleAdsLinkName.of("[PROPERTY]", "[GOOGLE_ADS_LINK]"); + client.deleteGoogleAdsLink(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteGoogleAdsLinkTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-1267/googleAdsLinks/googleAdsLink-1267"; + + client.deleteGoogleAdsLink(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteGoogleAdsLinkExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-1267/googleAdsLinks/googleAdsLink-1267"; + client.deleteGoogleAdsLink(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listGoogleAdsLinksTest() throws Exception { + GoogleAdsLink responsesElement = GoogleAdsLink.newBuilder().build(); + ListGoogleAdsLinksResponse expectedResponse = + ListGoogleAdsLinksResponse.newBuilder() + .setNextPageToken("") + .addAllGoogleAdsLinks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + + ListGoogleAdsLinksPagedResponse pagedListResponse = client.listGoogleAdsLinks(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getGoogleAdsLinksList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listGoogleAdsLinksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + client.listGoogleAdsLinks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listGoogleAdsLinksTest2() throws Exception { + GoogleAdsLink responsesElement = GoogleAdsLink.newBuilder().build(); + ListGoogleAdsLinksResponse expectedResponse = + ListGoogleAdsLinksResponse.newBuilder() + .setNextPageToken("") + .addAllGoogleAdsLinks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + + ListGoogleAdsLinksPagedResponse pagedListResponse = client.listGoogleAdsLinks(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getGoogleAdsLinksList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listGoogleAdsLinksExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + client.listGoogleAdsLinks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDataSharingSettingsTest() throws Exception { + DataSharingSettings expectedResponse = + DataSharingSettings.newBuilder() + .setName(DataSharingSettingsName.of("[ACCOUNT]").toString()) + .setSharingWithGoogleSupportEnabled(true) + .setSharingWithGoogleAssignedSalesEnabled(true) + .setSharingWithGoogleAnySalesEnabled(true) + .setSharingWithGoogleProductsEnabled(true) + .setSharingWithOthersEnabled(true) + .build(); + mockService.addResponse(expectedResponse); + + DataSharingSettingsName name = DataSharingSettingsName.of("[ACCOUNT]"); + + DataSharingSettings actualResponse = client.getDataSharingSettings(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getDataSharingSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DataSharingSettingsName name = DataSharingSettingsName.of("[ACCOUNT]"); + client.getDataSharingSettings(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDataSharingSettingsTest2() throws Exception { + DataSharingSettings expectedResponse = + DataSharingSettings.newBuilder() + .setName(DataSharingSettingsName.of("[ACCOUNT]").toString()) + .setSharingWithGoogleSupportEnabled(true) + .setSharingWithGoogleAssignedSalesEnabled(true) + .setSharingWithGoogleAnySalesEnabled(true) + .setSharingWithGoogleProductsEnabled(true) + .setSharingWithOthersEnabled(true) + .build(); + mockService.addResponse(expectedResponse); + + String name = "accounts/account-7122/dataSharingSettings"; + + DataSharingSettings actualResponse = client.getDataSharingSettings(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getDataSharingSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "accounts/account-7122/dataSharingSettings"; + client.getDataSharingSettings(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getMeasurementProtocolSecretTest() throws Exception { + MeasurementProtocolSecret expectedResponse = + MeasurementProtocolSecret.newBuilder() + .setName( + MeasurementProtocolSecretName.of( + "[PROPERTY]", "[DATA_STREAM]", "[MEASUREMENT_PROTOCOL_SECRET]") + .toString()) + .setDisplayName("displayName1714148973") + .setSecretValue("secretValue-2044460895") + .build(); + mockService.addResponse(expectedResponse); + + MeasurementProtocolSecretName name = + MeasurementProtocolSecretName.of( + "[PROPERTY]", "[DATA_STREAM]", "[MEASUREMENT_PROTOCOL_SECRET]"); + + MeasurementProtocolSecret actualResponse = client.getMeasurementProtocolSecret(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getMeasurementProtocolSecretExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + MeasurementProtocolSecretName name = + MeasurementProtocolSecretName.of( + "[PROPERTY]", "[DATA_STREAM]", "[MEASUREMENT_PROTOCOL_SECRET]"); + client.getMeasurementProtocolSecret(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getMeasurementProtocolSecretTest2() throws Exception { + MeasurementProtocolSecret expectedResponse = + MeasurementProtocolSecret.newBuilder() + .setName( + MeasurementProtocolSecretName.of( + "[PROPERTY]", "[DATA_STREAM]", "[MEASUREMENT_PROTOCOL_SECRET]") + .toString()) + .setDisplayName("displayName1714148973") + .setSecretValue("secretValue-2044460895") + .build(); + mockService.addResponse(expectedResponse); + + String name = + "properties/propertie-6357/dataStreams/dataStream-6357/measurementProtocolSecrets/measurementProtocolSecret-6357"; + + MeasurementProtocolSecret actualResponse = client.getMeasurementProtocolSecret(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getMeasurementProtocolSecretExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "properties/propertie-6357/dataStreams/dataStream-6357/measurementProtocolSecrets/measurementProtocolSecret-6357"; + client.getMeasurementProtocolSecret(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listMeasurementProtocolSecretsTest() throws Exception { + MeasurementProtocolSecret responsesElement = MeasurementProtocolSecret.newBuilder().build(); + ListMeasurementProtocolSecretsResponse expectedResponse = + ListMeasurementProtocolSecretsResponse.newBuilder() + .setNextPageToken("") + .addAllMeasurementProtocolSecrets(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + DataStreamName parent = DataStreamName.of("[PROPERTY]", "[DATA_STREAM]"); + + ListMeasurementProtocolSecretsPagedResponse pagedListResponse = + client.listMeasurementProtocolSecrets(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getMeasurementProtocolSecretsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listMeasurementProtocolSecretsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DataStreamName parent = DataStreamName.of("[PROPERTY]", "[DATA_STREAM]"); + client.listMeasurementProtocolSecrets(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listMeasurementProtocolSecretsTest2() throws Exception { + MeasurementProtocolSecret responsesElement = MeasurementProtocolSecret.newBuilder().build(); + ListMeasurementProtocolSecretsResponse expectedResponse = + ListMeasurementProtocolSecretsResponse.newBuilder() + .setNextPageToken("") + .addAllMeasurementProtocolSecrets(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-9651/dataStreams/dataStream-9651"; + + ListMeasurementProtocolSecretsPagedResponse pagedListResponse = + client.listMeasurementProtocolSecrets(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getMeasurementProtocolSecretsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listMeasurementProtocolSecretsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-9651/dataStreams/dataStream-9651"; + client.listMeasurementProtocolSecrets(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createMeasurementProtocolSecretTest() throws Exception { + MeasurementProtocolSecret expectedResponse = + MeasurementProtocolSecret.newBuilder() + .setName( + MeasurementProtocolSecretName.of( + "[PROPERTY]", "[DATA_STREAM]", "[MEASUREMENT_PROTOCOL_SECRET]") + .toString()) + .setDisplayName("displayName1714148973") + .setSecretValue("secretValue-2044460895") + .build(); + mockService.addResponse(expectedResponse); + + DataStreamName parent = DataStreamName.of("[PROPERTY]", "[DATA_STREAM]"); + MeasurementProtocolSecret measurementProtocolSecret = + MeasurementProtocolSecret.newBuilder().build(); + + MeasurementProtocolSecret actualResponse = + client.createMeasurementProtocolSecret(parent, measurementProtocolSecret); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createMeasurementProtocolSecretExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DataStreamName parent = DataStreamName.of("[PROPERTY]", "[DATA_STREAM]"); + MeasurementProtocolSecret measurementProtocolSecret = + MeasurementProtocolSecret.newBuilder().build(); + client.createMeasurementProtocolSecret(parent, measurementProtocolSecret); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createMeasurementProtocolSecretTest2() throws Exception { + MeasurementProtocolSecret expectedResponse = + MeasurementProtocolSecret.newBuilder() + .setName( + MeasurementProtocolSecretName.of( + "[PROPERTY]", "[DATA_STREAM]", "[MEASUREMENT_PROTOCOL_SECRET]") + .toString()) + .setDisplayName("displayName1714148973") + .setSecretValue("secretValue-2044460895") + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-9651/dataStreams/dataStream-9651"; + MeasurementProtocolSecret measurementProtocolSecret = + MeasurementProtocolSecret.newBuilder().build(); + + MeasurementProtocolSecret actualResponse = + client.createMeasurementProtocolSecret(parent, measurementProtocolSecret); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createMeasurementProtocolSecretExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-9651/dataStreams/dataStream-9651"; + MeasurementProtocolSecret measurementProtocolSecret = + MeasurementProtocolSecret.newBuilder().build(); + client.createMeasurementProtocolSecret(parent, measurementProtocolSecret); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteMeasurementProtocolSecretTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + MeasurementProtocolSecretName name = + MeasurementProtocolSecretName.of( + "[PROPERTY]", "[DATA_STREAM]", "[MEASUREMENT_PROTOCOL_SECRET]"); + + client.deleteMeasurementProtocolSecret(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteMeasurementProtocolSecretExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + MeasurementProtocolSecretName name = + MeasurementProtocolSecretName.of( + "[PROPERTY]", "[DATA_STREAM]", "[MEASUREMENT_PROTOCOL_SECRET]"); + client.deleteMeasurementProtocolSecret(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteMeasurementProtocolSecretTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = + "properties/propertie-6357/dataStreams/dataStream-6357/measurementProtocolSecrets/measurementProtocolSecret-6357"; + + client.deleteMeasurementProtocolSecret(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteMeasurementProtocolSecretExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "properties/propertie-6357/dataStreams/dataStream-6357/measurementProtocolSecrets/measurementProtocolSecret-6357"; + client.deleteMeasurementProtocolSecret(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateMeasurementProtocolSecretTest() throws Exception { + MeasurementProtocolSecret expectedResponse = + MeasurementProtocolSecret.newBuilder() + .setName( + MeasurementProtocolSecretName.of( + "[PROPERTY]", "[DATA_STREAM]", "[MEASUREMENT_PROTOCOL_SECRET]") + .toString()) + .setDisplayName("displayName1714148973") + .setSecretValue("secretValue-2044460895") + .build(); + mockService.addResponse(expectedResponse); + + MeasurementProtocolSecret measurementProtocolSecret = + MeasurementProtocolSecret.newBuilder() + .setName( + MeasurementProtocolSecretName.of( + "[PROPERTY]", "[DATA_STREAM]", "[MEASUREMENT_PROTOCOL_SECRET]") + .toString()) + .setDisplayName("displayName1714148973") + .setSecretValue("secretValue-2044460895") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + MeasurementProtocolSecret actualResponse = + client.updateMeasurementProtocolSecret(measurementProtocolSecret, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateMeasurementProtocolSecretExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + MeasurementProtocolSecret measurementProtocolSecret = + MeasurementProtocolSecret.newBuilder() + .setName( + MeasurementProtocolSecretName.of( + "[PROPERTY]", "[DATA_STREAM]", "[MEASUREMENT_PROTOCOL_SECRET]") + .toString()) + .setDisplayName("displayName1714148973") + .setSecretValue("secretValue-2044460895") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateMeasurementProtocolSecret(measurementProtocolSecret, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void acknowledgeUserDataCollectionTest() throws Exception { + AcknowledgeUserDataCollectionResponse expectedResponse = + AcknowledgeUserDataCollectionResponse.newBuilder().build(); + mockService.addResponse(expectedResponse); + + AcknowledgeUserDataCollectionRequest request = + AcknowledgeUserDataCollectionRequest.newBuilder() + .setProperty(PropertyName.of("[PROPERTY]").toString()) + .setAcknowledgement("acknowledgement1769490938") + .build(); + + AcknowledgeUserDataCollectionResponse actualResponse = + client.acknowledgeUserDataCollection(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void acknowledgeUserDataCollectionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AcknowledgeUserDataCollectionRequest request = + AcknowledgeUserDataCollectionRequest.newBuilder() + .setProperty(PropertyName.of("[PROPERTY]").toString()) + .setAcknowledgement("acknowledgement1769490938") + .build(); + client.acknowledgeUserDataCollection(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void searchChangeHistoryEventsTest() throws Exception { + ChangeHistoryEvent responsesElement = ChangeHistoryEvent.newBuilder().build(); + SearchChangeHistoryEventsResponse expectedResponse = + SearchChangeHistoryEventsResponse.newBuilder() + .setNextPageToken("") + .addAllChangeHistoryEvents(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + SearchChangeHistoryEventsRequest request = + SearchChangeHistoryEventsRequest.newBuilder() + .setAccount(AccountName.of("[ACCOUNT]").toString()) + .setProperty(PropertyName.of("[PROPERTY]").toString()) + .addAllResourceType(new ArrayList()) + .addAllAction(new ArrayList()) + .addAllActorEmail(new ArrayList()) + .setEarliestChangeTime(Timestamp.newBuilder().build()) + .setLatestChangeTime(Timestamp.newBuilder().build()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + + SearchChangeHistoryEventsPagedResponse pagedListResponse = + client.searchChangeHistoryEvents(request); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getChangeHistoryEventsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void searchChangeHistoryEventsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SearchChangeHistoryEventsRequest request = + SearchChangeHistoryEventsRequest.newBuilder() + .setAccount(AccountName.of("[ACCOUNT]").toString()) + .setProperty(PropertyName.of("[PROPERTY]").toString()) + .addAllResourceType(new ArrayList()) + .addAllAction(new ArrayList()) + .addAllActorEmail(new ArrayList()) + .setEarliestChangeTime(Timestamp.newBuilder().build()) + .setLatestChangeTime(Timestamp.newBuilder().build()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + client.searchChangeHistoryEvents(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getGoogleSignalsSettingsTest() throws Exception { + GoogleSignalsSettings expectedResponse = + GoogleSignalsSettings.newBuilder() + .setName(GoogleSignalsSettingsName.of("[PROPERTY]").toString()) + .setState(GoogleSignalsState.forNumber(0)) + .setConsent(GoogleSignalsConsent.forNumber(0)) + .build(); + mockService.addResponse(expectedResponse); + + GoogleSignalsSettingsName name = GoogleSignalsSettingsName.of("[PROPERTY]"); + + GoogleSignalsSettings actualResponse = client.getGoogleSignalsSettings(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getGoogleSignalsSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GoogleSignalsSettingsName name = GoogleSignalsSettingsName.of("[PROPERTY]"); + client.getGoogleSignalsSettings(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getGoogleSignalsSettingsTest2() throws Exception { + GoogleSignalsSettings expectedResponse = + GoogleSignalsSettings.newBuilder() + .setName(GoogleSignalsSettingsName.of("[PROPERTY]").toString()) + .setState(GoogleSignalsState.forNumber(0)) + .setConsent(GoogleSignalsConsent.forNumber(0)) + .build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-7279/googleSignalsSettings"; + + GoogleSignalsSettings actualResponse = client.getGoogleSignalsSettings(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getGoogleSignalsSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-7279/googleSignalsSettings"; + client.getGoogleSignalsSettings(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateGoogleSignalsSettingsTest() throws Exception { + GoogleSignalsSettings expectedResponse = + GoogleSignalsSettings.newBuilder() + .setName(GoogleSignalsSettingsName.of("[PROPERTY]").toString()) + .setState(GoogleSignalsState.forNumber(0)) + .setConsent(GoogleSignalsConsent.forNumber(0)) + .build(); + mockService.addResponse(expectedResponse); + + GoogleSignalsSettings googleSignalsSettings = + GoogleSignalsSettings.newBuilder() + .setName(GoogleSignalsSettingsName.of("[PROPERTY]").toString()) + .setState(GoogleSignalsState.forNumber(0)) + .setConsent(GoogleSignalsConsent.forNumber(0)) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + GoogleSignalsSettings actualResponse = + client.updateGoogleSignalsSettings(googleSignalsSettings, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateGoogleSignalsSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + GoogleSignalsSettings googleSignalsSettings = + GoogleSignalsSettings.newBuilder() + .setName(GoogleSignalsSettingsName.of("[PROPERTY]").toString()) + .setState(GoogleSignalsState.forNumber(0)) + .setConsent(GoogleSignalsConsent.forNumber(0)) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateGoogleSignalsSettings(googleSignalsSettings, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createConversionEventTest() throws Exception { + ConversionEvent expectedResponse = + ConversionEvent.newBuilder() + .setName(ConversionEventName.of("[PROPERTY]", "[CONVERSION_EVENT]").toString()) + .setEventName("eventName31228997") + .setCreateTime(Timestamp.newBuilder().build()) + .setDeletable(true) + .setCustom(true) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + ConversionEvent conversionEvent = ConversionEvent.newBuilder().build(); + + ConversionEvent actualResponse = client.createConversionEvent(parent, conversionEvent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createConversionEventExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + ConversionEvent conversionEvent = ConversionEvent.newBuilder().build(); + client.createConversionEvent(parent, conversionEvent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createConversionEventTest2() throws Exception { + ConversionEvent expectedResponse = + ConversionEvent.newBuilder() + .setName(ConversionEventName.of("[PROPERTY]", "[CONVERSION_EVENT]").toString()) + .setEventName("eventName31228997") + .setCreateTime(Timestamp.newBuilder().build()) + .setDeletable(true) + .setCustom(true) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + ConversionEvent conversionEvent = ConversionEvent.newBuilder().build(); + + ConversionEvent actualResponse = client.createConversionEvent(parent, conversionEvent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createConversionEventExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + ConversionEvent conversionEvent = ConversionEvent.newBuilder().build(); + client.createConversionEvent(parent, conversionEvent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getConversionEventTest() throws Exception { + ConversionEvent expectedResponse = + ConversionEvent.newBuilder() + .setName(ConversionEventName.of("[PROPERTY]", "[CONVERSION_EVENT]").toString()) + .setEventName("eventName31228997") + .setCreateTime(Timestamp.newBuilder().build()) + .setDeletable(true) + .setCustom(true) + .build(); + mockService.addResponse(expectedResponse); + + ConversionEventName name = ConversionEventName.of("[PROPERTY]", "[CONVERSION_EVENT]"); + + ConversionEvent actualResponse = client.getConversionEvent(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getConversionEventExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConversionEventName name = ConversionEventName.of("[PROPERTY]", "[CONVERSION_EVENT]"); + client.getConversionEvent(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getConversionEventTest2() throws Exception { + ConversionEvent expectedResponse = + ConversionEvent.newBuilder() + .setName(ConversionEventName.of("[PROPERTY]", "[CONVERSION_EVENT]").toString()) + .setEventName("eventName31228997") + .setCreateTime(Timestamp.newBuilder().build()) + .setDeletable(true) + .setCustom(true) + .build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-4144/conversionEvents/conversionEvent-4144"; + + ConversionEvent actualResponse = client.getConversionEvent(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getConversionEventExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-4144/conversionEvents/conversionEvent-4144"; + client.getConversionEvent(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteConversionEventTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ConversionEventName name = ConversionEventName.of("[PROPERTY]", "[CONVERSION_EVENT]"); + + client.deleteConversionEvent(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteConversionEventExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConversionEventName name = ConversionEventName.of("[PROPERTY]", "[CONVERSION_EVENT]"); + client.deleteConversionEvent(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteConversionEventTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-4144/conversionEvents/conversionEvent-4144"; + + client.deleteConversionEvent(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteConversionEventExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-4144/conversionEvents/conversionEvent-4144"; + client.deleteConversionEvent(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listConversionEventsTest() throws Exception { + ConversionEvent responsesElement = ConversionEvent.newBuilder().build(); + ListConversionEventsResponse expectedResponse = + ListConversionEventsResponse.newBuilder() + .setNextPageToken("") + .addAllConversionEvents(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + + ListConversionEventsPagedResponse pagedListResponse = client.listConversionEvents(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getConversionEventsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listConversionEventsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + client.listConversionEvents(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listConversionEventsTest2() throws Exception { + ConversionEvent responsesElement = ConversionEvent.newBuilder().build(); + ListConversionEventsResponse expectedResponse = + ListConversionEventsResponse.newBuilder() + .setNextPageToken("") + .addAllConversionEvents(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + + ListConversionEventsPagedResponse pagedListResponse = client.listConversionEvents(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getConversionEventsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listConversionEventsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + client.listConversionEvents(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDisplayVideo360AdvertiserLinkTest() throws Exception { + DisplayVideo360AdvertiserLink expectedResponse = + DisplayVideo360AdvertiserLink.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK]") + .toString()) + .setAdvertiserId("advertiserId550061990") + .setAdvertiserDisplayName("advertiserDisplayName1594116162") + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCampaignDataSharingEnabled(BoolValue.newBuilder().build()) + .setCostDataSharingEnabled(BoolValue.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + DisplayVideo360AdvertiserLinkName name = + DisplayVideo360AdvertiserLinkName.of("[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK]"); + + DisplayVideo360AdvertiserLink actualResponse = client.getDisplayVideo360AdvertiserLink(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getDisplayVideo360AdvertiserLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DisplayVideo360AdvertiserLinkName name = + DisplayVideo360AdvertiserLinkName.of("[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK]"); + client.getDisplayVideo360AdvertiserLink(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDisplayVideo360AdvertiserLinkTest2() throws Exception { + DisplayVideo360AdvertiserLink expectedResponse = + DisplayVideo360AdvertiserLink.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK]") + .toString()) + .setAdvertiserId("advertiserId550061990") + .setAdvertiserDisplayName("advertiserDisplayName1594116162") + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCampaignDataSharingEnabled(BoolValue.newBuilder().build()) + .setCostDataSharingEnabled(BoolValue.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "properties/propertie-7275/displayVideo360AdvertiserLinks/displayVideo360AdvertiserLink-7275"; + + DisplayVideo360AdvertiserLink actualResponse = client.getDisplayVideo360AdvertiserLink(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getDisplayVideo360AdvertiserLinkExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "properties/propertie-7275/displayVideo360AdvertiserLinks/displayVideo360AdvertiserLink-7275"; + client.getDisplayVideo360AdvertiserLink(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDisplayVideo360AdvertiserLinksTest() throws Exception { + DisplayVideo360AdvertiserLink responsesElement = + DisplayVideo360AdvertiserLink.newBuilder().build(); + ListDisplayVideo360AdvertiserLinksResponse expectedResponse = + ListDisplayVideo360AdvertiserLinksResponse.newBuilder() + .setNextPageToken("") + .addAllDisplayVideo360AdvertiserLinks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + + ListDisplayVideo360AdvertiserLinksPagedResponse pagedListResponse = + client.listDisplayVideo360AdvertiserLinks(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getDisplayVideo360AdvertiserLinksList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listDisplayVideo360AdvertiserLinksExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + client.listDisplayVideo360AdvertiserLinks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDisplayVideo360AdvertiserLinksTest2() throws Exception { + DisplayVideo360AdvertiserLink responsesElement = + DisplayVideo360AdvertiserLink.newBuilder().build(); + ListDisplayVideo360AdvertiserLinksResponse expectedResponse = + ListDisplayVideo360AdvertiserLinksResponse.newBuilder() + .setNextPageToken("") + .addAllDisplayVideo360AdvertiserLinks(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + + ListDisplayVideo360AdvertiserLinksPagedResponse pagedListResponse = + client.listDisplayVideo360AdvertiserLinks(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getDisplayVideo360AdvertiserLinksList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listDisplayVideo360AdvertiserLinksExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + client.listDisplayVideo360AdvertiserLinks(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDisplayVideo360AdvertiserLinkTest() throws Exception { + DisplayVideo360AdvertiserLink expectedResponse = + DisplayVideo360AdvertiserLink.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK]") + .toString()) + .setAdvertiserId("advertiserId550061990") + .setAdvertiserDisplayName("advertiserDisplayName1594116162") + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCampaignDataSharingEnabled(BoolValue.newBuilder().build()) + .setCostDataSharingEnabled(BoolValue.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + DisplayVideo360AdvertiserLink displayVideo360AdvertiserLink = + DisplayVideo360AdvertiserLink.newBuilder().build(); + + DisplayVideo360AdvertiserLink actualResponse = + client.createDisplayVideo360AdvertiserLink(parent, displayVideo360AdvertiserLink); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createDisplayVideo360AdvertiserLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + DisplayVideo360AdvertiserLink displayVideo360AdvertiserLink = + DisplayVideo360AdvertiserLink.newBuilder().build(); + client.createDisplayVideo360AdvertiserLink(parent, displayVideo360AdvertiserLink); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDisplayVideo360AdvertiserLinkTest2() throws Exception { + DisplayVideo360AdvertiserLink expectedResponse = + DisplayVideo360AdvertiserLink.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK]") + .toString()) + .setAdvertiserId("advertiserId550061990") + .setAdvertiserDisplayName("advertiserDisplayName1594116162") + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCampaignDataSharingEnabled(BoolValue.newBuilder().build()) + .setCostDataSharingEnabled(BoolValue.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + DisplayVideo360AdvertiserLink displayVideo360AdvertiserLink = + DisplayVideo360AdvertiserLink.newBuilder().build(); + + DisplayVideo360AdvertiserLink actualResponse = + client.createDisplayVideo360AdvertiserLink(parent, displayVideo360AdvertiserLink); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createDisplayVideo360AdvertiserLinkExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + DisplayVideo360AdvertiserLink displayVideo360AdvertiserLink = + DisplayVideo360AdvertiserLink.newBuilder().build(); + client.createDisplayVideo360AdvertiserLink(parent, displayVideo360AdvertiserLink); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteDisplayVideo360AdvertiserLinkTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + DisplayVideo360AdvertiserLinkName name = + DisplayVideo360AdvertiserLinkName.of("[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK]"); + + client.deleteDisplayVideo360AdvertiserLink(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteDisplayVideo360AdvertiserLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DisplayVideo360AdvertiserLinkName name = + DisplayVideo360AdvertiserLinkName.of("[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK]"); + client.deleteDisplayVideo360AdvertiserLink(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteDisplayVideo360AdvertiserLinkTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = + "properties/propertie-7275/displayVideo360AdvertiserLinks/displayVideo360AdvertiserLink-7275"; + + client.deleteDisplayVideo360AdvertiserLink(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteDisplayVideo360AdvertiserLinkExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "properties/propertie-7275/displayVideo360AdvertiserLinks/displayVideo360AdvertiserLink-7275"; + client.deleteDisplayVideo360AdvertiserLink(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateDisplayVideo360AdvertiserLinkTest() throws Exception { + DisplayVideo360AdvertiserLink expectedResponse = + DisplayVideo360AdvertiserLink.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK]") + .toString()) + .setAdvertiserId("advertiserId550061990") + .setAdvertiserDisplayName("advertiserDisplayName1594116162") + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCampaignDataSharingEnabled(BoolValue.newBuilder().build()) + .setCostDataSharingEnabled(BoolValue.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + DisplayVideo360AdvertiserLink displayVideo360AdvertiserLink = + DisplayVideo360AdvertiserLink.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK]") + .toString()) + .setAdvertiserId("advertiserId550061990") + .setAdvertiserDisplayName("advertiserDisplayName1594116162") + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCampaignDataSharingEnabled(BoolValue.newBuilder().build()) + .setCostDataSharingEnabled(BoolValue.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + DisplayVideo360AdvertiserLink actualResponse = + client.updateDisplayVideo360AdvertiserLink(displayVideo360AdvertiserLink, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateDisplayVideo360AdvertiserLinkExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DisplayVideo360AdvertiserLink displayVideo360AdvertiserLink = + DisplayVideo360AdvertiserLink.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK]") + .toString()) + .setAdvertiserId("advertiserId550061990") + .setAdvertiserDisplayName("advertiserDisplayName1594116162") + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCampaignDataSharingEnabled(BoolValue.newBuilder().build()) + .setCostDataSharingEnabled(BoolValue.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateDisplayVideo360AdvertiserLink(displayVideo360AdvertiserLink, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDisplayVideo360AdvertiserLinkProposalTest() throws Exception { + DisplayVideo360AdvertiserLinkProposal expectedResponse = + DisplayVideo360AdvertiserLinkProposal.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]") + .toString()) + .setAdvertiserId("advertiserId550061990") + .setLinkProposalStatusDetails(LinkProposalStatusDetails.newBuilder().build()) + .setAdvertiserDisplayName("advertiserDisplayName1594116162") + .setValidationEmail("validationEmail-94407005") + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCampaignDataSharingEnabled(BoolValue.newBuilder().build()) + .setCostDataSharingEnabled(BoolValue.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + DisplayVideo360AdvertiserLinkProposalName name = + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]"); + + DisplayVideo360AdvertiserLinkProposal actualResponse = + client.getDisplayVideo360AdvertiserLinkProposal(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getDisplayVideo360AdvertiserLinkProposalExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DisplayVideo360AdvertiserLinkProposalName name = + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]"); + client.getDisplayVideo360AdvertiserLinkProposal(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDisplayVideo360AdvertiserLinkProposalTest2() throws Exception { + DisplayVideo360AdvertiserLinkProposal expectedResponse = + DisplayVideo360AdvertiserLinkProposal.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]") + .toString()) + .setAdvertiserId("advertiserId550061990") + .setLinkProposalStatusDetails(LinkProposalStatusDetails.newBuilder().build()) + .setAdvertiserDisplayName("advertiserDisplayName1594116162") + .setValidationEmail("validationEmail-94407005") + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCampaignDataSharingEnabled(BoolValue.newBuilder().build()) + .setCostDataSharingEnabled(BoolValue.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "properties/propertie-8473/displayVideo360AdvertiserLinkProposals/displayVideo360AdvertiserLinkProposal-8473"; + + DisplayVideo360AdvertiserLinkProposal actualResponse = + client.getDisplayVideo360AdvertiserLinkProposal(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getDisplayVideo360AdvertiserLinkProposalExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "properties/propertie-8473/displayVideo360AdvertiserLinkProposals/displayVideo360AdvertiserLinkProposal-8473"; + client.getDisplayVideo360AdvertiserLinkProposal(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDisplayVideo360AdvertiserLinkProposalsTest() throws Exception { + DisplayVideo360AdvertiserLinkProposal responsesElement = + DisplayVideo360AdvertiserLinkProposal.newBuilder().build(); + ListDisplayVideo360AdvertiserLinkProposalsResponse expectedResponse = + ListDisplayVideo360AdvertiserLinkProposalsResponse.newBuilder() + .setNextPageToken("") + .addAllDisplayVideo360AdvertiserLinkProposals(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + + ListDisplayVideo360AdvertiserLinkProposalsPagedResponse pagedListResponse = + client.listDisplayVideo360AdvertiserLinkProposals(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getDisplayVideo360AdvertiserLinkProposalsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listDisplayVideo360AdvertiserLinkProposalsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + client.listDisplayVideo360AdvertiserLinkProposals(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDisplayVideo360AdvertiserLinkProposalsTest2() throws Exception { + DisplayVideo360AdvertiserLinkProposal responsesElement = + DisplayVideo360AdvertiserLinkProposal.newBuilder().build(); + ListDisplayVideo360AdvertiserLinkProposalsResponse expectedResponse = + ListDisplayVideo360AdvertiserLinkProposalsResponse.newBuilder() + .setNextPageToken("") + .addAllDisplayVideo360AdvertiserLinkProposals(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + + ListDisplayVideo360AdvertiserLinkProposalsPagedResponse pagedListResponse = + client.listDisplayVideo360AdvertiserLinkProposals(parent); + + List resources = + Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals( + expectedResponse.getDisplayVideo360AdvertiserLinkProposalsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listDisplayVideo360AdvertiserLinkProposalsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + client.listDisplayVideo360AdvertiserLinkProposals(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDisplayVideo360AdvertiserLinkProposalTest() throws Exception { + DisplayVideo360AdvertiserLinkProposal expectedResponse = + DisplayVideo360AdvertiserLinkProposal.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]") + .toString()) + .setAdvertiserId("advertiserId550061990") + .setLinkProposalStatusDetails(LinkProposalStatusDetails.newBuilder().build()) + .setAdvertiserDisplayName("advertiserDisplayName1594116162") + .setValidationEmail("validationEmail-94407005") + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCampaignDataSharingEnabled(BoolValue.newBuilder().build()) + .setCostDataSharingEnabled(BoolValue.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + DisplayVideo360AdvertiserLinkProposal displayVideo360AdvertiserLinkProposal = + DisplayVideo360AdvertiserLinkProposal.newBuilder().build(); + + DisplayVideo360AdvertiserLinkProposal actualResponse = + client.createDisplayVideo360AdvertiserLinkProposal( + parent, displayVideo360AdvertiserLinkProposal); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createDisplayVideo360AdvertiserLinkProposalExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + DisplayVideo360AdvertiserLinkProposal displayVideo360AdvertiserLinkProposal = + DisplayVideo360AdvertiserLinkProposal.newBuilder().build(); + client.createDisplayVideo360AdvertiserLinkProposal( + parent, displayVideo360AdvertiserLinkProposal); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDisplayVideo360AdvertiserLinkProposalTest2() throws Exception { + DisplayVideo360AdvertiserLinkProposal expectedResponse = + DisplayVideo360AdvertiserLinkProposal.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]") + .toString()) + .setAdvertiserId("advertiserId550061990") + .setLinkProposalStatusDetails(LinkProposalStatusDetails.newBuilder().build()) + .setAdvertiserDisplayName("advertiserDisplayName1594116162") + .setValidationEmail("validationEmail-94407005") + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCampaignDataSharingEnabled(BoolValue.newBuilder().build()) + .setCostDataSharingEnabled(BoolValue.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + DisplayVideo360AdvertiserLinkProposal displayVideo360AdvertiserLinkProposal = + DisplayVideo360AdvertiserLinkProposal.newBuilder().build(); + + DisplayVideo360AdvertiserLinkProposal actualResponse = + client.createDisplayVideo360AdvertiserLinkProposal( + parent, displayVideo360AdvertiserLinkProposal); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createDisplayVideo360AdvertiserLinkProposalExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + DisplayVideo360AdvertiserLinkProposal displayVideo360AdvertiserLinkProposal = + DisplayVideo360AdvertiserLinkProposal.newBuilder().build(); + client.createDisplayVideo360AdvertiserLinkProposal( + parent, displayVideo360AdvertiserLinkProposal); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteDisplayVideo360AdvertiserLinkProposalTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + DisplayVideo360AdvertiserLinkProposalName name = + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]"); + + client.deleteDisplayVideo360AdvertiserLinkProposal(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteDisplayVideo360AdvertiserLinkProposalExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DisplayVideo360AdvertiserLinkProposalName name = + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]"); + client.deleteDisplayVideo360AdvertiserLinkProposal(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteDisplayVideo360AdvertiserLinkProposalTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = + "properties/propertie-8473/displayVideo360AdvertiserLinkProposals/displayVideo360AdvertiserLinkProposal-8473"; + + client.deleteDisplayVideo360AdvertiserLinkProposal(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteDisplayVideo360AdvertiserLinkProposalExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "properties/propertie-8473/displayVideo360AdvertiserLinkProposals/displayVideo360AdvertiserLinkProposal-8473"; + client.deleteDisplayVideo360AdvertiserLinkProposal(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void approveDisplayVideo360AdvertiserLinkProposalTest() throws Exception { + ApproveDisplayVideo360AdvertiserLinkProposalResponse expectedResponse = + ApproveDisplayVideo360AdvertiserLinkProposalResponse.newBuilder() + .setDisplayVideo360AdvertiserLink(DisplayVideo360AdvertiserLink.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + ApproveDisplayVideo360AdvertiserLinkProposalRequest request = + ApproveDisplayVideo360AdvertiserLinkProposalRequest.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]") + .toString()) + .build(); + + ApproveDisplayVideo360AdvertiserLinkProposalResponse actualResponse = + client.approveDisplayVideo360AdvertiserLinkProposal(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void approveDisplayVideo360AdvertiserLinkProposalExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ApproveDisplayVideo360AdvertiserLinkProposalRequest request = + ApproveDisplayVideo360AdvertiserLinkProposalRequest.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]") + .toString()) + .build(); + client.approveDisplayVideo360AdvertiserLinkProposal(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void cancelDisplayVideo360AdvertiserLinkProposalTest() throws Exception { + DisplayVideo360AdvertiserLinkProposal expectedResponse = + DisplayVideo360AdvertiserLinkProposal.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]") + .toString()) + .setAdvertiserId("advertiserId550061990") + .setLinkProposalStatusDetails(LinkProposalStatusDetails.newBuilder().build()) + .setAdvertiserDisplayName("advertiserDisplayName1594116162") + .setValidationEmail("validationEmail-94407005") + .setAdsPersonalizationEnabled(BoolValue.newBuilder().build()) + .setCampaignDataSharingEnabled(BoolValue.newBuilder().build()) + .setCostDataSharingEnabled(BoolValue.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + CancelDisplayVideo360AdvertiserLinkProposalRequest request = + CancelDisplayVideo360AdvertiserLinkProposalRequest.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]") + .toString()) + .build(); + + DisplayVideo360AdvertiserLinkProposal actualResponse = + client.cancelDisplayVideo360AdvertiserLinkProposal(request); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void cancelDisplayVideo360AdvertiserLinkProposalExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CancelDisplayVideo360AdvertiserLinkProposalRequest request = + CancelDisplayVideo360AdvertiserLinkProposalRequest.newBuilder() + .setName( + DisplayVideo360AdvertiserLinkProposalName.of( + "[PROPERTY]", "[DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL]") + .toString()) + .build(); + client.cancelDisplayVideo360AdvertiserLinkProposal(request); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCustomDimensionTest() throws Exception { + CustomDimension expectedResponse = + CustomDimension.newBuilder() + .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setDisallowAdsPersonalization(true) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + CustomDimension customDimension = CustomDimension.newBuilder().build(); + + CustomDimension actualResponse = client.createCustomDimension(parent, customDimension); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createCustomDimensionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + CustomDimension customDimension = CustomDimension.newBuilder().build(); + client.createCustomDimension(parent, customDimension); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCustomDimensionTest2() throws Exception { + CustomDimension expectedResponse = + CustomDimension.newBuilder() + .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setDisallowAdsPersonalization(true) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + CustomDimension customDimension = CustomDimension.newBuilder().build(); + + CustomDimension actualResponse = client.createCustomDimension(parent, customDimension); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createCustomDimensionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + CustomDimension customDimension = CustomDimension.newBuilder().build(); + client.createCustomDimension(parent, customDimension); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCustomDimensionTest() throws Exception { + CustomDimension expectedResponse = + CustomDimension.newBuilder() + .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setDisallowAdsPersonalization(true) + .build(); + mockService.addResponse(expectedResponse); + + CustomDimension customDimension = + CustomDimension.newBuilder() + .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setDisallowAdsPersonalization(true) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CustomDimension actualResponse = client.updateCustomDimension(customDimension, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateCustomDimensionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomDimension customDimension = + CustomDimension.newBuilder() + .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setDisallowAdsPersonalization(true) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCustomDimension(customDimension, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCustomDimensionsTest() throws Exception { + CustomDimension responsesElement = CustomDimension.newBuilder().build(); + ListCustomDimensionsResponse expectedResponse = + ListCustomDimensionsResponse.newBuilder() + .setNextPageToken("") + .addAllCustomDimensions(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + + ListCustomDimensionsPagedResponse pagedListResponse = client.listCustomDimensions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCustomDimensionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listCustomDimensionsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + client.listCustomDimensions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCustomDimensionsTest2() throws Exception { + CustomDimension responsesElement = CustomDimension.newBuilder().build(); + ListCustomDimensionsResponse expectedResponse = + ListCustomDimensionsResponse.newBuilder() + .setNextPageToken("") + .addAllCustomDimensions(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + + ListCustomDimensionsPagedResponse pagedListResponse = client.listCustomDimensions(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCustomDimensionsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listCustomDimensionsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + client.listCustomDimensions(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void archiveCustomDimensionTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + CustomDimensionName name = CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]"); + + client.archiveCustomDimension(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void archiveCustomDimensionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomDimensionName name = CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]"); + client.archiveCustomDimension(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void archiveCustomDimensionTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-447/customDimensions/customDimension-447"; + + client.archiveCustomDimension(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void archiveCustomDimensionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-447/customDimensions/customDimension-447"; + client.archiveCustomDimension(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCustomDimensionTest() throws Exception { + CustomDimension expectedResponse = + CustomDimension.newBuilder() + .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setDisallowAdsPersonalization(true) + .build(); + mockService.addResponse(expectedResponse); + + CustomDimensionName name = CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]"); + + CustomDimension actualResponse = client.getCustomDimension(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getCustomDimensionExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomDimensionName name = CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]"); + client.getCustomDimension(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCustomDimensionTest2() throws Exception { + CustomDimension expectedResponse = + CustomDimension.newBuilder() + .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .setDisallowAdsPersonalization(true) + .build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-447/customDimensions/customDimension-447"; + + CustomDimension actualResponse = client.getCustomDimension(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getCustomDimensionExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-447/customDimensions/customDimension-447"; + client.getCustomDimension(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCustomMetricTest() throws Exception { + CustomMetric expectedResponse = + CustomMetric.newBuilder() + .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllRestrictedMetricType(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + CustomMetric customMetric = CustomMetric.newBuilder().build(); + + CustomMetric actualResponse = client.createCustomMetric(parent, customMetric); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createCustomMetricExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + CustomMetric customMetric = CustomMetric.newBuilder().build(); + client.createCustomMetric(parent, customMetric); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createCustomMetricTest2() throws Exception { + CustomMetric expectedResponse = + CustomMetric.newBuilder() + .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllRestrictedMetricType(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + CustomMetric customMetric = CustomMetric.newBuilder().build(); + + CustomMetric actualResponse = client.createCustomMetric(parent, customMetric); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createCustomMetricExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + CustomMetric customMetric = CustomMetric.newBuilder().build(); + client.createCustomMetric(parent, customMetric); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateCustomMetricTest() throws Exception { + CustomMetric expectedResponse = + CustomMetric.newBuilder() + .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllRestrictedMetricType(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + CustomMetric customMetric = + CustomMetric.newBuilder() + .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllRestrictedMetricType(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + CustomMetric actualResponse = client.updateCustomMetric(customMetric, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateCustomMetricExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomMetric customMetric = + CustomMetric.newBuilder() + .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllRestrictedMetricType(new ArrayList()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateCustomMetric(customMetric, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCustomMetricsTest() throws Exception { + CustomMetric responsesElement = CustomMetric.newBuilder().build(); + ListCustomMetricsResponse expectedResponse = + ListCustomMetricsResponse.newBuilder() + .setNextPageToken("") + .addAllCustomMetrics(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + + ListCustomMetricsPagedResponse pagedListResponse = client.listCustomMetrics(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCustomMetricsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listCustomMetricsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + client.listCustomMetrics(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listCustomMetricsTest2() throws Exception { + CustomMetric responsesElement = CustomMetric.newBuilder().build(); + ListCustomMetricsResponse expectedResponse = + ListCustomMetricsResponse.newBuilder() + .setNextPageToken("") + .addAllCustomMetrics(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + + ListCustomMetricsPagedResponse pagedListResponse = client.listCustomMetrics(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getCustomMetricsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listCustomMetricsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + client.listCustomMetrics(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void archiveCustomMetricTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + CustomMetricName name = CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]"); + + client.archiveCustomMetric(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void archiveCustomMetricExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomMetricName name = CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]"); + client.archiveCustomMetric(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void archiveCustomMetricTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-2999/customMetrics/customMetric-2999"; + + client.archiveCustomMetric(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void archiveCustomMetricExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-2999/customMetrics/customMetric-2999"; + client.archiveCustomMetric(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCustomMetricTest() throws Exception { + CustomMetric expectedResponse = + CustomMetric.newBuilder() + .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllRestrictedMetricType(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + CustomMetricName name = CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]"); + + CustomMetric actualResponse = client.getCustomMetric(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getCustomMetricExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + CustomMetricName name = CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]"); + client.getCustomMetric(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getCustomMetricTest2() throws Exception { + CustomMetric expectedResponse = + CustomMetric.newBuilder() + .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) + .setParameterName("parameterName-379607596") + .setDisplayName("displayName1714148973") + .setDescription("description-1724546052") + .addAllRestrictedMetricType(new ArrayList()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-2999/customMetrics/customMetric-2999"; + + CustomMetric actualResponse = client.getCustomMetric(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getCustomMetricExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-2999/customMetrics/customMetric-2999"; + client.getCustomMetric(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDataRetentionSettingsTest() throws Exception { + DataRetentionSettings expectedResponse = + DataRetentionSettings.newBuilder() + .setName(DataRetentionSettingsName.of("[PROPERTY]").toString()) + .setResetUserDataOnNewActivity(true) + .build(); + mockService.addResponse(expectedResponse); + + DataRetentionSettingsName name = DataRetentionSettingsName.of("[PROPERTY]"); + + DataRetentionSettings actualResponse = client.getDataRetentionSettings(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getDataRetentionSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DataRetentionSettingsName name = DataRetentionSettingsName.of("[PROPERTY]"); + client.getDataRetentionSettings(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDataRetentionSettingsTest2() throws Exception { + DataRetentionSettings expectedResponse = + DataRetentionSettings.newBuilder() + .setName(DataRetentionSettingsName.of("[PROPERTY]").toString()) + .setResetUserDataOnNewActivity(true) + .build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-2463/dataRetentionSettings"; + + DataRetentionSettings actualResponse = client.getDataRetentionSettings(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getDataRetentionSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-2463/dataRetentionSettings"; + client.getDataRetentionSettings(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateDataRetentionSettingsTest() throws Exception { + DataRetentionSettings expectedResponse = + DataRetentionSettings.newBuilder() + .setName(DataRetentionSettingsName.of("[PROPERTY]").toString()) + .setResetUserDataOnNewActivity(true) + .build(); + mockService.addResponse(expectedResponse); + + DataRetentionSettings dataRetentionSettings = + DataRetentionSettings.newBuilder() + .setName(DataRetentionSettingsName.of("[PROPERTY]").toString()) + .setResetUserDataOnNewActivity(true) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + DataRetentionSettings actualResponse = + client.updateDataRetentionSettings(dataRetentionSettings, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateDataRetentionSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DataRetentionSettings dataRetentionSettings = + DataRetentionSettings.newBuilder() + .setName(DataRetentionSettingsName.of("[PROPERTY]").toString()) + .setResetUserDataOnNewActivity(true) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateDataRetentionSettings(dataRetentionSettings, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDataStreamTest() throws Exception { + DataStream expectedResponse = + DataStream.newBuilder() + .setName(DataStreamName.of("[PROPERTY]", "[DATA_STREAM]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + DataStream dataStream = DataStream.newBuilder().build(); + + DataStream actualResponse = client.createDataStream(parent, dataStream); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createDataStreamExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + DataStream dataStream = DataStream.newBuilder().build(); + client.createDataStream(parent, dataStream); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createDataStreamTest2() throws Exception { + DataStream expectedResponse = + DataStream.newBuilder() + .setName(DataStreamName.of("[PROPERTY]", "[DATA_STREAM]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + DataStream dataStream = DataStream.newBuilder().build(); + + DataStream actualResponse = client.createDataStream(parent, dataStream); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createDataStreamExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + DataStream dataStream = DataStream.newBuilder().build(); + client.createDataStream(parent, dataStream); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteDataStreamTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + DataStreamName name = DataStreamName.of("[PROPERTY]", "[DATA_STREAM]"); + + client.deleteDataStream(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteDataStreamExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DataStreamName name = DataStreamName.of("[PROPERTY]", "[DATA_STREAM]"); + client.deleteDataStream(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteDataStreamTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-9806/dataStreams/dataStream-9806"; + + client.deleteDataStream(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteDataStreamExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-9806/dataStreams/dataStream-9806"; + client.deleteDataStream(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateDataStreamTest() throws Exception { + DataStream expectedResponse = + DataStream.newBuilder() + .setName(DataStreamName.of("[PROPERTY]", "[DATA_STREAM]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + DataStream dataStream = + DataStream.newBuilder() + .setName(DataStreamName.of("[PROPERTY]", "[DATA_STREAM]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + DataStream actualResponse = client.updateDataStream(dataStream, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateDataStreamExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DataStream dataStream = + DataStream.newBuilder() + .setName(DataStreamName.of("[PROPERTY]", "[DATA_STREAM]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateDataStream(dataStream, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDataStreamsTest() throws Exception { + DataStream responsesElement = DataStream.newBuilder().build(); + ListDataStreamsResponse expectedResponse = + ListDataStreamsResponse.newBuilder() + .setNextPageToken("") + .addAllDataStreams(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + PropertyName parent = PropertyName.of("[PROPERTY]"); + + ListDataStreamsPagedResponse pagedListResponse = client.listDataStreams(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDataStreamsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listDataStreamsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PropertyName parent = PropertyName.of("[PROPERTY]"); + client.listDataStreams(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listDataStreamsTest2() throws Exception { + DataStream responsesElement = DataStream.newBuilder().build(); + ListDataStreamsResponse expectedResponse = + ListDataStreamsResponse.newBuilder() + .setNextPageToken("") + .addAllDataStreams(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "properties/propertie-2024"; + + ListDataStreamsPagedResponse pagedListResponse = client.listDataStreams(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getDataStreamsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listDataStreamsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "properties/propertie-2024"; + client.listDataStreams(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDataStreamTest() throws Exception { + DataStream expectedResponse = + DataStream.newBuilder() + .setName(DataStreamName.of("[PROPERTY]", "[DATA_STREAM]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + DataStreamName name = DataStreamName.of("[PROPERTY]", "[DATA_STREAM]"); + + DataStream actualResponse = client.getDataStream(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getDataStreamExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + DataStreamName name = DataStreamName.of("[PROPERTY]", "[DATA_STREAM]"); + client.getDataStream(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getDataStreamTest2() throws Exception { + DataStream expectedResponse = + DataStream.newBuilder() + .setName(DataStreamName.of("[PROPERTY]", "[DATA_STREAM]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "properties/propertie-9806/dataStreams/dataStream-9806"; + + DataStream actualResponse = client.getDataStream(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getDataStreamExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "properties/propertie-9806/dataStreams/dataStream-9806"; + client.getDataStream(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-analytics-admin/google-analytics-admin/src/test/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceClientTest.java b/java-analytics-admin/google-analytics-admin/src/test/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceClientTest.java index 1936c6dacb3a..d43710b2e502 100644 --- a/java-analytics-admin/google-analytics-admin/src/test/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceClientTest.java +++ b/java-analytics-admin/google-analytics-admin/src/test/java/com/google/analytics/admin/v1alpha/AnalyticsAdminServiceClientTest.java @@ -4146,7 +4146,7 @@ public void cancelDisplayVideo360AdvertiserLinkProposalExceptionTest() throws Ex public void createCustomDimensionTest() throws Exception { CustomDimension expectedResponse = CustomDimension.newBuilder() - .setName(CustomDimensionName.of("[PROPERTY]").toString()) + .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) .setParameterName("parameterName-379607596") .setDisplayName("displayName1714148973") .setDescription("description-1724546052") @@ -4192,7 +4192,7 @@ public void createCustomDimensionExceptionTest() throws Exception { public void createCustomDimensionTest2() throws Exception { CustomDimension expectedResponse = CustomDimension.newBuilder() - .setName(CustomDimensionName.of("[PROPERTY]").toString()) + .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) .setParameterName("parameterName-379607596") .setDisplayName("displayName1714148973") .setDescription("description-1724546052") @@ -4238,7 +4238,7 @@ public void createCustomDimensionExceptionTest2() throws Exception { public void updateCustomDimensionTest() throws Exception { CustomDimension expectedResponse = CustomDimension.newBuilder() - .setName(CustomDimensionName.of("[PROPERTY]").toString()) + .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) .setParameterName("parameterName-379607596") .setDisplayName("displayName1714148973") .setDescription("description-1724546052") @@ -4375,7 +4375,7 @@ public void archiveCustomDimensionTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockAnalyticsAdminService.addResponse(expectedResponse); - CustomDimensionName name = CustomDimensionName.of("[PROPERTY]"); + CustomDimensionName name = CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]"); client.archiveCustomDimension(name); @@ -4397,7 +4397,7 @@ public void archiveCustomDimensionExceptionTest() throws Exception { mockAnalyticsAdminService.addException(exception); try { - CustomDimensionName name = CustomDimensionName.of("[PROPERTY]"); + CustomDimensionName name = CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]"); client.archiveCustomDimension(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { @@ -4444,7 +4444,7 @@ public void archiveCustomDimensionExceptionTest2() throws Exception { public void getCustomDimensionTest() throws Exception { CustomDimension expectedResponse = CustomDimension.newBuilder() - .setName(CustomDimensionName.of("[PROPERTY]").toString()) + .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) .setParameterName("parameterName-379607596") .setDisplayName("displayName1714148973") .setDescription("description-1724546052") @@ -4452,7 +4452,7 @@ public void getCustomDimensionTest() throws Exception { .build(); mockAnalyticsAdminService.addResponse(expectedResponse); - CustomDimensionName name = CustomDimensionName.of("[PROPERTY]"); + CustomDimensionName name = CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]"); CustomDimension actualResponse = client.getCustomDimension(name); Assert.assertEquals(expectedResponse, actualResponse); @@ -4474,7 +4474,7 @@ public void getCustomDimensionExceptionTest() throws Exception { mockAnalyticsAdminService.addException(exception); try { - CustomDimensionName name = CustomDimensionName.of("[PROPERTY]"); + CustomDimensionName name = CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]"); client.getCustomDimension(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { @@ -4486,7 +4486,7 @@ public void getCustomDimensionExceptionTest() throws Exception { public void getCustomDimensionTest2() throws Exception { CustomDimension expectedResponse = CustomDimension.newBuilder() - .setName(CustomDimensionName.of("[PROPERTY]").toString()) + .setName(CustomDimensionName.of("[PROPERTY]", "[CUSTOM_DIMENSION]").toString()) .setParameterName("parameterName-379607596") .setDisplayName("displayName1714148973") .setDescription("description-1724546052") @@ -4528,7 +4528,7 @@ public void getCustomDimensionExceptionTest2() throws Exception { public void createCustomMetricTest() throws Exception { CustomMetric expectedResponse = CustomMetric.newBuilder() - .setName(CustomMetricName.of("[PROPERTY]").toString()) + .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) .setParameterName("parameterName-379607596") .setDisplayName("displayName1714148973") .setDescription("description-1724546052") @@ -4573,7 +4573,7 @@ public void createCustomMetricExceptionTest() throws Exception { public void createCustomMetricTest2() throws Exception { CustomMetric expectedResponse = CustomMetric.newBuilder() - .setName(CustomMetricName.of("[PROPERTY]").toString()) + .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) .setParameterName("parameterName-379607596") .setDisplayName("displayName1714148973") .setDescription("description-1724546052") @@ -4618,7 +4618,7 @@ public void createCustomMetricExceptionTest2() throws Exception { public void updateCustomMetricTest() throws Exception { CustomMetric expectedResponse = CustomMetric.newBuilder() - .setName(CustomMetricName.of("[PROPERTY]").toString()) + .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) .setParameterName("parameterName-379607596") .setDisplayName("displayName1714148973") .setDescription("description-1724546052") @@ -4752,7 +4752,7 @@ public void archiveCustomMetricTest() throws Exception { Empty expectedResponse = Empty.newBuilder().build(); mockAnalyticsAdminService.addResponse(expectedResponse); - CustomMetricName name = CustomMetricName.of("[PROPERTY]"); + CustomMetricName name = CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]"); client.archiveCustomMetric(name); @@ -4773,7 +4773,7 @@ public void archiveCustomMetricExceptionTest() throws Exception { mockAnalyticsAdminService.addException(exception); try { - CustomMetricName name = CustomMetricName.of("[PROPERTY]"); + CustomMetricName name = CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]"); client.archiveCustomMetric(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { @@ -4819,7 +4819,7 @@ public void archiveCustomMetricExceptionTest2() throws Exception { public void getCustomMetricTest() throws Exception { CustomMetric expectedResponse = CustomMetric.newBuilder() - .setName(CustomMetricName.of("[PROPERTY]").toString()) + .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) .setParameterName("parameterName-379607596") .setDisplayName("displayName1714148973") .setDescription("description-1724546052") @@ -4827,7 +4827,7 @@ public void getCustomMetricTest() throws Exception { .build(); mockAnalyticsAdminService.addResponse(expectedResponse); - CustomMetricName name = CustomMetricName.of("[PROPERTY]"); + CustomMetricName name = CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]"); CustomMetric actualResponse = client.getCustomMetric(name); Assert.assertEquals(expectedResponse, actualResponse); @@ -4849,7 +4849,7 @@ public void getCustomMetricExceptionTest() throws Exception { mockAnalyticsAdminService.addException(exception); try { - CustomMetricName name = CustomMetricName.of("[PROPERTY]"); + CustomMetricName name = CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]"); client.getCustomMetric(name); Assert.fail("No exception raised"); } catch (InvalidArgumentException e) { @@ -4861,7 +4861,7 @@ public void getCustomMetricExceptionTest() throws Exception { public void getCustomMetricTest2() throws Exception { CustomMetric expectedResponse = CustomMetric.newBuilder() - .setName(CustomMetricName.of("[PROPERTY]").toString()) + .setName(CustomMetricName.of("[PROPERTY]", "[CUSTOM_METRIC]").toString()) .setParameterName("parameterName-379607596") .setDisplayName("displayName1714148973") .setDescription("description-1724546052") diff --git a/java-analytics-admin/proto-google-analytics-admin-v1alpha/clirr-ignored-differences.xml b/java-analytics-admin/proto-google-analytics-admin-v1alpha/clirr-ignored-differences.xml index 7aff221b57e0..72d467c86ec7 100644 --- a/java-analytics-admin/proto-google-analytics-admin-v1alpha/clirr-ignored-differences.xml +++ b/java-analytics-admin/proto-google-analytics-admin-v1alpha/clirr-ignored-differences.xml @@ -107,4 +107,25 @@ com/google/analytics/admin/v1alpha/MeasurementProtocolSecretName* * *WebDataStream*(*) + + + 7004 + com/google/analytics/admin/v1alpha/CustomDimensionName + * of(*) + + + 7004 + com/google/analytics/admin/v1alpha/CustomDimensionName + * format(*) + + + 7004 + com/google/analytics/admin/v1alpha/CustomMetricName + * of(*) + + + 7004 + com/google/analytics/admin/v1alpha/CustomMetricName + * format(*) + diff --git a/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/java/com/google/analytics/admin/v1alpha/CustomDimensionName.java b/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/java/com/google/analytics/admin/v1alpha/CustomDimensionName.java index 8612289884c3..0c734ae48664 100644 --- a/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/java/com/google/analytics/admin/v1alpha/CustomDimensionName.java +++ b/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/java/com/google/analytics/admin/v1alpha/CustomDimensionName.java @@ -29,24 +29,32 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS. @Generated("by gapic-generator-java") public class CustomDimensionName implements ResourceName { - private static final PathTemplate PROPERTY = - PathTemplate.createWithoutUrlEncoding("properties/{property}/customDimensions"); + private static final PathTemplate PROPERTY_CUSTOM_DIMENSION = + PathTemplate.createWithoutUrlEncoding( + "properties/{property}/customDimensions/{custom_dimension}"); private volatile Map fieldValuesMap; private final String property; + private final String customDimension; @Deprecated protected CustomDimensionName() { property = null; + customDimension = null; } private CustomDimensionName(Builder builder) { property = Preconditions.checkNotNull(builder.getProperty()); + customDimension = Preconditions.checkNotNull(builder.getCustomDimension()); } public String getProperty() { return property; } + public String getCustomDimension() { + return customDimension; + } + public static Builder newBuilder() { return new Builder(); } @@ -55,12 +63,16 @@ public Builder toBuilder() { return new Builder(this); } - public static CustomDimensionName of(String property) { - return newBuilder().setProperty(property).build(); + public static CustomDimensionName of(String property, String customDimension) { + return newBuilder().setProperty(property).setCustomDimension(customDimension).build(); } - public static String format(String property) { - return newBuilder().setProperty(property).build().toString(); + public static String format(String property, String customDimension) { + return newBuilder() + .setProperty(property) + .setCustomDimension(customDimension) + .build() + .toString(); } public static CustomDimensionName parse(String formattedString) { @@ -68,9 +80,9 @@ public static CustomDimensionName parse(String formattedString) { return null; } Map matchMap = - PROPERTY.validatedMatch( + PROPERTY_CUSTOM_DIMENSION.validatedMatch( formattedString, "CustomDimensionName.parse: formattedString not in valid format"); - return of(matchMap.get("property")); + return of(matchMap.get("property"), matchMap.get("custom_dimension")); } public static List parseList(List formattedStrings) { @@ -94,7 +106,7 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PROPERTY.matches(formattedString); + return PROPERTY_CUSTOM_DIMENSION.matches(formattedString); } @Override @@ -106,6 +118,9 @@ public Map getFieldValuesMap() { if (property != null) { fieldMapBuilder.put("property", property); } + if (customDimension != null) { + fieldMapBuilder.put("custom_dimension", customDimension); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,7 +134,8 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PROPERTY.instantiate("property", property); + return PROPERTY_CUSTOM_DIMENSION.instantiate( + "property", property, "custom_dimension", customDimension); } @Override @@ -129,7 +145,8 @@ public boolean equals(Object o) { } if (o != null || getClass() == o.getClass()) { CustomDimensionName that = ((CustomDimensionName) o); - return Objects.equals(this.property, that.property); + return Objects.equals(this.property, that.property) + && Objects.equals(this.customDimension, that.customDimension); } return false; } @@ -139,12 +156,15 @@ public int hashCode() { int h = 1; h *= 1000003; h ^= Objects.hashCode(property); + h *= 1000003; + h ^= Objects.hashCode(customDimension); return h; } - /** Builder for properties/{property}/customDimensions. */ + /** Builder for properties/{property}/customDimensions/{custom_dimension}. */ public static class Builder { private String property; + private String customDimension; protected Builder() {} @@ -152,13 +172,23 @@ public String getProperty() { return property; } + public String getCustomDimension() { + return customDimension; + } + public Builder setProperty(String property) { this.property = property; return this; } + public Builder setCustomDimension(String customDimension) { + this.customDimension = customDimension; + return this; + } + private Builder(CustomDimensionName customDimensionName) { this.property = customDimensionName.property; + this.customDimension = customDimensionName.customDimension; } public CustomDimensionName build() { diff --git a/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/java/com/google/analytics/admin/v1alpha/CustomMetricName.java b/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/java/com/google/analytics/admin/v1alpha/CustomMetricName.java index 07a046968dff..24ba33bb31cf 100644 --- a/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/java/com/google/analytics/admin/v1alpha/CustomMetricName.java +++ b/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/java/com/google/analytics/admin/v1alpha/CustomMetricName.java @@ -29,24 +29,31 @@ // AUTO-GENERATED DOCUMENTATION AND CLASS. @Generated("by gapic-generator-java") public class CustomMetricName implements ResourceName { - private static final PathTemplate PROPERTY = - PathTemplate.createWithoutUrlEncoding("properties/{property}/customMetrics"); + private static final PathTemplate PROPERTY_CUSTOM_METRIC = + PathTemplate.createWithoutUrlEncoding("properties/{property}/customMetrics/{custom_metric}"); private volatile Map fieldValuesMap; private final String property; + private final String customMetric; @Deprecated protected CustomMetricName() { property = null; + customMetric = null; } private CustomMetricName(Builder builder) { property = Preconditions.checkNotNull(builder.getProperty()); + customMetric = Preconditions.checkNotNull(builder.getCustomMetric()); } public String getProperty() { return property; } + public String getCustomMetric() { + return customMetric; + } + public static Builder newBuilder() { return new Builder(); } @@ -55,12 +62,12 @@ public Builder toBuilder() { return new Builder(this); } - public static CustomMetricName of(String property) { - return newBuilder().setProperty(property).build(); + public static CustomMetricName of(String property, String customMetric) { + return newBuilder().setProperty(property).setCustomMetric(customMetric).build(); } - public static String format(String property) { - return newBuilder().setProperty(property).build().toString(); + public static String format(String property, String customMetric) { + return newBuilder().setProperty(property).setCustomMetric(customMetric).build().toString(); } public static CustomMetricName parse(String formattedString) { @@ -68,9 +75,9 @@ public static CustomMetricName parse(String formattedString) { return null; } Map matchMap = - PROPERTY.validatedMatch( + PROPERTY_CUSTOM_METRIC.validatedMatch( formattedString, "CustomMetricName.parse: formattedString not in valid format"); - return of(matchMap.get("property")); + return of(matchMap.get("property"), matchMap.get("custom_metric")); } public static List parseList(List formattedStrings) { @@ -94,7 +101,7 @@ public static List toStringList(List values) { } public static boolean isParsableFrom(String formattedString) { - return PROPERTY.matches(formattedString); + return PROPERTY_CUSTOM_METRIC.matches(formattedString); } @Override @@ -106,6 +113,9 @@ public Map getFieldValuesMap() { if (property != null) { fieldMapBuilder.put("property", property); } + if (customMetric != null) { + fieldMapBuilder.put("custom_metric", customMetric); + } fieldValuesMap = fieldMapBuilder.build(); } } @@ -119,7 +129,7 @@ public String getFieldValue(String fieldName) { @Override public String toString() { - return PROPERTY.instantiate("property", property); + return PROPERTY_CUSTOM_METRIC.instantiate("property", property, "custom_metric", customMetric); } @Override @@ -129,7 +139,8 @@ public boolean equals(Object o) { } if (o != null || getClass() == o.getClass()) { CustomMetricName that = ((CustomMetricName) o); - return Objects.equals(this.property, that.property); + return Objects.equals(this.property, that.property) + && Objects.equals(this.customMetric, that.customMetric); } return false; } @@ -139,12 +150,15 @@ public int hashCode() { int h = 1; h *= 1000003; h ^= Objects.hashCode(property); + h *= 1000003; + h ^= Objects.hashCode(customMetric); return h; } - /** Builder for properties/{property}/customMetrics. */ + /** Builder for properties/{property}/customMetrics/{custom_metric}. */ public static class Builder { private String property; + private String customMetric; protected Builder() {} @@ -152,13 +166,23 @@ public String getProperty() { return property; } + public String getCustomMetric() { + return customMetric; + } + public Builder setProperty(String property) { this.property = property; return this; } + public Builder setCustomMetric(String customMetric) { + this.customMetric = customMetric; + return this; + } + private Builder(CustomMetricName customMetricName) { this.property = customMetricName.property; + this.customMetric = customMetricName.customMetric; } public CustomMetricName build() { diff --git a/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/java/com/google/analytics/admin/v1alpha/ResourcesProto.java b/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/java/com/google/analytics/admin/v1alpha/ResourcesProto.java index 877aa75be299..f1c6239ad0b8 100644 --- a/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/java/com/google/analytics/admin/v1alpha/ResourcesProto.java +++ b/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/java/com/google/analytics/admin/v1alpha/ResourcesProto.java @@ -337,7 +337,7 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "tics.admin.v1alpha.GoogleSignalsConsentB" + "\003\340A\003:e\352Ab\n3analyticsadmin.googleapis.com" + "/GoogleSignalsSettings\022+properties/{prop" - + "erty}/googleSignalsSettings\"\237\003\n\017CustomDi" + + "erty}/googleSignalsSettings\"\262\003\n\017CustomDi" + "mension\022\021\n\004name\030\001 \001(\tB\003\340A\003\022\036\n\016parameter_" + "name\030\002 \001(\tB\006\340A\002\340A\005\022\031\n\014display_name\030\003 \001(\t" + "B\003\340A\002\022\030\n\013description\030\004 \001(\tB\003\340A\001\022U\n\005scope" @@ -345,90 +345,91 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { + "CustomDimension.DimensionScopeB\006\340A\002\340A\005\022)" + "\n\034disallow_ads_personalization\030\006 \001(\010B\003\340A" + "\001\"F\n\016DimensionScope\022\037\n\033DIMENSION_SCOPE_U" - + "NSPECIFIED\020\000\022\t\n\005EVENT\020\001\022\010\n\004USER\020\002:Z\352AW\n-" + + "NSPECIFIED\020\000\022\t\n\005EVENT\020\001\022\010\n\004USER\020\002:m\352Aj\n-" + "analyticsadmin.googleapis.com/CustomDime" - + "nsion\022&properties/{property}/customDimen" - + "sions\"\265\006\n\014CustomMetric\022\021\n\004name\030\001 \001(\tB\003\340A" - + "\003\022\036\n\016parameter_name\030\002 \001(\tB\006\340A\002\340A\005\022\031\n\014dis" - + "play_name\030\003 \001(\tB\003\340A\002\022\030\n\013description\030\004 \001(" - + "\tB\003\340A\001\022[\n\020measurement_unit\030\005 \001(\0162<.googl" - + "e.analytics.admin.v1alpha.CustomMetric.M" - + "easurementUnitB\003\340A\002\022O\n\005scope\030\006 \001(\01628.goo" - + "gle.analytics.admin.v1alpha.CustomMetric" - + ".MetricScopeB\006\340A\002\340A\005\022f\n\026restricted_metri" - + "c_type\030\010 \003(\0162A.google.analytics.admin.v1" - + "alpha.CustomMetric.RestrictedMetricTypeB" - + "\003\340A\001\"\267\001\n\017MeasurementUnit\022 \n\034MEASUREMENT_" - + "UNIT_UNSPECIFIED\020\000\022\014\n\010STANDARD\020\001\022\014\n\010CURR" - + "ENCY\020\002\022\010\n\004FEET\020\003\022\n\n\006METERS\020\004\022\016\n\nKILOMETE" - + "RS\020\005\022\t\n\005MILES\020\006\022\020\n\014MILLISECONDS\020\007\022\013\n\007SEC" - + "ONDS\020\010\022\013\n\007MINUTES\020\t\022\t\n\005HOURS\020\n\"6\n\013Metric" - + "Scope\022\034\n\030METRIC_SCOPE_UNSPECIFIED\020\000\022\t\n\005E" - + "VENT\020\001\"_\n\024RestrictedMetricType\022&\n\"RESTRI" - + "CTED_METRIC_TYPE_UNSPECIFIED\020\000\022\r\n\tCOST_D" - + "ATA\020\001\022\020\n\014REVENUE_DATA\020\002:T\352AQ\n*analyticsa" - + "dmin.googleapis.com/CustomMetric\022#proper" - + "ties/{property}/customMetrics\"\302\003\n\025DataRe" - + "tentionSettings\022\021\n\004name\030\001 \001(\tB\003\340A\003\022e\n\024ev" - + "ent_data_retention\030\002 \001(\0162G.google.analyt" - + "ics.admin.v1alpha.DataRetentionSettings." - + "RetentionDuration\022\'\n\037reset_user_data_on_" - + "new_activity\030\003 \001(\010\"\236\001\n\021RetentionDuration" - + "\022\"\n\036RETENTION_DURATION_UNSPECIFIED\020\000\022\016\n\n" - + "TWO_MONTHS\020\001\022\023\n\017FOURTEEN_MONTHS\020\003\022\025\n\021TWE" - + "NTY_SIX_MONTHS\020\004\022\027\n\023THIRTY_EIGHT_MONTHS\020" - + "\005\022\020\n\014FIFTY_MONTHS\020\006:e\352Ab\n3analyticsadmin" - + ".googleapis.com/DataRetentionSettings\022+p" - + "roperties/{property}/dataRetentionSettin" - + "gs*\252\004\n\020IndustryCategory\022!\n\035INDUSTRY_CATE" - + "GORY_UNSPECIFIED\020\000\022\016\n\nAUTOMOTIVE\020\001\022#\n\037BU" - + "SINESS_AND_INDUSTRIAL_MARKETS\020\002\022\013\n\007FINAN" - + "CE\020\003\022\016\n\nHEALTHCARE\020\004\022\016\n\nTECHNOLOGY\020\005\022\n\n\006" - + "TRAVEL\020\006\022\t\n\005OTHER\020\007\022\032\n\026ARTS_AND_ENTERTAI" - + "NMENT\020\010\022\026\n\022BEAUTY_AND_FITNESS\020\t\022\030\n\024BOOKS" - + "_AND_LITERATURE\020\n\022\022\n\016FOOD_AND_DRINK\020\013\022\t\n" - + "\005GAMES\020\014\022\027\n\023HOBBIES_AND_LEISURE\020\r\022\023\n\017HOM" - + "E_AND_GARDEN\020\016\022\030\n\024INTERNET_AND_TELECOM\020\017" - + "\022\026\n\022LAW_AND_GOVERNMENT\020\020\022\010\n\004NEWS\020\021\022\026\n\022ON" - + "LINE_COMMUNITIES\020\022\022\026\n\022PEOPLE_AND_SOCIETY" - + "\020\023\022\024\n\020PETS_AND_ANIMALS\020\024\022\017\n\013REAL_ESTATE\020" - + "\025\022\r\n\tREFERENCE\020\026\022\013\n\007SCIENCE\020\027\022\n\n\006SPORTS\020" - + "\030\022\026\n\022JOBS_AND_EDUCATION\020\031\022\014\n\010SHOPPING\020\032*" - + "f\n\014ServiceLevel\022\035\n\031SERVICE_LEVEL_UNSPECI" - + "FIED\020\000\022\035\n\031GOOGLE_ANALYTICS_STANDARD\020\001\022\030\n" - + "\024GOOGLE_ANALYTICS_360\020\002*J\n\tActorType\022\032\n\026" - + "ACTOR_TYPE_UNSPECIFIED\020\000\022\010\n\004USER\020\001\022\n\n\006SY" - + "STEM\020\002\022\013\n\007SUPPORT\020\003*P\n\nActionType\022\033\n\027ACT" - + "ION_TYPE_UNSPECIFIED\020\000\022\013\n\007CREATED\020\001\022\013\n\007U" - + "PDATED\020\002\022\013\n\007DELETED\020\003*\216\003\n\031ChangeHistoryR" - + "esourceType\022,\n(CHANGE_HISTORY_RESOURCE_T" - + "YPE_UNSPECIFIED\020\000\022\013\n\007ACCOUNT\020\001\022\014\n\010PROPER" - + "TY\020\002\022\021\n\rFIREBASE_LINK\020\006\022\023\n\017GOOGLE_ADS_LI" - + "NK\020\007\022\033\n\027GOOGLE_SIGNALS_SETTINGS\020\010\022\024\n\020CON" - + "VERSION_EVENT\020\t\022\037\n\033MEASUREMENT_PROTOCOL_" - + "SECRET\020\n\022\024\n\020CUSTOM_DIMENSION\020\013\022\021\n\rCUSTOM" - + "_METRIC\020\014\022\033\n\027DATA_RETENTION_SETTINGS\020\r\022%" - + "\n!DISPLAY_VIDEO_360_ADVERTISER_LINK\020\016\022.\n" - + "*DISPLAY_VIDEO_360_ADVERTISER_LINK_PROPO" - + "SAL\020\017\022\017\n\013DATA_STREAM\020\022*s\n\022GoogleSignalsS" - + "tate\022$\n GOOGLE_SIGNALS_STATE_UNSPECIFIED" - + "\020\000\022\032\n\026GOOGLE_SIGNALS_ENABLED\020\001\022\033\n\027GOOGLE" - + "_SIGNALS_DISABLED\020\002*\216\001\n\024GoogleSignalsCon" - + "sent\022&\n\"GOOGLE_SIGNALS_CONSENT_UNSPECIFI" - + "ED\020\000\022$\n GOOGLE_SIGNALS_CONSENT_CONSENTED" - + "\020\002\022(\n$GOOGLE_SIGNALS_CONSENT_NOT_CONSENT" - + "ED\020\001*{\n\035LinkProposalInitiatingProduct\0220\n" - + ",LINK_PROPOSAL_INITIATING_PRODUCT_UNSPEC" - + "IFIED\020\000\022\024\n\020GOOGLE_ANALYTICS\020\001\022\022\n\016LINKED_" - + "PRODUCT\020\002*\304\001\n\021LinkProposalState\022#\n\037LINK_" - + "PROPOSAL_STATE_UNSPECIFIED\020\000\022)\n%AWAITING" - + "_REVIEW_FROM_GOOGLE_ANALYTICS\020\001\022\'\n#AWAIT" - + "ING_REVIEW_FROM_LINKED_PRODUCT\020\002\022\r\n\tWITH" - + "DRAWN\020\003\022\014\n\010DECLINED\020\004\022\013\n\007EXPIRED\020\005\022\014\n\010OB" - + "SOLETE\020\006B{\n\"com.google.analytics.admin.v" - + "1alphaB\016ResourcesProtoP\001ZCgoogle.golang." - + "org/genproto/googleapis/analytics/admin/" - + "v1alpha;adminb\006proto3" + + "nsion\0229properties/{property}/customDimen" + + "sions/{custom_dimension}\"\305\006\n\014CustomMetri" + + "c\022\021\n\004name\030\001 \001(\tB\003\340A\003\022\036\n\016parameter_name\030\002" + + " \001(\tB\006\340A\002\340A\005\022\031\n\014display_name\030\003 \001(\tB\003\340A\002\022" + + "\030\n\013description\030\004 \001(\tB\003\340A\001\022[\n\020measurement" + + "_unit\030\005 \001(\0162<.google.analytics.admin.v1a" + + "lpha.CustomMetric.MeasurementUnitB\003\340A\002\022O" + + "\n\005scope\030\006 \001(\01628.google.analytics.admin.v" + + "1alpha.CustomMetric.MetricScopeB\006\340A\002\340A\005\022" + + "f\n\026restricted_metric_type\030\010 \003(\0162A.google" + + ".analytics.admin.v1alpha.CustomMetric.Re" + + "strictedMetricTypeB\003\340A\001\"\267\001\n\017MeasurementU" + + "nit\022 \n\034MEASUREMENT_UNIT_UNSPECIFIED\020\000\022\014\n" + + "\010STANDARD\020\001\022\014\n\010CURRENCY\020\002\022\010\n\004FEET\020\003\022\n\n\006M" + + "ETERS\020\004\022\016\n\nKILOMETERS\020\005\022\t\n\005MILES\020\006\022\020\n\014MI" + + "LLISECONDS\020\007\022\013\n\007SECONDS\020\010\022\013\n\007MINUTES\020\t\022\t" + + "\n\005HOURS\020\n\"6\n\013MetricScope\022\034\n\030METRIC_SCOPE" + + "_UNSPECIFIED\020\000\022\t\n\005EVENT\020\001\"_\n\024RestrictedM" + + "etricType\022&\n\"RESTRICTED_METRIC_TYPE_UNSP" + + "ECIFIED\020\000\022\r\n\tCOST_DATA\020\001\022\020\n\014REVENUE_DATA" + + "\020\002:d\352Aa\n*analyticsadmin.googleapis.com/C" + + "ustomMetric\0223properties/{property}/custo" + + "mMetrics/{custom_metric}\"\302\003\n\025DataRetenti" + + "onSettings\022\021\n\004name\030\001 \001(\tB\003\340A\003\022e\n\024event_d" + + "ata_retention\030\002 \001(\0162G.google.analytics.a" + + "dmin.v1alpha.DataRetentionSettings.Reten" + + "tionDuration\022\'\n\037reset_user_data_on_new_a" + + "ctivity\030\003 \001(\010\"\236\001\n\021RetentionDuration\022\"\n\036R" + + "ETENTION_DURATION_UNSPECIFIED\020\000\022\016\n\nTWO_M" + + "ONTHS\020\001\022\023\n\017FOURTEEN_MONTHS\020\003\022\025\n\021TWENTY_S" + + "IX_MONTHS\020\004\022\027\n\023THIRTY_EIGHT_MONTHS\020\005\022\020\n\014" + + "FIFTY_MONTHS\020\006:e\352Ab\n3analyticsadmin.goog" + + "leapis.com/DataRetentionSettings\022+proper" + + "ties/{property}/dataRetentionSettings*\252\004" + + "\n\020IndustryCategory\022!\n\035INDUSTRY_CATEGORY_" + + "UNSPECIFIED\020\000\022\016\n\nAUTOMOTIVE\020\001\022#\n\037BUSINES" + + "S_AND_INDUSTRIAL_MARKETS\020\002\022\013\n\007FINANCE\020\003\022" + + "\016\n\nHEALTHCARE\020\004\022\016\n\nTECHNOLOGY\020\005\022\n\n\006TRAVE" + + "L\020\006\022\t\n\005OTHER\020\007\022\032\n\026ARTS_AND_ENTERTAINMENT" + + "\020\010\022\026\n\022BEAUTY_AND_FITNESS\020\t\022\030\n\024BOOKS_AND_" + + "LITERATURE\020\n\022\022\n\016FOOD_AND_DRINK\020\013\022\t\n\005GAME" + + "S\020\014\022\027\n\023HOBBIES_AND_LEISURE\020\r\022\023\n\017HOME_AND" + + "_GARDEN\020\016\022\030\n\024INTERNET_AND_TELECOM\020\017\022\026\n\022L" + + "AW_AND_GOVERNMENT\020\020\022\010\n\004NEWS\020\021\022\026\n\022ONLINE_" + + "COMMUNITIES\020\022\022\026\n\022PEOPLE_AND_SOCIETY\020\023\022\024\n" + + "\020PETS_AND_ANIMALS\020\024\022\017\n\013REAL_ESTATE\020\025\022\r\n\t" + + "REFERENCE\020\026\022\013\n\007SCIENCE\020\027\022\n\n\006SPORTS\020\030\022\026\n\022" + + "JOBS_AND_EDUCATION\020\031\022\014\n\010SHOPPING\020\032*f\n\014Se" + + "rviceLevel\022\035\n\031SERVICE_LEVEL_UNSPECIFIED\020" + + "\000\022\035\n\031GOOGLE_ANALYTICS_STANDARD\020\001\022\030\n\024GOOG" + + "LE_ANALYTICS_360\020\002*J\n\tActorType\022\032\n\026ACTOR" + + "_TYPE_UNSPECIFIED\020\000\022\010\n\004USER\020\001\022\n\n\006SYSTEM\020" + + "\002\022\013\n\007SUPPORT\020\003*P\n\nActionType\022\033\n\027ACTION_T" + + "YPE_UNSPECIFIED\020\000\022\013\n\007CREATED\020\001\022\013\n\007UPDATE" + + "D\020\002\022\013\n\007DELETED\020\003*\216\003\n\031ChangeHistoryResour" + + "ceType\022,\n(CHANGE_HISTORY_RESOURCE_TYPE_U" + + "NSPECIFIED\020\000\022\013\n\007ACCOUNT\020\001\022\014\n\010PROPERTY\020\002\022" + + "\021\n\rFIREBASE_LINK\020\006\022\023\n\017GOOGLE_ADS_LINK\020\007\022" + + "\033\n\027GOOGLE_SIGNALS_SETTINGS\020\010\022\024\n\020CONVERSI" + + "ON_EVENT\020\t\022\037\n\033MEASUREMENT_PROTOCOL_SECRE" + + "T\020\n\022\024\n\020CUSTOM_DIMENSION\020\013\022\021\n\rCUSTOM_METR" + + "IC\020\014\022\033\n\027DATA_RETENTION_SETTINGS\020\r\022%\n!DIS" + + "PLAY_VIDEO_360_ADVERTISER_LINK\020\016\022.\n*DISP" + + "LAY_VIDEO_360_ADVERTISER_LINK_PROPOSAL\020\017" + + "\022\017\n\013DATA_STREAM\020\022*s\n\022GoogleSignalsState\022" + + "$\n GOOGLE_SIGNALS_STATE_UNSPECIFIED\020\000\022\032\n" + + "\026GOOGLE_SIGNALS_ENABLED\020\001\022\033\n\027GOOGLE_SIGN" + + "ALS_DISABLED\020\002*\216\001\n\024GoogleSignalsConsent\022" + + "&\n\"GOOGLE_SIGNALS_CONSENT_UNSPECIFIED\020\000\022" + + "$\n GOOGLE_SIGNALS_CONSENT_CONSENTED\020\002\022(\n" + + "$GOOGLE_SIGNALS_CONSENT_NOT_CONSENTED\020\001*" + + "{\n\035LinkProposalInitiatingProduct\0220\n,LINK" + + "_PROPOSAL_INITIATING_PRODUCT_UNSPECIFIED" + + "\020\000\022\024\n\020GOOGLE_ANALYTICS\020\001\022\022\n\016LINKED_PRODU" + + "CT\020\002*\304\001\n\021LinkProposalState\022#\n\037LINK_PROPO" + + "SAL_STATE_UNSPECIFIED\020\000\022)\n%AWAITING_REVI" + + "EW_FROM_GOOGLE_ANALYTICS\020\001\022\'\n#AWAITING_R" + + "EVIEW_FROM_LINKED_PRODUCT\020\002\022\r\n\tWITHDRAWN" + + "\020\003\022\014\n\010DECLINED\020\004\022\013\n\007EXPIRED\020\005\022\014\n\010OBSOLET" + + "E\020\006B{\n\"com.google.analytics.admin.v1alph" + + "aB\016ResourcesProtoP\001ZCgoogle.golang.org/g" + + "enproto/googleapis/analytics/admin/v1alp" + + "ha;adminb\006proto3" }; descriptor = com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom( diff --git a/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/proto/google/analytics/admin/v1alpha/resources.proto b/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/proto/google/analytics/admin/v1alpha/resources.proto index cbb624f1a87f..d441d1074624 100644 --- a/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/proto/google/analytics/admin/v1alpha/resources.proto +++ b/java-analytics-admin/proto-google-analytics-admin-v1alpha/src/main/proto/google/analytics/admin/v1alpha/resources.proto @@ -951,7 +951,7 @@ message GoogleSignalsSettings { message CustomDimension { option (google.api.resource) = { type: "analyticsadmin.googleapis.com/CustomDimension" - pattern: "properties/{property}/customDimensions" + pattern: "properties/{property}/customDimensions/{custom_dimension}" }; // Valid values for the scope of this dimension. @@ -1011,7 +1011,7 @@ message CustomDimension { message CustomMetric { option (google.api.resource) = { type: "analyticsadmin.googleapis.com/CustomMetric" - pattern: "properties/{property}/customMetrics" + pattern: "properties/{property}/customMetrics/{custom_metric}" }; // Possible types of representing the custom metric's value.