File tree Expand file tree Collapse file tree 6 files changed +12
-6
lines changed
retail/interactive-tutorials/src/main/java/events Expand file tree Collapse file tree 6 files changed +12
-6
lines changed Original file line number Diff line number Diff line change 2121package events ;
2222
2323import com .google .api .gax .rpc .NotFoundException ;
24+ import com .google .cloud .ServiceOptions ;
2425import com .google .cloud .bigquery .BigQueryException ;
2526import com .google .cloud .retail .v2 .BigQuerySource ;
2627import 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:
Original file line number Diff line number Diff line change 2222
2323import com .google .api .gax .rpc .InvalidArgumentException ;
2424import com .google .api .gax .rpc .PermissionDeniedException ;
25+ import com .google .cloud .ServiceOptions ;
2526import com .google .cloud .retail .v2 .GcsSource ;
2627import com .google .cloud .retail .v2 .ImportErrorsConfig ;
2728import 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:
Original file line number Diff line number Diff line change 2121package events ;
2222
2323import com .google .api .gax .longrunning .OperationFuture ;
24+ import com .google .cloud .ServiceOptions ;
2425import com .google .cloud .bigquery .BigQueryException ;
2526import com .google .cloud .retail .v2 .ImportMetadata ;
2627import 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
Original file line number Diff line number Diff line change 2323import static setup .SetupCleanup .writeUserEvent ;
2424
2525import com .google .api .gax .longrunning .OperationFuture ;
26+ import com .google .cloud .ServiceOptions ;
2627import com .google .cloud .retail .v2 .PurgeMetadata ;
2728import com .google .cloud .retail .v2 .PurgeUserEventsRequest ;
2829import 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.
Original file line number Diff line number Diff line change 2424import static setup .SetupCleanup .writeUserEvent ;
2525
2626import com .google .api .gax .longrunning .OperationFuture ;
27+ import com .google .cloud .ServiceOptions ;
2728import com .google .cloud .retail .v2 .RejoinUserEventsMetadata ;
2829import com .google .cloud .retail .v2 .RejoinUserEventsRequest ;
2930import 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.
Original file line number Diff line number Diff line change 2222
2323import static setup .SetupCleanup .purgeUserEvent ;
2424
25+ import com .google .cloud .ServiceOptions ;
2526import com .google .cloud .retail .v2 .UserEvent ;
2627import com .google .cloud .retail .v2 .UserEventServiceClient ;
2728import 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.
You can’t perform that action at this time.
0 commit comments