Skip to content

Commit 24a1278

Browse files
fix(samples): replaced your-project-id with default. (#541)
* fix(samples): replaced your-project-id with default. * pr fix: fixed test. * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent 9104b3e commit 24a1278

File tree

6 files changed

+12
-6
lines changed

6 files changed

+12
-6
lines changed

retail/interactive-tutorials/src/main/java/events/ImportUserEventsBigQuery.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package events;
2222

2323
import com.google.api.gax.rpc.NotFoundException;
24+
import com.google.cloud.ServiceOptions;
2425
import com.google.cloud.bigquery.BigQueryException;
2526
import com.google.cloud.retail.v2.BigQuerySource;
2627
import com.google.cloud.retail.v2.ImportMetadata;
@@ -38,7 +39,7 @@ public class ImportUserEventsBigQuery {
3839

3940
public static void main(String[] args) throws IOException, InterruptedException {
4041
// TODO(developer): Replace these variables before running the sample.
41-
String projectId = "your-project-id";
42+
String projectId = ServiceOptions.getDefaultProjectId();
4243
String defaultCatalog =
4344
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
4445
// TO CHECK ERROR HANDLING PASTE THE INVALID CATALOG NAME HERE:

retail/interactive-tutorials/src/main/java/events/ImportUserEventsGcs.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import com.google.api.gax.rpc.InvalidArgumentException;
2424
import com.google.api.gax.rpc.PermissionDeniedException;
25+
import com.google.cloud.ServiceOptions;
2526
import com.google.cloud.retail.v2.GcsSource;
2627
import com.google.cloud.retail.v2.ImportErrorsConfig;
2728
import com.google.cloud.retail.v2.ImportMetadata;
@@ -39,7 +40,7 @@ public class ImportUserEventsGcs {
3940

4041
public static void main(String[] args) throws IOException, InterruptedException {
4142
// TODO(developer): Replace these variables before running the sample.
42-
String projectId = "your-project-id";
43+
String projectId = ServiceOptions.getDefaultProjectId();
4344
String defaultCatalog =
4445
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
4546
// TO CHECK ERROR HANDLING PASTE THE INVALID CATALOG NAME HERE:

retail/interactive-tutorials/src/main/java/events/ImportUserEventsInline.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
package events;
2222

2323
import com.google.api.gax.longrunning.OperationFuture;
24+
import com.google.cloud.ServiceOptions;
2425
import com.google.cloud.bigquery.BigQueryException;
2526
import com.google.cloud.retail.v2.ImportMetadata;
2627
import com.google.cloud.retail.v2.ImportUserEventsRequest;
@@ -43,7 +44,7 @@ public class ImportUserEventsInline {
4344
public static void main(String[] args)
4445
throws IOException, ExecutionException, InterruptedException {
4546
// TODO(developer): Replace these variables before running the sample.
46-
String projectId = "your-project-id";
47+
String projectId = ServiceOptions.getDefaultProjectId();
4748
String defaultCatalog =
4849
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
4950

retail/interactive-tutorials/src/main/java/events/PurgeUserEvent.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import static setup.SetupCleanup.writeUserEvent;
2424

2525
import com.google.api.gax.longrunning.OperationFuture;
26+
import com.google.cloud.ServiceOptions;
2627
import com.google.cloud.retail.v2.PurgeMetadata;
2728
import com.google.cloud.retail.v2.PurgeUserEventsRequest;
2829
import com.google.cloud.retail.v2.PurgeUserEventsResponse;
@@ -36,7 +37,7 @@ public class PurgeUserEvent {
3637
public static void main(String[] args)
3738
throws IOException, ExecutionException, InterruptedException {
3839
// TODO(developer): Replace these variables before running the sample.
39-
String projectId = "your-project-id";
40+
String projectId = ServiceOptions.getDefaultProjectId();
4041
String defaultCatalog =
4142
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
4243
// visitorId generated randomly.

retail/interactive-tutorials/src/main/java/events/RejoinUserEvent.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import static setup.SetupCleanup.writeUserEvent;
2525

2626
import com.google.api.gax.longrunning.OperationFuture;
27+
import com.google.cloud.ServiceOptions;
2728
import com.google.cloud.retail.v2.RejoinUserEventsMetadata;
2829
import com.google.cloud.retail.v2.RejoinUserEventsRequest;
2930
import com.google.cloud.retail.v2.RejoinUserEventsRequest.UserEventRejoinScope;
@@ -38,7 +39,7 @@ public class RejoinUserEvent {
3839
public static void main(String[] args)
3940
throws IOException, ExecutionException, InterruptedException {
4041
// TODO(developer): Replace these variables before running the sample.
41-
String projectId = "your-project-id";
42+
String projectId = ServiceOptions.getDefaultProjectId();
4243
String defaultCatalog =
4344
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
4445
// visitorId generated randomly.

retail/interactive-tutorials/src/main/java/events/WriteUserEvent.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import static setup.SetupCleanup.purgeUserEvent;
2424

25+
import com.google.cloud.ServiceOptions;
2526
import com.google.cloud.retail.v2.UserEvent;
2627
import com.google.cloud.retail.v2.UserEventServiceClient;
2728
import com.google.cloud.retail.v2.WriteUserEventRequest;
@@ -36,7 +37,7 @@ public class WriteUserEvent {
3637
public static void main(String[] args)
3738
throws IOException, ExecutionException, InterruptedException {
3839
// TODO(developer): Replace these variables before running the sample.
39-
String projectId = "your-project-id";
40+
String projectId = ServiceOptions.getDefaultProjectId();
4041
String defaultCatalog =
4142
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
4243
// visitorId generated randomly.

0 commit comments

Comments
 (0)