Skip to content

Commit 6dbb870

Browse files
Merge branch 'main' into extend-compute_hyperdisk_pool_create
2 parents 9fd467d + 22e1c11 commit 6dbb870

25 files changed

+135
-170
lines changed

appengine-java11/appengine-simple-jetty-main/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2222
<maven.compiler.source>11</maven.compiler.source>
2323
<maven.compiler.target>11</maven.compiler.target>
24-
<jetty.version>9.4.54.v20240208</jetty.version>
24+
<jetty.version>9.4.56.v20240826</jetty.version>
2525
</properties>
2626

2727
<!-- [START gae_java11_server_dependencies] -->

dataplex/snippets/src/main/java/dataplex/CreateAspectType.java

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.google.cloud.dataplex.v1.LocationName;
2323
import java.util.List;
2424

25-
// Sample to create Aspect Type
2625
public class CreateAspectType {
2726

2827
public static void main(String[] args) throws Exception {
@@ -59,33 +58,32 @@ public static void main(String[] args) throws Exception {
5958
System.out.println("Successfully created aspect type: " + createdAspectType.getName());
6059
}
6160

61+
// Method to create Aspect Type located in projectId, location and with aspectTypeId and
62+
// aspectFields specifying schema of the Aspect Type
6263
public static AspectType createAspectType(
6364
String projectId,
6465
String location,
6566
String aspectTypeId,
6667
List<AspectType.MetadataTemplate> aspectFields)
6768
throws Exception {
68-
LocationName locationName = LocationName.of(projectId, location);
69-
AspectType aspectType =
70-
AspectType.newBuilder()
71-
.setDescription("description of the aspect type")
72-
.setMetadataTemplate(
73-
AspectType.MetadataTemplate.newBuilder()
74-
// The name must follow regex ^(([a-zA-Z]{1})([\\w\\-_]{0,62}))$
75-
// That means name must only contain alphanumeric character or dashes or
76-
// underscores, start with an alphabet, and must be less than 63 characters.
77-
.setName("name_of_the_template")
78-
.setType("record")
79-
// Aspect Type fields, that themselves are Metadata Templates
80-
.addAllRecordFields(aspectFields)
81-
.build())
82-
.build();
83-
8469
// Initialize client that will be used to send requests. This client only needs to be created
85-
// once, and can be reused for multiple requests. After completing all of your requests, call
86-
// the "close" method on the client to safely clean up any remaining background resources,
87-
// or use "try-with-close" statement to do this automatically.
70+
// once, and can be reused for multiple requests.
8871
try (CatalogServiceClient client = CatalogServiceClient.create()) {
72+
LocationName locationName = LocationName.of(projectId, location);
73+
AspectType aspectType =
74+
AspectType.newBuilder()
75+
.setDescription("description of the aspect type")
76+
.setMetadataTemplate(
77+
AspectType.MetadataTemplate.newBuilder()
78+
// The name must follow regex ^(([a-zA-Z]{1})([\\w\\-_]{0,62}))$
79+
// That means name must only contain alphanumeric character or dashes or
80+
// underscores, start with an alphabet, and must be less than 63 characters.
81+
.setName("name_of_the_template")
82+
.setType("record")
83+
// Aspect Type fields, that themselves are Metadata Templates
84+
.addAllRecordFields(aspectFields)
85+
.build())
86+
.build();
8987
return client.createAspectTypeAsync(locationName, aspectType, aspectTypeId).get();
9088
}
9189
}

dataplex/snippets/src/main/java/dataplex/CreateEntry.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public class CreateEntry {
3131
public static void main(String[] args) throws Exception {
3232
// TODO(developer): Replace these variables before running the sample.
3333
String projectId = "MY_PROJECT_ID";
34+
// Available locations: https://cloud.google.com/dataplex/docs/locations
3435
String location = "MY_LOCATION";
3536
String entryGroupId = "MY_ENTRY_GROUP_ID";
3637
String entryId = "MY_ENTRY_ID";

dataplex/snippets/src/main/java/dataplex/CreateEntryGroup.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.google.cloud.dataplex.v1.EntryGroup;
2222
import com.google.cloud.dataplex.v1.LocationName;
2323

24-
// Samples to create Entry Group
2524
public class CreateEntryGroup {
2625

2726
public static void main(String[] args) throws Exception {
@@ -35,17 +34,15 @@ public static void main(String[] args) throws Exception {
3534
System.out.println("Successfully created entry group: " + createdEntryGroup.getName());
3635
}
3736

37+
// Method to create Entry Group located in projectId, location and with entryGroupId
3838
public static EntryGroup createEntryGroup(String projectId, String location, String entryGroupId)
3939
throws Exception {
40-
LocationName locationName = LocationName.of(projectId, location);
41-
EntryGroup entryGroup =
42-
EntryGroup.newBuilder().setDescription("description of the entry group").build();
43-
4440
// Initialize client that will be used to send requests. This client only needs to be created
45-
// once, and can be reused for multiple requests. After completing all of your requests, call
46-
// the "close" method on the client to safely clean up any remaining background resources,
47-
// or use "try-with-close" statement to do this automatically.
41+
// once, and can be reused for multiple requests.
4842
try (CatalogServiceClient client = CatalogServiceClient.create()) {
43+
LocationName locationName = LocationName.of(projectId, location);
44+
EntryGroup entryGroup =
45+
EntryGroup.newBuilder().setDescription("description of the entry group").build();
4946
return client.createEntryGroupAsync(locationName, entryGroup, entryGroupId).get();
5047
}
5148
}

dataplex/snippets/src/main/java/dataplex/CreateEntryType.java

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.google.cloud.dataplex.v1.EntryType;
2222
import com.google.cloud.dataplex.v1.LocationName;
2323

24-
// Samples to create Entry Type
2524
public class CreateEntryType {
2625

2726
public static void main(String[] args) throws Exception {
@@ -35,27 +34,26 @@ public static void main(String[] args) throws Exception {
3534
System.out.println("Successfully created entry type: " + createdEntryType.getName());
3635
}
3736

37+
// Method to create Entry Type located in projectId, location and with entryTypeId
3838
public static EntryType createEntryType(String projectId, String location, String entryTypeId)
3939
throws Exception {
40-
LocationName locationName = LocationName.of(projectId, location);
41-
EntryType entryType =
42-
EntryType.newBuilder()
43-
.setDescription("description of the entry type")
44-
// Required aspects will need to be attached to every entry created for this entry type.
45-
// You cannot change required aspects for entry type once it is created.
46-
.addRequiredAspects(
47-
EntryType.AspectInfo.newBuilder()
48-
// Example of system aspect type.
49-
// It is also possible to specify custom aspect type.
50-
.setType("projects/dataplex-types/locations/global/aspectTypes/schema")
51-
.build())
52-
.build();
53-
5440
// Initialize client that will be used to send requests. This client only needs to be created
55-
// once, and can be reused for multiple requests. After completing all of your requests, call
56-
// the "close" method on the client to safely clean up any remaining background resources,
57-
// or use "try-with-close" statement to do this automatically.
41+
// once, and can be reused for multiple requests.
5842
try (CatalogServiceClient client = CatalogServiceClient.create()) {
43+
LocationName locationName = LocationName.of(projectId, location);
44+
EntryType entryType =
45+
EntryType.newBuilder()
46+
.setDescription("description of the entry type")
47+
// Required aspects will need to be attached to every entry created for this entry
48+
// type.
49+
// You cannot change required aspects for entry type once it is created.
50+
.addRequiredAspects(
51+
EntryType.AspectInfo.newBuilder()
52+
// Example of system aspect type.
53+
// It is also possible to specify custom aspect type.
54+
.setType("projects/dataplex-types/locations/global/aspectTypes/schema")
55+
.build())
56+
.build();
5957
return client.createEntryTypeAsync(locationName, entryType, entryTypeId).get();
6058
}
6159
}

dataplex/snippets/src/main/java/dataplex/DeleteAspectType.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.google.cloud.dataplex.v1.AspectTypeName;
2121
import com.google.cloud.dataplex.v1.CatalogServiceClient;
2222

23-
// Sample to delete Aspect Type
2423
public class DeleteAspectType {
2524

2625
public static void main(String[] args) throws Exception {
@@ -34,15 +33,13 @@ public static void main(String[] args) throws Exception {
3433
System.out.println("Successfully deleted aspect type");
3534
}
3635

36+
// Method to delete Aspect Type located in projectId, location and with aspectTypeId
3737
public static void deleteAspectType(String projectId, String location, String aspectTypeId)
3838
throws Exception {
39-
AspectTypeName aspectTypeName = AspectTypeName.of(projectId, location, aspectTypeId);
40-
4139
// Initialize client that will be used to send requests. This client only needs to be created
42-
// once, and can be reused for multiple requests. After completing all of your requests, call
43-
// the "close" method on the client to safely clean up any remaining background resources,
44-
// or use "try-with-close" statement to do this automatically.
40+
// once, and can be reused for multiple requests.
4541
try (CatalogServiceClient client = CatalogServiceClient.create()) {
42+
AspectTypeName aspectTypeName = AspectTypeName.of(projectId, location, aspectTypeId);
4643
client.deleteAspectTypeAsync(aspectTypeName).get();
4744
}
4845
}

dataplex/snippets/src/main/java/dataplex/DeleteEntry.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ public class DeleteEntry {
2525
public static void main(String[] args) throws Exception {
2626
// TODO(developer): Replace these variables before running the sample.
2727
String projectId = "MY_PROJECT_ID";
28+
// Available locations: https://cloud.google.com/dataplex/docs/locations
2829
String location = "MY_LOCATION";
2930
String entryGroupId = "MY_ENTRY_GROUP_ID";
3031
String entryId = "MY_ENTRY_ID";

dataplex/snippets/src/main/java/dataplex/DeleteEntryGroup.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.google.cloud.dataplex.v1.CatalogServiceClient;
2121
import com.google.cloud.dataplex.v1.EntryGroupName;
2222

23-
// Sample to delete Entry Group
2423
public class DeleteEntryGroup {
2524

2625
public static void main(String[] args) throws Exception {
@@ -34,15 +33,13 @@ public static void main(String[] args) throws Exception {
3433
System.out.println("Successfully deleted entry group");
3534
}
3635

36+
// Method to delete Entry Group located in projectId, location and with entryGroupId
3737
public static void deleteEntryGroup(String projectId, String location, String entryGroupId)
3838
throws Exception {
39-
EntryGroupName entryGroupName = EntryGroupName.of(projectId, location, entryGroupId);
40-
4139
// Initialize client that will be used to send requests. This client only needs to be created
42-
// once, and can be reused for multiple requests. After completing all of your requests, call
43-
// the "close" method on the client to safely clean up any remaining background resources,
44-
// or use "try-with-close" statement to do this automatically.
40+
// once, and can be reused for multiple requests.
4541
try (CatalogServiceClient client = CatalogServiceClient.create()) {
42+
EntryGroupName entryGroupName = EntryGroupName.of(projectId, location, entryGroupId);
4643
client.deleteEntryGroupAsync(entryGroupName).get();
4744
}
4845
}

dataplex/snippets/src/main/java/dataplex/DeleteEntryType.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.google.cloud.dataplex.v1.CatalogServiceClient;
2121
import com.google.cloud.dataplex.v1.EntryTypeName;
2222

23-
// Sample to delete Entry Type
2423
public class DeleteEntryType {
2524

2625
public static void main(String[] args) throws Exception {
@@ -34,15 +33,13 @@ public static void main(String[] args) throws Exception {
3433
System.out.println("Successfully deleted entry type");
3534
}
3635

36+
// Method to delete Entry Type located in projectId, location and with entryTypeId
3737
public static void deleteEntryType(String projectId, String location, String entryTypeId)
3838
throws Exception {
39-
EntryTypeName entryTypeName = EntryTypeName.of(projectId, location, entryTypeId);
40-
4139
// Initialize client that will be used to send requests. This client only needs to be created
42-
// once, and can be reused for multiple requests. After completing all of your requests, call
43-
// the "close" method on the client to safely clean up any remaining background resources,
44-
// or use "try-with-close" statement to do this automatically.
40+
// once, and can be reused for multiple requests.
4541
try (CatalogServiceClient client = CatalogServiceClient.create()) {
42+
EntryTypeName entryTypeName = EntryTypeName.of(projectId, location, entryTypeId);
4643
client.deleteEntryTypeAsync(entryTypeName).get();
4744
}
4845
}

dataplex/snippets/src/main/java/dataplex/GetAspectType.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
import com.google.cloud.dataplex.v1.CatalogServiceClient;
2323
import java.io.IOException;
2424

25-
// Sample to get Aspect Type
2625
public class GetAspectType {
2726

2827
public static void main(String[] args) throws IOException {
@@ -36,15 +35,13 @@ public static void main(String[] args) throws IOException {
3635
System.out.println("Aspect type retrieved successfully: " + aspectType.getName());
3736
}
3837

38+
// Method to retrieve Aspect Type located in projectId, location and with aspectTypeId
3939
public static AspectType getAspectType(String projectId, String location, String aspectTypeId)
4040
throws IOException {
41-
AspectTypeName aspectTypeName = AspectTypeName.of(projectId, location, aspectTypeId);
42-
4341
// Initialize client that will be used to send requests. This client only needs to be created
44-
// once, and can be reused for multiple requests. After completing all of your requests, call
45-
// the "close" method on the client to safely clean up any remaining background resources,
46-
// or use "try-with-close" statement to do this automatically.
42+
// once, and can be reused for multiple requests.
4743
try (CatalogServiceClient client = CatalogServiceClient.create()) {
44+
AspectTypeName aspectTypeName = AspectTypeName.of(projectId, location, aspectTypeId);
4845
return client.getAspectType(aspectTypeName);
4946
}
5047
}

0 commit comments

Comments
 (0)