diff --git a/retail/interactive-tutorials/src/main/java/events/ImportUserEventsBigQuery.java b/retail/interactive-tutorials/src/main/java/events/ImportUserEventsBigQuery.java index 73c98d75f95..e3630e134f6 100644 --- a/retail/interactive-tutorials/src/main/java/events/ImportUserEventsBigQuery.java +++ b/retail/interactive-tutorials/src/main/java/events/ImportUserEventsBigQuery.java @@ -21,6 +21,7 @@ package events; import com.google.api.gax.rpc.NotFoundException; +import com.google.cloud.ServiceOptions; import com.google.cloud.bigquery.BigQueryException; import com.google.cloud.retail.v2.BigQuerySource; import com.google.cloud.retail.v2.ImportMetadata; @@ -38,7 +39,7 @@ public class ImportUserEventsBigQuery { public static void main(String[] args) throws IOException, InterruptedException { // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; + String projectId = ServiceOptions.getDefaultProjectId(); String defaultCatalog = String.format("projects/%s/locations/global/catalogs/default_catalog", projectId); // TO CHECK ERROR HANDLING PASTE THE INVALID CATALOG NAME HERE: diff --git a/retail/interactive-tutorials/src/main/java/events/ImportUserEventsGcs.java b/retail/interactive-tutorials/src/main/java/events/ImportUserEventsGcs.java index 6abb57bd848..3128f9ba064 100644 --- a/retail/interactive-tutorials/src/main/java/events/ImportUserEventsGcs.java +++ b/retail/interactive-tutorials/src/main/java/events/ImportUserEventsGcs.java @@ -22,6 +22,7 @@ import com.google.api.gax.rpc.InvalidArgumentException; import com.google.api.gax.rpc.PermissionDeniedException; +import com.google.cloud.ServiceOptions; import com.google.cloud.retail.v2.GcsSource; import com.google.cloud.retail.v2.ImportErrorsConfig; import com.google.cloud.retail.v2.ImportMetadata; @@ -39,7 +40,7 @@ public class ImportUserEventsGcs { public static void main(String[] args) throws IOException, InterruptedException { // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; + String projectId = ServiceOptions.getDefaultProjectId(); String defaultCatalog = String.format("projects/%s/locations/global/catalogs/default_catalog", projectId); // TO CHECK ERROR HANDLING PASTE THE INVALID CATALOG NAME HERE: diff --git a/retail/interactive-tutorials/src/main/java/events/ImportUserEventsInline.java b/retail/interactive-tutorials/src/main/java/events/ImportUserEventsInline.java index 44cf661eaad..d7e882292de 100644 --- a/retail/interactive-tutorials/src/main/java/events/ImportUserEventsInline.java +++ b/retail/interactive-tutorials/src/main/java/events/ImportUserEventsInline.java @@ -21,6 +21,7 @@ package events; import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.ServiceOptions; import com.google.cloud.bigquery.BigQueryException; import com.google.cloud.retail.v2.ImportMetadata; import com.google.cloud.retail.v2.ImportUserEventsRequest; @@ -43,7 +44,7 @@ public class ImportUserEventsInline { public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; + String projectId = ServiceOptions.getDefaultProjectId(); String defaultCatalog = String.format("projects/%s/locations/global/catalogs/default_catalog", projectId); diff --git a/retail/interactive-tutorials/src/main/java/events/PurgeUserEvent.java b/retail/interactive-tutorials/src/main/java/events/PurgeUserEvent.java index 31e3d680a67..2dc99f29165 100644 --- a/retail/interactive-tutorials/src/main/java/events/PurgeUserEvent.java +++ b/retail/interactive-tutorials/src/main/java/events/PurgeUserEvent.java @@ -23,6 +23,7 @@ import static setup.SetupCleanup.writeUserEvent; import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.ServiceOptions; import com.google.cloud.retail.v2.PurgeMetadata; import com.google.cloud.retail.v2.PurgeUserEventsRequest; import com.google.cloud.retail.v2.PurgeUserEventsResponse; @@ -36,7 +37,7 @@ public class PurgeUserEvent { public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; + String projectId = ServiceOptions.getDefaultProjectId(); String defaultCatalog = String.format("projects/%s/locations/global/catalogs/default_catalog", projectId); // visitorId generated randomly. diff --git a/retail/interactive-tutorials/src/main/java/events/RejoinUserEvent.java b/retail/interactive-tutorials/src/main/java/events/RejoinUserEvent.java index d97cb8fdfbf..b695b707f6d 100644 --- a/retail/interactive-tutorials/src/main/java/events/RejoinUserEvent.java +++ b/retail/interactive-tutorials/src/main/java/events/RejoinUserEvent.java @@ -24,6 +24,7 @@ import static setup.SetupCleanup.writeUserEvent; import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.ServiceOptions; import com.google.cloud.retail.v2.RejoinUserEventsMetadata; import com.google.cloud.retail.v2.RejoinUserEventsRequest; import com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope; @@ -38,7 +39,7 @@ public class RejoinUserEvent { public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; + String projectId = ServiceOptions.getDefaultProjectId(); String defaultCatalog = String.format("projects/%s/locations/global/catalogs/default_catalog", projectId); // visitorId generated randomly. diff --git a/retail/interactive-tutorials/src/main/java/events/WriteUserEvent.java b/retail/interactive-tutorials/src/main/java/events/WriteUserEvent.java index b4b20a59680..aa32b87ef94 100644 --- a/retail/interactive-tutorials/src/main/java/events/WriteUserEvent.java +++ b/retail/interactive-tutorials/src/main/java/events/WriteUserEvent.java @@ -22,6 +22,7 @@ import static setup.SetupCleanup.purgeUserEvent; +import com.google.cloud.ServiceOptions; import com.google.cloud.retail.v2.UserEvent; import com.google.cloud.retail.v2.UserEventServiceClient; import com.google.cloud.retail.v2.WriteUserEventRequest; @@ -36,7 +37,7 @@ public class WriteUserEvent { public static void main(String[] args) throws IOException, ExecutionException, InterruptedException { // TODO(developer): Replace these variables before running the sample. - String projectId = "your-project-id"; + String projectId = ServiceOptions.getDefaultProjectId(); String defaultCatalog = String.format("projects/%s/locations/global/catalogs/default_catalog", projectId); // visitorId generated randomly.