From 40d53a76560661299590c61c3f476d0593a83bd3 Mon Sep 17 00:00:00 2001 From: Andrea Lin Date: Thu, 14 Jun 2018 12:05:15 -0700 Subject: [PATCH 1/9] update READMEs --- README.md | 5 +---- google-cloud-clients/google-cloud-compute/README.md | 3 +-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 1a444d7d2fa1..c1c9d7dab4ce 100644 --- a/README.md +++ b/README.md @@ -45,10 +45,7 @@ This library supports the following Google Cloud Platform services with clients - [Cloud Speech](google-cloud-clients/google-cloud-speech) (Alpha) - [Dialogflow](google-cloud-clients/google-cloud-dialogflow) (Alpha) - [Web Security Scanner](google-cloud-clients/google-cloud-websecurityscanner) (Alpha) - -These libraries are deprecated and no longer receive updates: - -- [Cloud Compute](google-cloud-clients/google-cloud-compute) (Deprecated) +- [Cloud Compute](google-cloud-clients/google-cloud-compute) (Alpha) Quickstart ---------- diff --git a/google-cloud-clients/google-cloud-compute/README.md b/google-cloud-clients/google-cloud-compute/README.md index f3a7e093f1f0..f763a5fc39db 100644 --- a/google-cloud-clients/google-cloud-compute/README.md +++ b/google-cloud-clients/google-cloud-compute/README.md @@ -12,7 +12,6 @@ Java idiomatic client for [Google Cloud Compute][cloud-compute]. - [Product Documentation][compute-product-docs] - [Client Library Documentation][compute-client-lib-docs] -> Note: This client is no longer receiving updates; new features in the Compute API will not be added to this client. Check https://cloud.google.com/compute/docs/api/libraries for the recommended Java client library to use for accessing Compute. @@ -276,4 +275,4 @@ Apache 2.0 - See [LICENSE] for more information. [cloud-compute]: https://cloud.google.com/compute/ [compute-product-docs]: https://cloud.google.com/compute/docs/ -[compute-client-lib-docs]: https://googlecloudplatform.github.io/google-cloud-java/google-cloud-clients/apidocs/index.html?com/google/cloud/compute/deprecated/package-summary.html +[compute-client-lib-docs]: https://googlecloudplatform.github.io/google-cloud-java/google-cloud-clients/apidocs/index.html?com/google/cloud/compute/v1/package-summary.html From 0112804b1e0dc952786ad3242d61cb12ce786cc5 Mon Sep 17 00:00:00 2001 From: Andrea Lin Date: Thu, 14 Jun 2018 17:00:57 -0700 Subject: [PATCH 2/9] move ComputeExamples to v1 and deprecated dirs --- google-cloud-examples/pom.xml | 6 +- .../{ => deprecated}/ComputeExample.java | 2 +- .../examples/compute/v1/ComputeExample.java | 144 ++++++++++++++++++ 3 files changed, 150 insertions(+), 2 deletions(-) rename google-cloud-examples/src/main/java/com/google/cloud/examples/compute/{ => deprecated}/ComputeExample.java (99%) create mode 100644 google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java diff --git a/google-cloud-examples/pom.xml b/google-cloud-examples/pom.xml index 5f63ba0a8389..f7d56b32b8bc 100644 --- a/google-cloud-examples/pom.xml +++ b/google-cloud-examples/pom.xml @@ -134,7 +134,11 @@ BigQueryExample - com.google.cloud.examples.compute.ComputeExample + com.google.cloud.examples.compute.deprecated.ComputeExample + ComputeExample + + + com.google.cloud.examples.compute.v1.ComputeExample ComputeExample diff --git a/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/ComputeExample.java b/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/deprecated/ComputeExample.java similarity index 99% rename from google-cloud-examples/src/main/java/com/google/cloud/examples/compute/ComputeExample.java rename to google-cloud-examples/src/main/java/com/google/cloud/examples/compute/deprecated/ComputeExample.java index 2a2f53810925..167fc8775bfd 100644 --- a/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/ComputeExample.java +++ b/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/deprecated/ComputeExample.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.google.cloud.examples.compute; +package com.google.cloud.examples.compute.deprecated; import com.google.api.gax.paging.Page; import com.google.cloud.Tuple; diff --git a/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java b/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java new file mode 100644 index 000000000000..ca5f3d1b162f --- /dev/null +++ b/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java @@ -0,0 +1,144 @@ +package com.google.cloud.examples.compute.v1; + +import com.google.api.core.ApiFuture; +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.auth.Credentials; +import com.google.auth.oauth2.GoogleCredentials; +import com.google.cloud.compute.v1.*; + +import java.io.IOException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; + +/** + * Use gax-java and generated message type to List Addresses in a test GCP Compute project. + */ +public class ComputeExample { + private static String PROJECT_NAME = "gapic-test"; + private static String REGION = "us-central1"; + + public static void main(String[] args) { + try { + AddressClient addressClient = createCredentialedClient(); + runExampleWithGapicGen(addressClient); + System.out.println("-------------------------------------------------------"); + runExampleWithGapicGenResourceName(addressClient); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private static AddressClient createCredentialedClient() throws IOException { + Credentials myCredentials = GoogleCredentials.getApplicationDefault(); + String myEndpoint = AddressSettings.getDefaultEndpoint(); + + // Begin samplegen code. This combines the "customize credentials" and "customize the endpoint" samples. + AddressSettings addressSettings = + AddressSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .setTransportChannelProvider( + AddressSettings.defaultHttpJsonTransportProviderBuilder() + .setEndpoint(myEndpoint).build()).build(); + AddressClient addressClient = + AddressClient.create(addressSettings); + // End samplegen code. + + return addressClient; + } + + // A basic List Address example. + private static void runExampleWithGapicGen(AddressClient client) { + System.out.println("Running with Gapic Client."); + AddressClient.ListAddressesPagedResponse listResponse = listAddresses(client); + verifyListAddressWithGets(client, listResponse); + } + + // Insert an address, and then delete the address. Use ResourceNames in the request objects. + private static void runExampleWithGapicGenResourceName(AddressClient client) { + System.out.println("Running with Gapic Client and Resource Name."); + String newAddressName = "usseaparkview"; + System.out.println("Inserting address:"); + + insertNewAddressJustClient(client, newAddressName); + + listAddresses(client); + + System.out.println("Deleting address:"); + Operation deleteResponse = client.deleteAddress( + ProjectRegionAddressName.of(newAddressName, PROJECT_NAME, REGION)); + System.out.format("Result of delete: %s\n", deleteResponse.toString()); + int sleepTimeInSeconds = 3; + System.out.format("Waiting %d seconds for server to update...\n", sleepTimeInSeconds); + // Wait for the delete operation to finish on the server. + try { + TimeUnit.SECONDS.sleep(sleepTimeInSeconds); + } catch (InterruptedException e) { + e.printStackTrace(); + } + listAddresses(client); + } + + private static void insertNewAddressJustClient(AddressClient client, String newAddressName) { + // Begin samplegen code for insertAddress(). + Address newAddress = Address.newBuilder().setName(newAddressName).build(); + ProjectRegionName region = ProjectRegionName.of(PROJECT_NAME, REGION); + Operation response = client.insertAddress(region, newAddress); + // End samplegen code for insertAddress(). + System.out.format("Result of insert: %s\n", response.toString()); + } + + private static void insertNewAddressUsingRequest(AddressClient client, String newAddressName) + throws InterruptedException, ExecutionException { + // Begin samplegen code for insertAddress(). + ProjectRegionName region = ProjectRegionName.of(PROJECT_NAME, REGION); + Address address = Address.newBuilder().build(); + InsertAddressHttpRequest request = InsertAddressHttpRequest.newBuilder() + .setRegion(region.toString()) + .setAddressResource(address) + .build(); + // Do something + Operation response = client.insertAddress(request); + + // End samplegen code for insertAddress(). + System.out.format("Result of insert: %s\n", response.toString()); + } + + private static void insertAddressUsingCallable(AddressClient client, String newAddressName) + throws InterruptedException, ExecutionException { + // Begin samplegen code for insertAddress(). + ProjectRegionName region = ProjectRegionName.of(PROJECT_NAME, REGION); + Address address = Address.newBuilder().build(); + InsertAddressHttpRequest request = InsertAddressHttpRequest.newBuilder() + .setRegion(region.toString()) + .setAddressResource(address) + .build(); + ApiFuture future = client.insertAddressCallable().futureCall(request); + // Do something + Operation response = future.get(); + + // End samplegen code for insertAddress(). + System.out.format("Result of insert: %s\n", response.toString()); + } + + private static AddressClient.ListAddressesPagedResponse listAddresses(AddressClient client) { + System.out.println("Listing addresses:"); + ProjectRegionName regionName = ProjectRegionName.newBuilder().setRegion(REGION).setProject(PROJECT_NAME).build(); + ListAddressesHttpRequest listRequest = ListAddressesHttpRequest.newBuilder() + .setRegion(regionName.toString()) + .build(); + AddressClient.ListAddressesPagedResponse response = client.listAddresses(listRequest); + for (Address address : response.iterateAll()) { + System.out.println("\t - " + address.toString()); + } + return response; + } + + private static void verifyListAddressWithGets(AddressClient client, AddressClient.ListAddressesPagedResponse listResponse) { + for (Address address : listResponse.iterateAll()) { + System.out.format("Making get request for address \"%s\"...\n", address.getName()); + Address fetchedAddress = client.getAddress( + ProjectRegionAddressName.of(address.getName(), PROJECT_NAME, REGION)); + System.out.format("addresses.get returns \n\t%s\n\n", fetchedAddress.toString()); + } + } +} \ No newline at end of file From 0f7ca424b5f148b6eb8b3da44d97e8b5f9dfc063 Mon Sep 17 00:00:00 2001 From: Andrea Lin Date: Thu, 14 Jun 2018 17:06:41 -0700 Subject: [PATCH 3/9] no star imporst --- .../google/cloud/examples/compute/v1/ComputeExample.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java b/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java index ca5f3d1b162f..011ea6281de2 100644 --- a/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java +++ b/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java @@ -4,8 +4,15 @@ import com.google.api.gax.core.FixedCredentialsProvider; import com.google.auth.Credentials; import com.google.auth.oauth2.GoogleCredentials; -import com.google.cloud.compute.v1.*; +import com.google.cloud.compute.v1.Address; +import com.google.cloud.compute.v1.AddressClient; +import com.google.cloud.compute.v1.AddressSettings; +import com.google.cloud.compute.v1.InsertAddressHttpRequest; +import com.google.cloud.compute.v1.ListAddressesHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectRegionAddressName; +import com.google.cloud.compute.v1.ProjectRegionName; import java.io.IOException; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; From 5c941adee6617a29e7b8d36e2562acf2fc58a190 Mon Sep 17 00:00:00 2001 From: Andrea Lin Date: Fri, 15 Jun 2018 12:04:22 -0700 Subject: [PATCH 4/9] clean up ComputeExample.java --- .../examples/compute/v1/ComputeExample.java | 62 ++++++++----------- 1 file changed, 26 insertions(+), 36 deletions(-) diff --git a/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java b/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java index 011ea6281de2..31561373ee01 100644 --- a/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java +++ b/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java @@ -18,52 +18,26 @@ import java.util.concurrent.TimeUnit; /** - * Use gax-java and generated message type to List Addresses in a test GCP Compute project. + * Working example code to make live calls on Addresses resources in a GCP Compute project. */ public class ComputeExample { - private static String PROJECT_NAME = "gapic-test"; - private static String REGION = "us-central1"; - - public static void main(String[] args) { - try { - AddressClient addressClient = createCredentialedClient(); - runExampleWithGapicGen(addressClient); - System.out.println("-------------------------------------------------------"); - runExampleWithGapicGenResourceName(addressClient); - } catch (IOException e) { - e.printStackTrace(); - } - } - - private static AddressClient createCredentialedClient() throws IOException { - Credentials myCredentials = GoogleCredentials.getApplicationDefault(); - String myEndpoint = AddressSettings.getDefaultEndpoint(); - // Begin samplegen code. This combines the "customize credentials" and "customize the endpoint" samples. - AddressSettings addressSettings = - AddressSettings.newBuilder() - .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) - .setTransportChannelProvider( - AddressSettings.defaultHttpJsonTransportProviderBuilder() - .setEndpoint(myEndpoint).build()).build(); - AddressClient addressClient = - AddressClient.create(addressSettings); - // End samplegen code. + // Replace the following String values with your Project and Region ids. + private static String PROJECT_NAME = "my-project-id"; + private static String REGION = "us-central1"; - return addressClient; - } + /** List addresses, Insert an address, and then delete the address. + * Use ResourceNames in the request objects. + */ + public static void main(String[] args) throws IOException { + AddressClient client = createCredentialedClient(); - // A basic List Address example. - private static void runExampleWithGapicGen(AddressClient client) { System.out.println("Running with Gapic Client."); AddressClient.ListAddressesPagedResponse listResponse = listAddresses(client); verifyListAddressWithGets(client, listResponse); - } - // Insert an address, and then delete the address. Use ResourceNames in the request objects. - private static void runExampleWithGapicGenResourceName(AddressClient client) { System.out.println("Running with Gapic Client and Resource Name."); - String newAddressName = "usseaparkview"; + String newAddressName = "new_address_name"; System.out.println("Inserting address:"); insertNewAddressJustClient(client, newAddressName); @@ -85,6 +59,19 @@ private static void runExampleWithGapicGenResourceName(AddressClient client) { listAddresses(client); } + private static AddressClient createCredentialedClient() throws IOException { + Credentials myCredentials = GoogleCredentials.getApplicationDefault(); + String myEndpoint = AddressSettings.getDefaultEndpoint(); + + AddressSettings addressSettings = + AddressSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .setTransportChannelProvider( + AddressSettings.defaultHttpJsonTransportProviderBuilder() + .setEndpoint(myEndpoint).build()).build(); + return AddressClient.create(addressSettings); + } + private static void insertNewAddressJustClient(AddressClient client, String newAddressName) { // Begin samplegen code for insertAddress(). Address newAddress = Address.newBuilder().setName(newAddressName).build(); @@ -94,6 +81,7 @@ private static void insertNewAddressJustClient(AddressClient client, String newA System.out.format("Result of insert: %s\n", response.toString()); } + /** Use an InsertAddressHttpRequest object to make an addresses.insert method call. */ private static void insertNewAddressUsingRequest(AddressClient client, String newAddressName) throws InterruptedException, ExecutionException { // Begin samplegen code for insertAddress(). @@ -110,6 +98,7 @@ private static void insertNewAddressUsingRequest(AddressClient client, String ne System.out.format("Result of insert: %s\n", response.toString()); } + /** Use an callable object to make an addresses.insert method call. */ private static void insertAddressUsingCallable(AddressClient client, String newAddressName) throws InterruptedException, ExecutionException { // Begin samplegen code for insertAddress(). @@ -127,6 +116,7 @@ private static void insertAddressUsingCallable(AddressClient client, String newA System.out.format("Result of insert: %s\n", response.toString()); } + /** List Addresses in the under the project PROJECT_NAME and region REGION. */ private static AddressClient.ListAddressesPagedResponse listAddresses(AddressClient client) { System.out.println("Listing addresses:"); ProjectRegionName regionName = ProjectRegionName.newBuilder().setRegion(REGION).setProject(PROJECT_NAME).build(); From 12dbd0ed79bd56229a341ef877eef723b9c43a2b Mon Sep 17 00:00:00 2001 From: Andrea Lin Date: Fri, 15 Jun 2018 12:05:57 -0700 Subject: [PATCH 5/9] googleJavaFormat on ComputeExample.javag --- .../examples/compute/v1/ComputeExample.java | 53 ++++++++++--------- 1 file changed, 28 insertions(+), 25 deletions(-) diff --git a/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java b/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java index 31561373ee01..cdcd380b8a47 100644 --- a/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java +++ b/google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java @@ -4,7 +4,6 @@ import com.google.api.gax.core.FixedCredentialsProvider; import com.google.auth.Credentials; import com.google.auth.oauth2.GoogleCredentials; - import com.google.cloud.compute.v1.Address; import com.google.cloud.compute.v1.AddressClient; import com.google.cloud.compute.v1.AddressSettings; @@ -17,17 +16,16 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; -/** - * Working example code to make live calls on Addresses resources in a GCP Compute project. - */ +/** Working example code to make live calls on Addresses resources in a GCP Compute project. */ public class ComputeExample { // Replace the following String values with your Project and Region ids. private static String PROJECT_NAME = "my-project-id"; private static String REGION = "us-central1"; - /** List addresses, Insert an address, and then delete the address. - * Use ResourceNames in the request objects. + /** + * List addresses, Insert an address, and then delete the address. Use ResourceNames in the + * request objects. */ public static void main(String[] args) throws IOException { AddressClient client = createCredentialedClient(); @@ -45,8 +43,8 @@ public static void main(String[] args) throws IOException { listAddresses(client); System.out.println("Deleting address:"); - Operation deleteResponse = client.deleteAddress( - ProjectRegionAddressName.of(newAddressName, PROJECT_NAME, REGION)); + Operation deleteResponse = + client.deleteAddress(ProjectRegionAddressName.of(newAddressName, PROJECT_NAME, REGION)); System.out.format("Result of delete: %s\n", deleteResponse.toString()); int sleepTimeInSeconds = 3; System.out.format("Waiting %d seconds for server to update...\n", sleepTimeInSeconds); @@ -68,7 +66,9 @@ private static AddressClient createCredentialedClient() throws IOException { .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) .setTransportChannelProvider( AddressSettings.defaultHttpJsonTransportProviderBuilder() - .setEndpoint(myEndpoint).build()).build(); + .setEndpoint(myEndpoint) + .build()) + .build(); return AddressClient.create(addressSettings); } @@ -87,10 +87,11 @@ private static void insertNewAddressUsingRequest(AddressClient client, String ne // Begin samplegen code for insertAddress(). ProjectRegionName region = ProjectRegionName.of(PROJECT_NAME, REGION); Address address = Address.newBuilder().build(); - InsertAddressHttpRequest request = InsertAddressHttpRequest.newBuilder() - .setRegion(region.toString()) - .setAddressResource(address) - .build(); + InsertAddressHttpRequest request = + InsertAddressHttpRequest.newBuilder() + .setRegion(region.toString()) + .setAddressResource(address) + .build(); // Do something Operation response = client.insertAddress(request); @@ -104,10 +105,11 @@ private static void insertAddressUsingCallable(AddressClient client, String newA // Begin samplegen code for insertAddress(). ProjectRegionName region = ProjectRegionName.of(PROJECT_NAME, REGION); Address address = Address.newBuilder().build(); - InsertAddressHttpRequest request = InsertAddressHttpRequest.newBuilder() - .setRegion(region.toString()) - .setAddressResource(address) - .build(); + InsertAddressHttpRequest request = + InsertAddressHttpRequest.newBuilder() + .setRegion(region.toString()) + .setAddressResource(address) + .build(); ApiFuture future = client.insertAddressCallable().futureCall(request); // Do something Operation response = future.get(); @@ -119,10 +121,10 @@ private static void insertAddressUsingCallable(AddressClient client, String newA /** List Addresses in the under the project PROJECT_NAME and region REGION. */ private static AddressClient.ListAddressesPagedResponse listAddresses(AddressClient client) { System.out.println("Listing addresses:"); - ProjectRegionName regionName = ProjectRegionName.newBuilder().setRegion(REGION).setProject(PROJECT_NAME).build(); - ListAddressesHttpRequest listRequest = ListAddressesHttpRequest.newBuilder() - .setRegion(regionName.toString()) - .build(); + ProjectRegionName regionName = + ProjectRegionName.newBuilder().setRegion(REGION).setProject(PROJECT_NAME).build(); + ListAddressesHttpRequest listRequest = + ListAddressesHttpRequest.newBuilder().setRegion(regionName.toString()).build(); AddressClient.ListAddressesPagedResponse response = client.listAddresses(listRequest); for (Address address : response.iterateAll()) { System.out.println("\t - " + address.toString()); @@ -130,12 +132,13 @@ private static AddressClient.ListAddressesPagedResponse listAddresses(AddressCli return response; } - private static void verifyListAddressWithGets(AddressClient client, AddressClient.ListAddressesPagedResponse listResponse) { + private static void verifyListAddressWithGets( + AddressClient client, AddressClient.ListAddressesPagedResponse listResponse) { for (Address address : listResponse.iterateAll()) { System.out.format("Making get request for address \"%s\"...\n", address.getName()); - Address fetchedAddress = client.getAddress( - ProjectRegionAddressName.of(address.getName(), PROJECT_NAME, REGION)); + Address fetchedAddress = + client.getAddress(ProjectRegionAddressName.of(address.getName(), PROJECT_NAME, REGION)); System.out.format("addresses.get returns \n\t%s\n\n", fetchedAddress.toString()); } } -} \ No newline at end of file +} From ef131660e9b0f152a888ef0d4732ac134c4933f9 Mon Sep 17 00:00:00 2001 From: Andrea Lin Date: Fri, 15 Jun 2018 12:08:07 -0700 Subject: [PATCH 6/9] alphabetaize --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index c1c9d7dab4ce..c0f46f5ad3f1 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ This library supports the following Google Cloud Platform services with clients This library supports the following Google Cloud Platform services with clients at an [Alpha](#versioning) quality level: +- [Cloud Compute](google-cloud-clients/google-cloud-compute) (Alpha) - [Cloud Dataproc](google-cloud-clients/google-cloud-dataproc) (Alpha) - [Cloud DNS](google-cloud-clients/google-cloud-dns) (Alpha) - [Cloud OS Login](google-cloud-clients/google-cloud-os-login) (Alpha) @@ -45,7 +46,6 @@ This library supports the following Google Cloud Platform services with clients - [Cloud Speech](google-cloud-clients/google-cloud-speech) (Alpha) - [Dialogflow](google-cloud-clients/google-cloud-dialogflow) (Alpha) - [Web Security Scanner](google-cloud-clients/google-cloud-websecurityscanner) (Alpha) -- [Cloud Compute](google-cloud-clients/google-cloud-compute) (Alpha) Quickstart ---------- From 5f57f8fd1350c33ab6a8ca5b915b067063d87f6f Mon Sep 17 00:00:00 2001 From: Andrea Lin Date: Mon, 18 Jun 2018 14:43:04 -0700 Subject: [PATCH 7/9] regen from toolkit and discovery-artifact-manager master --- .../compute/v1/DiskInstantiationConfig.java | 234 ++++++++++++ .../cloud/compute/v1/InstanceTemplate.java | 85 ++++- .../google/cloud/compute/v1/Interconnect.java | 40 ++- .../compute/v1/InterconnectAttachment.java | 339 +++++++++++++++++- ...InterconnectAttachmentPartnerMetadata.java | 205 +++++++++++ .../v1/PatchAutoscalerHttpRequest.java | 4 + .../v1/PatchBackendBucketHttpRequest.java | 4 + .../v1/PatchBackendServiceHttpRequest.java | 4 + .../compute/v1/PatchFirewallHttpRequest.java | 4 + .../v1/PatchHealthCheckHttpRequest.java | 4 + .../v1/PatchHttpHealthCheckHttpRequest.java | 4 + .../v1/PatchHttpsHealthCheckHttpRequest.java | 4 + .../v1/PatchInterconnectHttpRequest.java | 4 + .../compute/v1/PatchNetworkHttpRequest.java | 4 + .../v1/PatchRegionAutoscalerHttpRequest.java | 4 + .../PatchRegionBackendServiceHttpRequest.java | 4 + .../compute/v1/PatchRouterHttpRequest.java | 4 + .../compute/v1/PatchSslPolicyHttpRequest.java | 4 + .../v1/PatchSubnetworkHttpRequest.java | 4 + .../compute/v1/PatchUrlMapHttpRequest.java | 4 + .../cloud/compute/v1/RouterBgpPeer.java | 32 ++ .../cloud/compute/v1/RouterInterface.java | 41 ++- .../compute/v1/SourceInstanceParams.java | 151 ++++++++ ...getHttpsProxiesSetQuicOverrideRequest.java | 142 ++++++++ .../cloud/compute/v1/TargetHttpsProxy.java | 32 ++ .../v1/UpdateAutoscalerHttpRequest.java | 4 + .../v1/UpdateBackendBucketHttpRequest.java | 4 + .../v1/UpdateBackendServiceHttpRequest.java | 4 + .../compute/v1/UpdateFirewallHttpRequest.java | 4 + .../v1/UpdateHealthCheckHttpRequest.java | 4 + .../v1/UpdateHttpHealthCheckHttpRequest.java | 4 + .../v1/UpdateHttpsHealthCheckHttpRequest.java | 4 + ...teNetworkInterfaceInstanceHttpRequest.java | 4 + .../v1/UpdateRegionAutoscalerHttpRequest.java | 4 + ...UpdateRegionBackendServiceHttpRequest.java | 4 + .../compute/v1/UpdateRouterHttpRequest.java | 4 + .../compute/v1/UpdateUrlMapHttpRequest.java | 4 + .../compute/v1/AutoscalerClientTest.java | 2 + .../v1/InstanceTemplateClientTest.java | 2 + .../v1/InterconnectAttachmentClientTest.java | 16 + .../compute/v1/InterconnectClientTest.java | 2 + .../v1/TargetHttpsProxyClientTest.java | 2 + 42 files changed, 1417 insertions(+), 16 deletions(-) create mode 100644 google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskInstantiationConfig.java create mode 100644 google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentPartnerMetadata.java create mode 100644 google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SourceInstanceParams.java create mode 100644 google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxiesSetQuicOverrideRequest.java diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskInstantiationConfig.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskInstantiationConfig.java new file mode 100644 index 000000000000..94855a2708da --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/DiskInstantiationConfig.java @@ -0,0 +1,234 @@ +/* + * Copyright 2018 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.cloud.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class DiskInstantiationConfig implements ApiMessage { + private final Boolean autoDelete; + private final String customImage; + private final String deviceName; + private final String instantiateFrom; + + private DiskInstantiationConfig() { + this.autoDelete = null; + this.customImage = null; + this.deviceName = null; + this.instantiateFrom = null; + } + + private DiskInstantiationConfig( + Boolean autoDelete, String customImage, String deviceName, String instantiateFrom) { + this.autoDelete = autoDelete; + this.customImage = customImage; + this.deviceName = deviceName; + this.instantiateFrom = instantiateFrom; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("autoDelete")) { + return autoDelete; + } + if (fieldName.equals("customImage")) { + return customImage; + } + if (fieldName.equals("deviceName")) { + return deviceName; + } + if (fieldName.equals("instantiateFrom")) { + return instantiateFrom; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public Boolean getAutoDelete() { + return autoDelete; + } + + public String getCustomImage() { + return customImage; + } + + public String getDeviceName() { + return deviceName; + } + + public String getInstantiateFrom() { + return instantiateFrom; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(DiskInstantiationConfig prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static DiskInstantiationConfig getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final DiskInstantiationConfig DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new DiskInstantiationConfig(); + } + + public static class Builder { + private Boolean autoDelete; + private String customImage; + private String deviceName; + private String instantiateFrom; + + Builder() {} + + public Builder mergeFrom(DiskInstantiationConfig other) { + if (other == DiskInstantiationConfig.getDefaultInstance()) return this; + if (other.getAutoDelete() != null) { + this.autoDelete = other.autoDelete; + } + if (other.getCustomImage() != null) { + this.customImage = other.customImage; + } + if (other.getDeviceName() != null) { + this.deviceName = other.deviceName; + } + if (other.getInstantiateFrom() != null) { + this.instantiateFrom = other.instantiateFrom; + } + return this; + } + + Builder(DiskInstantiationConfig source) { + this.autoDelete = source.autoDelete; + this.customImage = source.customImage; + this.deviceName = source.deviceName; + this.instantiateFrom = source.instantiateFrom; + } + + public Boolean getAutoDelete() { + return autoDelete; + } + + public Builder setAutoDelete(Boolean autoDelete) { + this.autoDelete = autoDelete; + return this; + } + + public String getCustomImage() { + return customImage; + } + + public Builder setCustomImage(String customImage) { + this.customImage = customImage; + return this; + } + + public String getDeviceName() { + return deviceName; + } + + public Builder setDeviceName(String deviceName) { + this.deviceName = deviceName; + return this; + } + + public String getInstantiateFrom() { + return instantiateFrom; + } + + public Builder setInstantiateFrom(String instantiateFrom) { + this.instantiateFrom = instantiateFrom; + return this; + } + + public DiskInstantiationConfig build() { + + return new DiskInstantiationConfig(autoDelete, customImage, deviceName, instantiateFrom); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setAutoDelete(this.autoDelete); + newBuilder.setCustomImage(this.customImage); + newBuilder.setDeviceName(this.deviceName); + newBuilder.setInstantiateFrom(this.instantiateFrom); + return newBuilder; + } + } + + @Override + public String toString() { + return "DiskInstantiationConfig{" + + "autoDelete=" + + autoDelete + + ", " + + "customImage=" + + customImage + + ", " + + "deviceName=" + + deviceName + + ", " + + "instantiateFrom=" + + instantiateFrom + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof DiskInstantiationConfig) { + DiskInstantiationConfig that = (DiskInstantiationConfig) o; + return Objects.equals(this.autoDelete, that.getAutoDelete()) + && Objects.equals(this.customImage, that.getCustomImage()) + && Objects.equals(this.deviceName, that.getDeviceName()) + && Objects.equals(this.instantiateFrom, that.getInstantiateFrom()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(autoDelete, customImage, deviceName, instantiateFrom); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplate.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplate.java index acc02653fe16..8207dc5e8318 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplate.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InstanceTemplate.java @@ -32,6 +32,8 @@ public final class InstanceTemplate implements ApiMessage { private final String name; private final InstanceProperties properties; private final String selfLink; + private final String sourceInstance; + private final SourceInstanceParams sourceInstanceParams; private InstanceTemplate() { this.creationTimestamp = null; @@ -41,6 +43,8 @@ private InstanceTemplate() { this.name = null; this.properties = null; this.selfLink = null; + this.sourceInstance = null; + this.sourceInstanceParams = null; } private InstanceTemplate( @@ -50,7 +54,9 @@ private InstanceTemplate( String kind, String name, InstanceProperties properties, - String selfLink) { + String selfLink, + String sourceInstance, + SourceInstanceParams sourceInstanceParams) { this.creationTimestamp = creationTimestamp; this.description = description; this.id = id; @@ -58,6 +64,8 @@ private InstanceTemplate( this.name = name; this.properties = properties; this.selfLink = selfLink; + this.sourceInstance = sourceInstance; + this.sourceInstanceParams = sourceInstanceParams; } @Override @@ -83,6 +91,12 @@ public Object getFieldValue(String fieldName) { if (fieldName.equals("selfLink")) { return selfLink; } + if (fieldName.equals("sourceInstance")) { + return sourceInstance; + } + if (fieldName.equals("sourceInstanceParams")) { + return sourceInstanceParams; + } return null; } @@ -126,6 +140,14 @@ public String getSelfLink() { return selfLink; } + public String getSourceInstance() { + return sourceInstance; + } + + public SourceInstanceParams getSourceInstanceParams() { + return sourceInstanceParams; + } + public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } @@ -156,6 +178,8 @@ public static class Builder { private String name; private InstanceProperties properties; private String selfLink; + private String sourceInstance; + private SourceInstanceParams sourceInstanceParams; Builder() {} @@ -182,6 +206,12 @@ public Builder mergeFrom(InstanceTemplate other) { if (other.getSelfLink() != null) { this.selfLink = other.selfLink; } + if (other.getSourceInstance() != null) { + this.sourceInstance = other.sourceInstance; + } + if (other.getSourceInstanceParams() != null) { + this.sourceInstanceParams = other.sourceInstanceParams; + } return this; } @@ -193,6 +223,8 @@ public Builder mergeFrom(InstanceTemplate other) { this.name = source.name; this.properties = source.properties; this.selfLink = source.selfLink; + this.sourceInstance = source.sourceInstance; + this.sourceInstanceParams = source.sourceInstanceParams; } public String getCreationTimestamp() { @@ -258,10 +290,36 @@ public Builder setSelfLink(String selfLink) { return this; } + public String getSourceInstance() { + return sourceInstance; + } + + public Builder setSourceInstance(String sourceInstance) { + this.sourceInstance = sourceInstance; + return this; + } + + public SourceInstanceParams getSourceInstanceParams() { + return sourceInstanceParams; + } + + public Builder setSourceInstanceParams(SourceInstanceParams sourceInstanceParams) { + this.sourceInstanceParams = sourceInstanceParams; + return this; + } + public InstanceTemplate build() { return new InstanceTemplate( - creationTimestamp, description, id, kind, name, properties, selfLink); + creationTimestamp, + description, + id, + kind, + name, + properties, + selfLink, + sourceInstance, + sourceInstanceParams); } public Builder clone() { @@ -273,6 +331,8 @@ public Builder clone() { newBuilder.setName(this.name); newBuilder.setProperties(this.properties); newBuilder.setSelfLink(this.selfLink); + newBuilder.setSourceInstance(this.sourceInstance); + newBuilder.setSourceInstanceParams(this.sourceInstanceParams); return newBuilder; } } @@ -300,6 +360,12 @@ public String toString() { + ", " + "selfLink=" + selfLink + + ", " + + "sourceInstance=" + + sourceInstance + + ", " + + "sourceInstanceParams=" + + sourceInstanceParams + "}"; } @@ -316,13 +382,24 @@ public boolean equals(Object o) { && Objects.equals(this.kind, that.getKind()) && Objects.equals(this.name, that.getName()) && Objects.equals(this.properties, that.getProperties()) - && Objects.equals(this.selfLink, that.getSelfLink()); + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.sourceInstance, that.getSourceInstance()) + && Objects.equals(this.sourceInstanceParams, that.getSourceInstanceParams()); } return false; } @Override public int hashCode() { - return Objects.hash(creationTimestamp, description, id, kind, name, properties, selfLink); + return Objects.hash( + creationTimestamp, + description, + id, + kind, + name, + properties, + selfLink, + sourceInstance, + sourceInstanceParams); } } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Interconnect.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Interconnect.java index 089b0939531e..bd06ffb8fe3d 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Interconnect.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/Interconnect.java @@ -47,6 +47,7 @@ public final class Interconnect implements ApiMessage { private final Integer provisionedLinkCount; private final Integer requestedLinkCount; private final String selfLink; + private final String state; private Interconnect() { this.adminEnabled = null; @@ -70,6 +71,7 @@ private Interconnect() { this.provisionedLinkCount = null; this.requestedLinkCount = null; this.selfLink = null; + this.state = null; } private Interconnect( @@ -93,7 +95,8 @@ private Interconnect( String peerIpAddress, Integer provisionedLinkCount, Integer requestedLinkCount, - String selfLink) { + String selfLink, + String state) { this.adminEnabled = adminEnabled; this.circuitInfos = circuitInfos; this.creationTimestamp = creationTimestamp; @@ -115,6 +118,7 @@ private Interconnect( this.provisionedLinkCount = provisionedLinkCount; this.requestedLinkCount = requestedLinkCount; this.selfLink = selfLink; + this.state = state; } @Override @@ -182,6 +186,9 @@ public Object getFieldValue(String fieldName) { if (fieldName.equals("selfLink")) { return selfLink; } + if (fieldName.equals("state")) { + return state; + } return null; } @@ -281,6 +288,10 @@ public String getSelfLink() { return selfLink; } + public String getState() { + return state; + } + public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } @@ -325,6 +336,7 @@ public static class Builder { private Integer provisionedLinkCount; private Integer requestedLinkCount; private String selfLink; + private String state; Builder() {} @@ -393,6 +405,9 @@ public Builder mergeFrom(Interconnect other) { if (other.getSelfLink() != null) { this.selfLink = other.selfLink; } + if (other.getState() != null) { + this.state = other.state; + } return this; } @@ -418,6 +433,7 @@ public Builder mergeFrom(Interconnect other) { this.provisionedLinkCount = source.provisionedLinkCount; this.requestedLinkCount = source.requestedLinkCount; this.selfLink = source.selfLink; + this.state = source.state; } public Boolean getAdminEnabled() { @@ -633,6 +649,15 @@ public Builder setSelfLink(String selfLink) { return this; } + public String getState() { + return state; + } + + public Builder setState(String state) { + this.state = state; + return this; + } + public Interconnect build() { return new Interconnect( @@ -656,7 +681,8 @@ public Interconnect build() { peerIpAddress, provisionedLinkCount, requestedLinkCount, - selfLink); + selfLink, + state); } public Builder clone() { @@ -682,6 +708,7 @@ public Builder clone() { newBuilder.setProvisionedLinkCount(this.provisionedLinkCount); newBuilder.setRequestedLinkCount(this.requestedLinkCount); newBuilder.setSelfLink(this.selfLink); + newBuilder.setState(this.state); return newBuilder; } } @@ -751,6 +778,9 @@ public String toString() { + ", " + "selfLink=" + selfLink + + ", " + + "state=" + + state + "}"; } @@ -781,7 +811,8 @@ public boolean equals(Object o) { && Objects.equals(this.peerIpAddress, that.getPeerIpAddress()) && Objects.equals(this.provisionedLinkCount, that.getProvisionedLinkCount()) && Objects.equals(this.requestedLinkCount, that.getRequestedLinkCount()) - && Objects.equals(this.selfLink, that.getSelfLink()); + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.state, that.getState()); } return false; } @@ -809,6 +840,7 @@ public int hashCode() { peerIpAddress, provisionedLinkCount, requestedLinkCount, - selfLink); + selfLink, + state); } } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachment.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachment.java index ad6378241434..c51cdee5dfd2 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachment.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachment.java @@ -17,6 +17,7 @@ import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; import java.util.List; import java.util.Objects; import javax.annotation.Generated; @@ -25,71 +26,120 @@ @Generated("by GAPIC") @BetaApi public final class InterconnectAttachment implements ApiMessage { + private final Boolean adminEnabled; + private final String bandwidth; + private final List candidateSubnets; private final String cloudRouterIpAddress; private final String creationTimestamp; private final String customerRouterIpAddress; private final String description; + private final String edgeAvailabilityDomain; private final String googleReferenceId; private final String id; private final String interconnect; private final String kind; private final String name; private final String operationalStatus; + private final String pairingKey; + private final String partnerAsn; + private final InterconnectAttachmentPartnerMetadata partnerMetadata; private final InterconnectAttachmentPrivateInfo privateInterconnectInfo; private final String region; private final String router; private final String selfLink; + private final String state; + private final String type; + private final Integer vlanTag8021q; private InterconnectAttachment() { + this.adminEnabled = null; + this.bandwidth = null; + this.candidateSubnets = null; this.cloudRouterIpAddress = null; this.creationTimestamp = null; this.customerRouterIpAddress = null; this.description = null; + this.edgeAvailabilityDomain = null; this.googleReferenceId = null; this.id = null; this.interconnect = null; this.kind = null; this.name = null; this.operationalStatus = null; + this.pairingKey = null; + this.partnerAsn = null; + this.partnerMetadata = null; this.privateInterconnectInfo = null; this.region = null; this.router = null; this.selfLink = null; + this.state = null; + this.type = null; + this.vlanTag8021q = null; } private InterconnectAttachment( + Boolean adminEnabled, + String bandwidth, + List candidateSubnets, String cloudRouterIpAddress, String creationTimestamp, String customerRouterIpAddress, String description, + String edgeAvailabilityDomain, String googleReferenceId, String id, String interconnect, String kind, String name, String operationalStatus, + String pairingKey, + String partnerAsn, + InterconnectAttachmentPartnerMetadata partnerMetadata, InterconnectAttachmentPrivateInfo privateInterconnectInfo, String region, String router, - String selfLink) { + String selfLink, + String state, + String type, + Integer vlanTag8021q) { + this.adminEnabled = adminEnabled; + this.bandwidth = bandwidth; + this.candidateSubnets = candidateSubnets; this.cloudRouterIpAddress = cloudRouterIpAddress; this.creationTimestamp = creationTimestamp; this.customerRouterIpAddress = customerRouterIpAddress; this.description = description; + this.edgeAvailabilityDomain = edgeAvailabilityDomain; this.googleReferenceId = googleReferenceId; this.id = id; this.interconnect = interconnect; this.kind = kind; this.name = name; this.operationalStatus = operationalStatus; + this.pairingKey = pairingKey; + this.partnerAsn = partnerAsn; + this.partnerMetadata = partnerMetadata; this.privateInterconnectInfo = privateInterconnectInfo; this.region = region; this.router = router; this.selfLink = selfLink; + this.state = state; + this.type = type; + this.vlanTag8021q = vlanTag8021q; } @Override public Object getFieldValue(String fieldName) { + if (fieldName.equals("adminEnabled")) { + return adminEnabled; + } + if (fieldName.equals("bandwidth")) { + return bandwidth; + } + if (fieldName.equals("candidateSubnets")) { + return candidateSubnets; + } if (fieldName.equals("cloudRouterIpAddress")) { return cloudRouterIpAddress; } @@ -102,6 +152,9 @@ public Object getFieldValue(String fieldName) { if (fieldName.equals("description")) { return description; } + if (fieldName.equals("edgeAvailabilityDomain")) { + return edgeAvailabilityDomain; + } if (fieldName.equals("googleReferenceId")) { return googleReferenceId; } @@ -120,6 +173,15 @@ public Object getFieldValue(String fieldName) { if (fieldName.equals("operationalStatus")) { return operationalStatus; } + if (fieldName.equals("pairingKey")) { + return pairingKey; + } + if (fieldName.equals("partnerAsn")) { + return partnerAsn; + } + if (fieldName.equals("partnerMetadata")) { + return partnerMetadata; + } if (fieldName.equals("privateInterconnectInfo")) { return privateInterconnectInfo; } @@ -132,6 +194,15 @@ public Object getFieldValue(String fieldName) { if (fieldName.equals("selfLink")) { return selfLink; } + if (fieldName.equals("state")) { + return state; + } + if (fieldName.equals("type")) { + return type; + } + if (fieldName.equals("vlanTag8021q")) { + return vlanTag8021q; + } return null; } @@ -147,6 +218,18 @@ public List getFieldMask() { return null; } + public Boolean getAdminEnabled() { + return adminEnabled; + } + + public String getBandwidth() { + return bandwidth; + } + + public List getCandidateSubnetsList() { + return candidateSubnets; + } + public String getCloudRouterIpAddress() { return cloudRouterIpAddress; } @@ -163,6 +246,10 @@ public String getDescription() { return description; } + public String getEdgeAvailabilityDomain() { + return edgeAvailabilityDomain; + } + public String getGoogleReferenceId() { return googleReferenceId; } @@ -187,6 +274,18 @@ public String getOperationalStatus() { return operationalStatus; } + public String getPairingKey() { + return pairingKey; + } + + public String getPartnerAsn() { + return partnerAsn; + } + + public InterconnectAttachmentPartnerMetadata getPartnerMetadata() { + return partnerMetadata; + } + public InterconnectAttachmentPrivateInfo getPrivateInterconnectInfo() { return privateInterconnectInfo; } @@ -203,6 +302,18 @@ public String getSelfLink() { return selfLink; } + public String getState() { + return state; + } + + public String getType() { + return type; + } + + public Integer getVlanTag8021q() { + return vlanTag8021q; + } + public static Builder newBuilder() { return DEFAULT_INSTANCE.toBuilder(); } @@ -226,25 +337,44 @@ public static InterconnectAttachment getDefaultInstance() { } public static class Builder { + private Boolean adminEnabled; + private String bandwidth; + private List candidateSubnets; private String cloudRouterIpAddress; private String creationTimestamp; private String customerRouterIpAddress; private String description; + private String edgeAvailabilityDomain; private String googleReferenceId; private String id; private String interconnect; private String kind; private String name; private String operationalStatus; + private String pairingKey; + private String partnerAsn; + private InterconnectAttachmentPartnerMetadata partnerMetadata; private InterconnectAttachmentPrivateInfo privateInterconnectInfo; private String region; private String router; private String selfLink; + private String state; + private String type; + private Integer vlanTag8021q; Builder() {} public Builder mergeFrom(InterconnectAttachment other) { if (other == InterconnectAttachment.getDefaultInstance()) return this; + if (other.getAdminEnabled() != null) { + this.adminEnabled = other.adminEnabled; + } + if (other.getBandwidth() != null) { + this.bandwidth = other.bandwidth; + } + if (other.getCandidateSubnetsList() != null) { + this.candidateSubnets = other.candidateSubnets; + } if (other.getCloudRouterIpAddress() != null) { this.cloudRouterIpAddress = other.cloudRouterIpAddress; } @@ -257,6 +387,9 @@ public Builder mergeFrom(InterconnectAttachment other) { if (other.getDescription() != null) { this.description = other.description; } + if (other.getEdgeAvailabilityDomain() != null) { + this.edgeAvailabilityDomain = other.edgeAvailabilityDomain; + } if (other.getGoogleReferenceId() != null) { this.googleReferenceId = other.googleReferenceId; } @@ -275,6 +408,15 @@ public Builder mergeFrom(InterconnectAttachment other) { if (other.getOperationalStatus() != null) { this.operationalStatus = other.operationalStatus; } + if (other.getPairingKey() != null) { + this.pairingKey = other.pairingKey; + } + if (other.getPartnerAsn() != null) { + this.partnerAsn = other.partnerAsn; + } + if (other.getPartnerMetadata() != null) { + this.partnerMetadata = other.partnerMetadata; + } if (other.getPrivateInterconnectInfo() != null) { this.privateInterconnectInfo = other.privateInterconnectInfo; } @@ -287,24 +429,78 @@ public Builder mergeFrom(InterconnectAttachment other) { if (other.getSelfLink() != null) { this.selfLink = other.selfLink; } + if (other.getState() != null) { + this.state = other.state; + } + if (other.getType() != null) { + this.type = other.type; + } + if (other.getVlanTag8021q() != null) { + this.vlanTag8021q = other.vlanTag8021q; + } return this; } Builder(InterconnectAttachment source) { + this.adminEnabled = source.adminEnabled; + this.bandwidth = source.bandwidth; + this.candidateSubnets = source.candidateSubnets; this.cloudRouterIpAddress = source.cloudRouterIpAddress; this.creationTimestamp = source.creationTimestamp; this.customerRouterIpAddress = source.customerRouterIpAddress; this.description = source.description; + this.edgeAvailabilityDomain = source.edgeAvailabilityDomain; this.googleReferenceId = source.googleReferenceId; this.id = source.id; this.interconnect = source.interconnect; this.kind = source.kind; this.name = source.name; this.operationalStatus = source.operationalStatus; + this.pairingKey = source.pairingKey; + this.partnerAsn = source.partnerAsn; + this.partnerMetadata = source.partnerMetadata; this.privateInterconnectInfo = source.privateInterconnectInfo; this.region = source.region; this.router = source.router; this.selfLink = source.selfLink; + this.state = source.state; + this.type = source.type; + this.vlanTag8021q = source.vlanTag8021q; + } + + public Boolean getAdminEnabled() { + return adminEnabled; + } + + public Builder setAdminEnabled(Boolean adminEnabled) { + this.adminEnabled = adminEnabled; + return this; + } + + public String getBandwidth() { + return bandwidth; + } + + public Builder setBandwidth(String bandwidth) { + this.bandwidth = bandwidth; + return this; + } + + public List getCandidateSubnetsList() { + return candidateSubnets; + } + + public Builder addAllCandidateSubnets(List candidateSubnets) { + if (this.candidateSubnets == null) { + this.candidateSubnets = new ArrayList<>(candidateSubnets.size()); + } + this.candidateSubnets.addAll(candidateSubnets); + return this; + } + + public Builder addCandidateSubnets(String candidateSubnets) { + this.candidateSubnets.add(candidateSubnets); + return this; } public String getCloudRouterIpAddress() { @@ -343,6 +539,15 @@ public Builder setDescription(String description) { return this; } + public String getEdgeAvailabilityDomain() { + return edgeAvailabilityDomain; + } + + public Builder setEdgeAvailabilityDomain(String edgeAvailabilityDomain) { + this.edgeAvailabilityDomain = edgeAvailabilityDomain; + return this; + } + public String getGoogleReferenceId() { return googleReferenceId; } @@ -397,6 +602,33 @@ public Builder setOperationalStatus(String operationalStatus) { return this; } + public String getPairingKey() { + return pairingKey; + } + + public Builder setPairingKey(String pairingKey) { + this.pairingKey = pairingKey; + return this; + } + + public String getPartnerAsn() { + return partnerAsn; + } + + public Builder setPartnerAsn(String partnerAsn) { + this.partnerAsn = partnerAsn; + return this; + } + + public InterconnectAttachmentPartnerMetadata getPartnerMetadata() { + return partnerMetadata; + } + + public Builder setPartnerMetadata(InterconnectAttachmentPartnerMetadata partnerMetadata) { + this.partnerMetadata = partnerMetadata; + return this; + } + public InterconnectAttachmentPrivateInfo getPrivateInterconnectInfo() { return privateInterconnectInfo; } @@ -434,41 +666,88 @@ public Builder setSelfLink(String selfLink) { return this; } + public String getState() { + return state; + } + + public Builder setState(String state) { + this.state = state; + return this; + } + + public String getType() { + return type; + } + + public Builder setType(String type) { + this.type = type; + return this; + } + + public Integer getVlanTag8021q() { + return vlanTag8021q; + } + + public Builder setVlanTag8021q(Integer vlanTag8021q) { + this.vlanTag8021q = vlanTag8021q; + return this; + } + public InterconnectAttachment build() { return new InterconnectAttachment( + adminEnabled, + bandwidth, + candidateSubnets, cloudRouterIpAddress, creationTimestamp, customerRouterIpAddress, description, + edgeAvailabilityDomain, googleReferenceId, id, interconnect, kind, name, operationalStatus, + pairingKey, + partnerAsn, + partnerMetadata, privateInterconnectInfo, region, router, - selfLink); + selfLink, + state, + type, + vlanTag8021q); } public Builder clone() { Builder newBuilder = new Builder(); + newBuilder.setAdminEnabled(this.adminEnabled); + newBuilder.setBandwidth(this.bandwidth); + newBuilder.addAllCandidateSubnets(this.candidateSubnets); newBuilder.setCloudRouterIpAddress(this.cloudRouterIpAddress); newBuilder.setCreationTimestamp(this.creationTimestamp); newBuilder.setCustomerRouterIpAddress(this.customerRouterIpAddress); newBuilder.setDescription(this.description); + newBuilder.setEdgeAvailabilityDomain(this.edgeAvailabilityDomain); newBuilder.setGoogleReferenceId(this.googleReferenceId); newBuilder.setId(this.id); newBuilder.setInterconnect(this.interconnect); newBuilder.setKind(this.kind); newBuilder.setName(this.name); newBuilder.setOperationalStatus(this.operationalStatus); + newBuilder.setPairingKey(this.pairingKey); + newBuilder.setPartnerAsn(this.partnerAsn); + newBuilder.setPartnerMetadata(this.partnerMetadata); newBuilder.setPrivateInterconnectInfo(this.privateInterconnectInfo); newBuilder.setRegion(this.region); newBuilder.setRouter(this.router); newBuilder.setSelfLink(this.selfLink); + newBuilder.setState(this.state); + newBuilder.setType(this.type); + newBuilder.setVlanTag8021q(this.vlanTag8021q); return newBuilder; } } @@ -476,6 +755,15 @@ public Builder clone() { @Override public String toString() { return "InterconnectAttachment{" + + "adminEnabled=" + + adminEnabled + + ", " + + "bandwidth=" + + bandwidth + + ", " + + "candidateSubnets=" + + candidateSubnets + + ", " + "cloudRouterIpAddress=" + cloudRouterIpAddress + ", " @@ -488,6 +776,9 @@ public String toString() { + "description=" + description + ", " + + "edgeAvailabilityDomain=" + + edgeAvailabilityDomain + + ", " + "googleReferenceId=" + googleReferenceId + ", " @@ -506,6 +797,15 @@ public String toString() { + "operationalStatus=" + operationalStatus + ", " + + "pairingKey=" + + pairingKey + + ", " + + "partnerAsn=" + + partnerAsn + + ", " + + "partnerMetadata=" + + partnerMetadata + + ", " + "privateInterconnectInfo=" + privateInterconnectInfo + ", " @@ -517,6 +817,15 @@ public String toString() { + ", " + "selfLink=" + selfLink + + ", " + + "state=" + + state + + ", " + + "type=" + + type + + ", " + + "vlanTag8021q=" + + vlanTag8021q + "}"; } @@ -527,20 +836,30 @@ public boolean equals(Object o) { } if (o instanceof InterconnectAttachment) { InterconnectAttachment that = (InterconnectAttachment) o; - return Objects.equals(this.cloudRouterIpAddress, that.getCloudRouterIpAddress()) + return Objects.equals(this.adminEnabled, that.getAdminEnabled()) + && Objects.equals(this.bandwidth, that.getBandwidth()) + && Objects.equals(this.candidateSubnets, that.getCandidateSubnetsList()) + && Objects.equals(this.cloudRouterIpAddress, that.getCloudRouterIpAddress()) && Objects.equals(this.creationTimestamp, that.getCreationTimestamp()) && Objects.equals(this.customerRouterIpAddress, that.getCustomerRouterIpAddress()) && Objects.equals(this.description, that.getDescription()) + && Objects.equals(this.edgeAvailabilityDomain, that.getEdgeAvailabilityDomain()) && Objects.equals(this.googleReferenceId, that.getGoogleReferenceId()) && Objects.equals(this.id, that.getId()) && Objects.equals(this.interconnect, that.getInterconnect()) && Objects.equals(this.kind, that.getKind()) && Objects.equals(this.name, that.getName()) && Objects.equals(this.operationalStatus, that.getOperationalStatus()) + && Objects.equals(this.pairingKey, that.getPairingKey()) + && Objects.equals(this.partnerAsn, that.getPartnerAsn()) + && Objects.equals(this.partnerMetadata, that.getPartnerMetadata()) && Objects.equals(this.privateInterconnectInfo, that.getPrivateInterconnectInfo()) && Objects.equals(this.region, that.getRegion()) && Objects.equals(this.router, that.getRouter()) - && Objects.equals(this.selfLink, that.getSelfLink()); + && Objects.equals(this.selfLink, that.getSelfLink()) + && Objects.equals(this.state, that.getState()) + && Objects.equals(this.type, that.getType()) + && Objects.equals(this.vlanTag8021q, that.getVlanTag8021q()); } return false; } @@ -548,19 +867,29 @@ public boolean equals(Object o) { @Override public int hashCode() { return Objects.hash( + adminEnabled, + bandwidth, + candidateSubnets, cloudRouterIpAddress, creationTimestamp, customerRouterIpAddress, description, + edgeAvailabilityDomain, googleReferenceId, id, interconnect, kind, name, operationalStatus, + pairingKey, + partnerAsn, + partnerMetadata, privateInterconnectInfo, region, router, - selfLink); + selfLink, + state, + type, + vlanTag8021q); } } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentPartnerMetadata.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentPartnerMetadata.java new file mode 100644 index 000000000000..12d2300ed3c5 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachmentPartnerMetadata.java @@ -0,0 +1,205 @@ +/* + * Copyright 2018 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.cloud.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class InterconnectAttachmentPartnerMetadata implements ApiMessage { + private final String interconnectName; + private final String partnerName; + private final String portalUrl; + + private InterconnectAttachmentPartnerMetadata() { + this.interconnectName = null; + this.partnerName = null; + this.portalUrl = null; + } + + private InterconnectAttachmentPartnerMetadata( + String interconnectName, String partnerName, String portalUrl) { + this.interconnectName = interconnectName; + this.partnerName = partnerName; + this.portalUrl = portalUrl; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("interconnectName")) { + return interconnectName; + } + if (fieldName.equals("partnerName")) { + return partnerName; + } + if (fieldName.equals("portalUrl")) { + return portalUrl; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getInterconnectName() { + return interconnectName; + } + + public String getPartnerName() { + return partnerName; + } + + public String getPortalUrl() { + return portalUrl; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(InterconnectAttachmentPartnerMetadata prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static InterconnectAttachmentPartnerMetadata getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final InterconnectAttachmentPartnerMetadata DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new InterconnectAttachmentPartnerMetadata(); + } + + public static class Builder { + private String interconnectName; + private String partnerName; + private String portalUrl; + + Builder() {} + + public Builder mergeFrom(InterconnectAttachmentPartnerMetadata other) { + if (other == InterconnectAttachmentPartnerMetadata.getDefaultInstance()) return this; + if (other.getInterconnectName() != null) { + this.interconnectName = other.interconnectName; + } + if (other.getPartnerName() != null) { + this.partnerName = other.partnerName; + } + if (other.getPortalUrl() != null) { + this.portalUrl = other.portalUrl; + } + return this; + } + + Builder(InterconnectAttachmentPartnerMetadata source) { + this.interconnectName = source.interconnectName; + this.partnerName = source.partnerName; + this.portalUrl = source.portalUrl; + } + + public String getInterconnectName() { + return interconnectName; + } + + public Builder setInterconnectName(String interconnectName) { + this.interconnectName = interconnectName; + return this; + } + + public String getPartnerName() { + return partnerName; + } + + public Builder setPartnerName(String partnerName) { + this.partnerName = partnerName; + return this; + } + + public String getPortalUrl() { + return portalUrl; + } + + public Builder setPortalUrl(String portalUrl) { + this.portalUrl = portalUrl; + return this; + } + + public InterconnectAttachmentPartnerMetadata build() { + + return new InterconnectAttachmentPartnerMetadata(interconnectName, partnerName, portalUrl); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setInterconnectName(this.interconnectName); + newBuilder.setPartnerName(this.partnerName); + newBuilder.setPortalUrl(this.portalUrl); + return newBuilder; + } + } + + @Override + public String toString() { + return "InterconnectAttachmentPartnerMetadata{" + + "interconnectName=" + + interconnectName + + ", " + + "partnerName=" + + partnerName + + ", " + + "portalUrl=" + + portalUrl + + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof InterconnectAttachmentPartnerMetadata) { + InterconnectAttachmentPartnerMetadata that = (InterconnectAttachmentPartnerMetadata) o; + return Objects.equals(this.interconnectName, that.getInterconnectName()) + && Objects.equals(this.partnerName, that.getPartnerName()) + && Objects.equals(this.portalUrl, that.getPortalUrl()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(interconnectName, partnerName, portalUrl); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchAutoscalerHttpRequest.java index 2102af68384b..fdc1979e778e 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchAutoscalerHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchAutoscalerHttpRequest.java @@ -382,6 +382,10 @@ public Builder setZone(String zone) { public PatchAutoscalerHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (zone == null) { missing += " zone"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendBucketHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendBucketHttpRequest.java index c2557817a243..3a737eb0b9ce 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendBucketHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendBucketHttpRequest.java @@ -361,6 +361,10 @@ public PatchBackendBucketHttpRequest build() { missing += " backendBucket"; } + if (fieldMask == null) { + missing += " fieldMask"; + } + if (!missing.isEmpty()) { throw new IllegalStateException("Missing required properties:" + missing); } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendServiceHttpRequest.java index cbd151c53a69..2caaae983716 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendServiceHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchBackendServiceHttpRequest.java @@ -361,6 +361,10 @@ public PatchBackendServiceHttpRequest build() { missing += " backendService"; } + if (fieldMask == null) { + missing += " fieldMask"; + } + if (!missing.isEmpty()) { throw new IllegalStateException("Missing required properties:" + missing); } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchFirewallHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchFirewallHttpRequest.java index b9eeb0fcb088..f1218fb5a23e 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchFirewallHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchFirewallHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public PatchFirewallHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (firewall == null) { missing += " firewall"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHealthCheckHttpRequest.java index 4434ba523295..b9255ed87df5 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHealthCheckHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHealthCheckHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public PatchHealthCheckHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (healthCheck == null) { missing += " healthCheck"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpHealthCheckHttpRequest.java index 547949750001..3d4ed178180e 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpHealthCheckHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpHealthCheckHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public PatchHttpHealthCheckHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (httpHealthCheck == null) { missing += " httpHealthCheck"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpsHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpsHealthCheckHttpRequest.java index fca2a190e0ea..442893b6ccba 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpsHealthCheckHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchHttpsHealthCheckHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public PatchHttpsHealthCheckHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (httpsHealthCheck == null) { missing += " httpsHealthCheck"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchInterconnectHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchInterconnectHttpRequest.java index d6e8277ab9a5..0a279fb23637 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchInterconnectHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchInterconnectHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public PatchInterconnectHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (interconnect == null) { missing += " interconnect"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchNetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchNetworkHttpRequest.java index 28d763a2bf0c..3bd7b0ceae42 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchNetworkHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchNetworkHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public PatchNetworkHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (network == null) { missing += " network"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionAutoscalerHttpRequest.java index c3c81698c71e..8682d8648c49 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionAutoscalerHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionAutoscalerHttpRequest.java @@ -382,6 +382,10 @@ public Builder setUserIp(String userIp) { public PatchRegionAutoscalerHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (region == null) { missing += " region"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionBackendServiceHttpRequest.java index 4f91c71c2486..c19f5b8aa0a2 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionBackendServiceHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRegionBackendServiceHttpRequest.java @@ -361,6 +361,10 @@ public PatchRegionBackendServiceHttpRequest build() { missing += " backendService"; } + if (fieldMask == null) { + missing += " fieldMask"; + } + if (!missing.isEmpty()) { throw new IllegalStateException("Missing required properties:" + missing); } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRouterHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRouterHttpRequest.java index bf550127c4f0..bab84a330c8a 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRouterHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchRouterHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public PatchRouterHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (router == null) { missing += " router"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSslPolicyHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSslPolicyHttpRequest.java index 41c751755cd8..1314a71ede1e 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSslPolicyHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSslPolicyHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public PatchSslPolicyHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (sslPolicy == null) { missing += " sslPolicy"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSubnetworkHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSubnetworkHttpRequest.java index 0cb24e08eb02..4aebb4b127d4 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSubnetworkHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchSubnetworkHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public PatchSubnetworkHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (subnetwork == null) { missing += " subnetwork"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchUrlMapHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchUrlMapHttpRequest.java index ec3e86f9e168..404152be0e14 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchUrlMapHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/PatchUrlMapHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public PatchUrlMapHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (urlMap == null) { missing += " urlMap"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterBgpPeer.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterBgpPeer.java index 1667284e364c..7e83135bed4b 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterBgpPeer.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterBgpPeer.java @@ -32,6 +32,7 @@ public final class RouterBgpPeer implements ApiMessage { private final Integer advertisedRoutePriority; private final String interfaceName; private final String ipAddress; + private final String managementType; private final String name; private final Integer peerAsn; private final String peerIpAddress; @@ -43,6 +44,7 @@ private RouterBgpPeer() { this.advertisedRoutePriority = null; this.interfaceName = null; this.ipAddress = null; + this.managementType = null; this.name = null; this.peerAsn = null; this.peerIpAddress = null; @@ -55,6 +57,7 @@ private RouterBgpPeer( Integer advertisedRoutePriority, String interfaceName, String ipAddress, + String managementType, String name, Integer peerAsn, String peerIpAddress) { @@ -64,6 +67,7 @@ private RouterBgpPeer( this.advertisedRoutePriority = advertisedRoutePriority; this.interfaceName = interfaceName; this.ipAddress = ipAddress; + this.managementType = managementType; this.name = name; this.peerAsn = peerAsn; this.peerIpAddress = peerIpAddress; @@ -89,6 +93,9 @@ public Object getFieldValue(String fieldName) { if (fieldName.equals("ipAddress")) { return ipAddress; } + if (fieldName.equals("managementType")) { + return managementType; + } if (fieldName.equals("name")) { return name; } @@ -137,6 +144,10 @@ public String getIpAddress() { return ipAddress; } + public String getManagementType() { + return managementType; + } + public String getName() { return name; } @@ -178,6 +189,7 @@ public static class Builder { private Integer advertisedRoutePriority; private String interfaceName; private String ipAddress; + private String managementType; private String name; private Integer peerAsn; private String peerIpAddress; @@ -204,6 +216,9 @@ public Builder mergeFrom(RouterBgpPeer other) { if (other.getIpAddress() != null) { this.ipAddress = other.ipAddress; } + if (other.getManagementType() != null) { + this.managementType = other.managementType; + } if (other.getName() != null) { this.name = other.name; } @@ -223,6 +238,7 @@ public Builder mergeFrom(RouterBgpPeer other) { this.advertisedRoutePriority = source.advertisedRoutePriority; this.interfaceName = source.interfaceName; this.ipAddress = source.ipAddress; + this.managementType = source.managementType; this.name = source.name; this.peerAsn = source.peerAsn; this.peerIpAddress = source.peerIpAddress; @@ -298,6 +314,15 @@ public Builder setIpAddress(String ipAddress) { return this; } + public String getManagementType() { + return managementType; + } + + public Builder setManagementType(String managementType) { + this.managementType = managementType; + return this; + } + public String getName() { return name; } @@ -334,6 +359,7 @@ public RouterBgpPeer build() { advertisedRoutePriority, interfaceName, ipAddress, + managementType, name, peerAsn, peerIpAddress); @@ -347,6 +373,7 @@ public Builder clone() { newBuilder.setAdvertisedRoutePriority(this.advertisedRoutePriority); newBuilder.setInterfaceName(this.interfaceName); newBuilder.setIpAddress(this.ipAddress); + newBuilder.setManagementType(this.managementType); newBuilder.setName(this.name); newBuilder.setPeerAsn(this.peerAsn); newBuilder.setPeerIpAddress(this.peerIpAddress); @@ -375,6 +402,9 @@ public String toString() { + "ipAddress=" + ipAddress + ", " + + "managementType=" + + managementType + + ", " + "name=" + name + ", " @@ -399,6 +429,7 @@ public boolean equals(Object o) { && Objects.equals(this.advertisedRoutePriority, that.getAdvertisedRoutePriority()) && Objects.equals(this.interfaceName, that.getInterfaceName()) && Objects.equals(this.ipAddress, that.getIpAddress()) + && Objects.equals(this.managementType, that.getManagementType()) && Objects.equals(this.name, that.getName()) && Objects.equals(this.peerAsn, that.getPeerAsn()) && Objects.equals(this.peerIpAddress, that.getPeerIpAddress()); @@ -415,6 +446,7 @@ public int hashCode() { advertisedRoutePriority, interfaceName, ipAddress, + managementType, name, peerAsn, peerIpAddress); diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterInterface.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterInterface.java index 90b406d53037..ca0fde82ec3c 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterInterface.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/RouterInterface.java @@ -28,20 +28,27 @@ public final class RouterInterface implements ApiMessage { private final String ipRange; private final String linkedInterconnectAttachment; private final String linkedVpnTunnel; + private final String managementType; private final String name; private RouterInterface() { this.ipRange = null; this.linkedInterconnectAttachment = null; this.linkedVpnTunnel = null; + this.managementType = null; this.name = null; } private RouterInterface( - String ipRange, String linkedInterconnectAttachment, String linkedVpnTunnel, String name) { + String ipRange, + String linkedInterconnectAttachment, + String linkedVpnTunnel, + String managementType, + String name) { this.ipRange = ipRange; this.linkedInterconnectAttachment = linkedInterconnectAttachment; this.linkedVpnTunnel = linkedVpnTunnel; + this.managementType = managementType; this.name = name; } @@ -56,6 +63,9 @@ public Object getFieldValue(String fieldName) { if (fieldName.equals("linkedVpnTunnel")) { return linkedVpnTunnel; } + if (fieldName.equals("managementType")) { + return managementType; + } if (fieldName.equals("name")) { return name; } @@ -86,6 +96,10 @@ public String getLinkedVpnTunnel() { return linkedVpnTunnel; } + public String getManagementType() { + return managementType; + } + public String getName() { return name; } @@ -116,6 +130,7 @@ public static class Builder { private String ipRange; private String linkedInterconnectAttachment; private String linkedVpnTunnel; + private String managementType; private String name; Builder() {} @@ -131,6 +146,9 @@ public Builder mergeFrom(RouterInterface other) { if (other.getLinkedVpnTunnel() != null) { this.linkedVpnTunnel = other.linkedVpnTunnel; } + if (other.getManagementType() != null) { + this.managementType = other.managementType; + } if (other.getName() != null) { this.name = other.name; } @@ -141,6 +159,7 @@ public Builder mergeFrom(RouterInterface other) { this.ipRange = source.ipRange; this.linkedInterconnectAttachment = source.linkedInterconnectAttachment; this.linkedVpnTunnel = source.linkedVpnTunnel; + this.managementType = source.managementType; this.name = source.name; } @@ -171,6 +190,15 @@ public Builder setLinkedVpnTunnel(String linkedVpnTunnel) { return this; } + public String getManagementType() { + return managementType; + } + + public Builder setManagementType(String managementType) { + this.managementType = managementType; + return this; + } + public String getName() { return name; } @@ -182,7 +210,8 @@ public Builder setName(String name) { public RouterInterface build() { - return new RouterInterface(ipRange, linkedInterconnectAttachment, linkedVpnTunnel, name); + return new RouterInterface( + ipRange, linkedInterconnectAttachment, linkedVpnTunnel, managementType, name); } public Builder clone() { @@ -190,6 +219,7 @@ public Builder clone() { newBuilder.setIpRange(this.ipRange); newBuilder.setLinkedInterconnectAttachment(this.linkedInterconnectAttachment); newBuilder.setLinkedVpnTunnel(this.linkedVpnTunnel); + newBuilder.setManagementType(this.managementType); newBuilder.setName(this.name); return newBuilder; } @@ -207,6 +237,9 @@ public String toString() { + "linkedVpnTunnel=" + linkedVpnTunnel + ", " + + "managementType=" + + managementType + + ", " + "name=" + name + "}"; @@ -223,6 +256,7 @@ public boolean equals(Object o) { && Objects.equals( this.linkedInterconnectAttachment, that.getLinkedInterconnectAttachment()) && Objects.equals(this.linkedVpnTunnel, that.getLinkedVpnTunnel()) + && Objects.equals(this.managementType, that.getManagementType()) && Objects.equals(this.name, that.getName()); } return false; @@ -230,6 +264,7 @@ public boolean equals(Object o) { @Override public int hashCode() { - return Objects.hash(ipRange, linkedInterconnectAttachment, linkedVpnTunnel, name); + return Objects.hash( + ipRange, linkedInterconnectAttachment, linkedVpnTunnel, managementType, name); } } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SourceInstanceParams.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SourceInstanceParams.java new file mode 100644 index 000000000000..e87db68d8d84 --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SourceInstanceParams.java @@ -0,0 +1,151 @@ +/* + * Copyright 2018 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.cloud.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class SourceInstanceParams implements ApiMessage { + private final List diskConfigs; + + private SourceInstanceParams() { + this.diskConfigs = null; + } + + private SourceInstanceParams(List diskConfigs) { + this.diskConfigs = diskConfigs; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("diskConfigs")) { + return diskConfigs; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public List getDiskConfigsList() { + return diskConfigs; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(SourceInstanceParams prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static SourceInstanceParams getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final SourceInstanceParams DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new SourceInstanceParams(); + } + + public static class Builder { + private List diskConfigs; + + Builder() {} + + public Builder mergeFrom(SourceInstanceParams other) { + if (other == SourceInstanceParams.getDefaultInstance()) return this; + if (other.getDiskConfigsList() != null) { + this.diskConfigs = other.diskConfigs; + } + return this; + } + + Builder(SourceInstanceParams source) { + this.diskConfigs = source.diskConfigs; + } + + public List getDiskConfigsList() { + return diskConfigs; + } + + public Builder addAllDiskConfigs(List diskConfigs) { + if (this.diskConfigs == null) { + this.diskConfigs = new ArrayList<>(diskConfigs.size()); + } + this.diskConfigs.addAll(diskConfigs); + return this; + } + + public Builder addDiskConfigs(DiskInstantiationConfig diskConfigs) { + this.diskConfigs.add(diskConfigs); + return this; + } + + public SourceInstanceParams build() { + return new SourceInstanceParams(diskConfigs); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.addAllDiskConfigs(this.diskConfigs); + return newBuilder; + } + } + + @Override + public String toString() { + return "SourceInstanceParams{" + "diskConfigs=" + diskConfigs + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof SourceInstanceParams) { + SourceInstanceParams that = (SourceInstanceParams) o; + return Objects.equals(this.diskConfigs, that.getDiskConfigsList()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(diskConfigs); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxiesSetQuicOverrideRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxiesSetQuicOverrideRequest.java new file mode 100644 index 000000000000..edec3ea4a7dc --- /dev/null +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxiesSetQuicOverrideRequest.java @@ -0,0 +1,142 @@ +/* + * Copyright 2018 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.cloud.compute.v1; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.ApiMessage; +import java.util.List; +import java.util.Objects; +import javax.annotation.Generated; +import javax.annotation.Nullable; + +@Generated("by GAPIC") +@BetaApi +public final class TargetHttpsProxiesSetQuicOverrideRequest implements ApiMessage { + private final String quicOverride; + + private TargetHttpsProxiesSetQuicOverrideRequest() { + this.quicOverride = null; + } + + private TargetHttpsProxiesSetQuicOverrideRequest(String quicOverride) { + this.quicOverride = quicOverride; + } + + @Override + public Object getFieldValue(String fieldName) { + if (fieldName.equals("quicOverride")) { + return quicOverride; + } + return null; + } + + @Nullable + @Override + public ApiMessage getApiMessageRequestBody() { + return null; + } + + @Nullable + @Override + public List getFieldMask() { + return null; + } + + public String getQuicOverride() { + return quicOverride; + } + + public static Builder newBuilder() { + return DEFAULT_INSTANCE.toBuilder(); + } + + public static Builder newBuilder(TargetHttpsProxiesSetQuicOverrideRequest prototype) { + return DEFAULT_INSTANCE.toBuilder().mergeFrom(prototype); + } + + public Builder toBuilder() { + return this == DEFAULT_INSTANCE ? new Builder() : new Builder().mergeFrom(this); + } + + public static TargetHttpsProxiesSetQuicOverrideRequest getDefaultInstance() { + return DEFAULT_INSTANCE; + } + + private static final TargetHttpsProxiesSetQuicOverrideRequest DEFAULT_INSTANCE; + + static { + DEFAULT_INSTANCE = new TargetHttpsProxiesSetQuicOverrideRequest(); + } + + public static class Builder { + private String quicOverride; + + Builder() {} + + public Builder mergeFrom(TargetHttpsProxiesSetQuicOverrideRequest other) { + if (other == TargetHttpsProxiesSetQuicOverrideRequest.getDefaultInstance()) return this; + if (other.getQuicOverride() != null) { + this.quicOverride = other.quicOverride; + } + return this; + } + + Builder(TargetHttpsProxiesSetQuicOverrideRequest source) { + this.quicOverride = source.quicOverride; + } + + public String getQuicOverride() { + return quicOverride; + } + + public Builder setQuicOverride(String quicOverride) { + this.quicOverride = quicOverride; + return this; + } + + public TargetHttpsProxiesSetQuicOverrideRequest build() { + return new TargetHttpsProxiesSetQuicOverrideRequest(quicOverride); + } + + public Builder clone() { + Builder newBuilder = new Builder(); + newBuilder.setQuicOverride(this.quicOverride); + return newBuilder; + } + } + + @Override + public String toString() { + return "TargetHttpsProxiesSetQuicOverrideRequest{" + "quicOverride=" + quicOverride + "}"; + } + + @Override + public boolean equals(Object o) { + if (o == this) { + return true; + } + if (o instanceof TargetHttpsProxiesSetQuicOverrideRequest) { + TargetHttpsProxiesSetQuicOverrideRequest that = (TargetHttpsProxiesSetQuicOverrideRequest) o; + return Objects.equals(this.quicOverride, that.getQuicOverride()); + } + return false; + } + + @Override + public int hashCode() { + return Objects.hash(quicOverride); + } +} diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxy.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxy.java index 357612eca81f..0c8c4cfd1535 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxy.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/TargetHttpsProxy.java @@ -31,6 +31,7 @@ public final class TargetHttpsProxy implements ApiMessage { private final String id; private final String kind; private final String name; + private final String quicOverride; private final String selfLink; private final List sslCertificates; private final String sslPolicy; @@ -42,6 +43,7 @@ private TargetHttpsProxy() { this.id = null; this.kind = null; this.name = null; + this.quicOverride = null; this.selfLink = null; this.sslCertificates = null; this.sslPolicy = null; @@ -54,6 +56,7 @@ private TargetHttpsProxy( String id, String kind, String name, + String quicOverride, String selfLink, List sslCertificates, String sslPolicy, @@ -63,6 +66,7 @@ private TargetHttpsProxy( this.id = id; this.kind = kind; this.name = name; + this.quicOverride = quicOverride; this.selfLink = selfLink; this.sslCertificates = sslCertificates; this.sslPolicy = sslPolicy; @@ -86,6 +90,9 @@ public Object getFieldValue(String fieldName) { if (fieldName.equals("name")) { return name; } + if (fieldName.equals("quicOverride")) { + return quicOverride; + } if (fieldName.equals("selfLink")) { return selfLink; } @@ -133,6 +140,10 @@ public String getName() { return name; } + public String getQuicOverride() { + return quicOverride; + } + public String getSelfLink() { return selfLink; } @@ -177,6 +188,7 @@ public static class Builder { private String id; private String kind; private String name; + private String quicOverride; private String selfLink; private List sslCertificates; private String sslPolicy; @@ -201,6 +213,9 @@ public Builder mergeFrom(TargetHttpsProxy other) { if (other.getName() != null) { this.name = other.name; } + if (other.getQuicOverride() != null) { + this.quicOverride = other.quicOverride; + } if (other.getSelfLink() != null) { this.selfLink = other.selfLink; } @@ -222,6 +237,7 @@ public Builder mergeFrom(TargetHttpsProxy other) { this.id = source.id; this.kind = source.kind; this.name = source.name; + this.quicOverride = source.quicOverride; this.selfLink = source.selfLink; this.sslCertificates = source.sslCertificates; this.sslPolicy = source.sslPolicy; @@ -273,6 +289,15 @@ public Builder setName(String name) { return this; } + public String getQuicOverride() { + return quicOverride; + } + + public Builder setQuicOverride(String quicOverride) { + this.quicOverride = quicOverride; + return this; + } + public String getSelfLink() { return selfLink; } @@ -325,6 +350,7 @@ public TargetHttpsProxy build() { id, kind, name, + quicOverride, selfLink, sslCertificates, sslPolicy, @@ -338,6 +364,7 @@ public Builder clone() { newBuilder.setId(this.id); newBuilder.setKind(this.kind); newBuilder.setName(this.name); + newBuilder.setQuicOverride(this.quicOverride); newBuilder.setSelfLink(this.selfLink); newBuilder.addAllSslCertificates(this.sslCertificates); newBuilder.setSslPolicy(this.sslPolicy); @@ -364,6 +391,9 @@ public String toString() { + "name=" + name + ", " + + "quicOverride=" + + quicOverride + + ", " + "selfLink=" + selfLink + ", " @@ -390,6 +420,7 @@ public boolean equals(Object o) { && Objects.equals(this.id, that.getId()) && Objects.equals(this.kind, that.getKind()) && Objects.equals(this.name, that.getName()) + && Objects.equals(this.quicOverride, that.getQuicOverride()) && Objects.equals(this.selfLink, that.getSelfLink()) && Objects.equals(this.sslCertificates, that.getSslCertificatesList()) && Objects.equals(this.sslPolicy, that.getSslPolicy()) @@ -406,6 +437,7 @@ public int hashCode() { id, kind, name, + quicOverride, selfLink, sslCertificates, sslPolicy, diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateAutoscalerHttpRequest.java index 8f44596273da..5b9d630e4e34 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateAutoscalerHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateAutoscalerHttpRequest.java @@ -382,6 +382,10 @@ public Builder setZone(String zone) { public UpdateAutoscalerHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (zone == null) { missing += " zone"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendBucketHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendBucketHttpRequest.java index 4c40aef2a060..c0cee31a50ac 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendBucketHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendBucketHttpRequest.java @@ -361,6 +361,10 @@ public UpdateBackendBucketHttpRequest build() { missing += " backendBucket"; } + if (fieldMask == null) { + missing += " fieldMask"; + } + if (!missing.isEmpty()) { throw new IllegalStateException("Missing required properties:" + missing); } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendServiceHttpRequest.java index c2db0a34accb..5c00fccb88cb 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendServiceHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateBackendServiceHttpRequest.java @@ -361,6 +361,10 @@ public UpdateBackendServiceHttpRequest build() { missing += " backendService"; } + if (fieldMask == null) { + missing += " fieldMask"; + } + if (!missing.isEmpty()) { throw new IllegalStateException("Missing required properties:" + missing); } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateFirewallHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateFirewallHttpRequest.java index bc40d74b3fdc..63c09d901e3b 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateFirewallHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateFirewallHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public UpdateFirewallHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (firewall == null) { missing += " firewall"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHealthCheckHttpRequest.java index dd475e3ce0f8..22e8bea3a2a5 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHealthCheckHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHealthCheckHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public UpdateHealthCheckHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (healthCheck == null) { missing += " healthCheck"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpHealthCheckHttpRequest.java index 268b31281559..e1e1df2fb61e 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpHealthCheckHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpHealthCheckHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public UpdateHttpHealthCheckHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (httpHealthCheck == null) { missing += " httpHealthCheck"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpsHealthCheckHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpsHealthCheckHttpRequest.java index 4e1efc4c27ba..702cfb5a90d3 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpsHealthCheckHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateHttpsHealthCheckHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public UpdateHttpsHealthCheckHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (httpsHealthCheck == null) { missing += " httpsHealthCheck"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateNetworkInterfaceInstanceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateNetworkInterfaceInstanceHttpRequest.java index 4d23d4d321e7..b7fad177a1ba 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateNetworkInterfaceInstanceHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateNetworkInterfaceInstanceHttpRequest.java @@ -382,6 +382,10 @@ public Builder setUserIp(String userIp) { public UpdateNetworkInterfaceInstanceHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (instance == null) { missing += " instance"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionAutoscalerHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionAutoscalerHttpRequest.java index fe33e4ccc64d..7c0d9a51d52e 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionAutoscalerHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionAutoscalerHttpRequest.java @@ -382,6 +382,10 @@ public Builder setUserIp(String userIp) { public UpdateRegionAutoscalerHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (region == null) { missing += " region"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionBackendServiceHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionBackendServiceHttpRequest.java index 50ff784603bb..6000d01459e0 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionBackendServiceHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRegionBackendServiceHttpRequest.java @@ -361,6 +361,10 @@ public UpdateRegionBackendServiceHttpRequest build() { missing += " backendService"; } + if (fieldMask == null) { + missing += " fieldMask"; + } + if (!missing.isEmpty()) { throw new IllegalStateException("Missing required properties:" + missing); } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRouterHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRouterHttpRequest.java index 33353765119e..8cf030fd2a5d 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRouterHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateRouterHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public UpdateRouterHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (router == null) { missing += " router"; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateUrlMapHttpRequest.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateUrlMapHttpRequest.java index d10954b5d792..6109295b33a9 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateUrlMapHttpRequest.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/UpdateUrlMapHttpRequest.java @@ -357,6 +357,10 @@ public Builder setUserIp(String userIp) { public UpdateUrlMapHttpRequest build() { String missing = ""; + if (fieldMask == null) { + missing += " fieldMask"; + } + if (urlMap == null) { missing += " urlMap"; } diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AutoscalerClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AutoscalerClientTest.java index f1d69cadbd2a..174e80c2dc3b 100644 --- a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AutoscalerClientTest.java +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/AutoscalerClientTest.java @@ -39,6 +39,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; import java.io.IOException; +import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.List; @@ -638,6 +639,7 @@ public void updateAutoscalerExceptionTest() throws Exception { String autoscaler = "autoscaler517258967"; ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); Autoscaler autoscalerResource = Autoscaler.newBuilder().build(); + List fieldMask = new ArrayList(); client.updateAutoscaler(autoscaler, zone, autoscalerResource); Assert.fail("No exception raised"); diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceTemplateClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceTemplateClientTest.java index 527b6564efea..768ceb763ea4 100644 --- a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceTemplateClientTest.java +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InstanceTemplateClientTest.java @@ -175,6 +175,7 @@ public void deleteInstanceTemplateExceptionTest() throws Exception { @Test @SuppressWarnings("all") public void getInstanceTemplateTest() { + String sourceInstance = "sourceInstance-677426119"; String kind = "kind3292052"; String creationTimestamp = "creationTimestamp567396278"; String name = "name3373707"; @@ -183,6 +184,7 @@ public void getInstanceTemplateTest() { String selfLink = "selfLink-1691268851"; InstanceTemplate expectedResponse = InstanceTemplate.newBuilder() + .setSourceInstance(sourceInstance) .setKind(kind) .setCreationTimestamp(creationTimestamp) .setName(name) diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectAttachmentClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectAttachmentClientTest.java index 7bcea70c5530..a846885c405b 100644 --- a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectAttachmentClientTest.java +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectAttachmentClientTest.java @@ -250,33 +250,49 @@ public void deleteInterconnectAttachmentExceptionTest() throws Exception { public void getInterconnectAttachmentTest() { String cloudRouterIpAddress = "cloudRouterIpAddress1361134600"; String operationalStatus = "operationalStatus1274812671"; + String edgeAvailabilityDomain = "edgeAvailabilityDomain-1539323226"; + Integer vlanTag8021q = 1730540572; + String bandwidth = "bandwidth-1965768527"; String kind = "kind3292052"; String googleReferenceId = "googleReferenceId534944469"; String description = "description-1724546052"; + String pairingKey = "pairingKey976566376"; + String type = "type3575610"; ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]"); String customerRouterIpAddress = "customerRouterIpAddress-741266063"; String selfLink = "selfLink-1691268851"; ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]"); + String partnerAsn = "partnerAsn975037061"; + Boolean adminEnabled = false; String creationTimestamp = "creationTimestamp567396278"; String name = "name3373707"; String id = "id3355"; + String state = "state109757585"; ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]"); InterconnectAttachment expectedResponse = InterconnectAttachment.newBuilder() .setCloudRouterIpAddress(cloudRouterIpAddress) .setOperationalStatus(operationalStatus) + .setEdgeAvailabilityDomain(edgeAvailabilityDomain) + .setVlanTag8021q(vlanTag8021q) + .setBandwidth(bandwidth) .setKind(kind) .setGoogleReferenceId(googleReferenceId) .setDescription(description) + .setPairingKey(pairingKey) + .setType(type) .setInterconnect(interconnect.toString()) .setCustomerRouterIpAddress(customerRouterIpAddress) .setSelfLink(selfLink) .setRouter(router.toString()) + .setPartnerAsn(partnerAsn) + .setAdminEnabled(adminEnabled) .setCreationTimestamp(creationTimestamp) .setName(name) .setId(id) + .setState(state) .setRegion(region.toString()) .build(); mockService.addResponse(expectedResponse); diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectClientTest.java index d674a8ca33f8..d5b6502963f5 100644 --- a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectClientTest.java +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/InterconnectClientTest.java @@ -193,6 +193,7 @@ public void getInterconnectTest() { String location = "location1901043637"; Integer provisionedLinkCount = 1199724171; String id = "id3355"; + String state = "state109757585"; String googleIpAddress = "googleIpAddress1516847778"; String nocContactEmail = "nocContactEmail1087814656"; Interconnect expectedResponse = @@ -213,6 +214,7 @@ public void getInterconnectTest() { .setLocation(location) .setProvisionedLinkCount(provisionedLinkCount) .setId(id) + .setState(state) .setGoogleIpAddress(googleIpAddress) .setNocContactEmail(nocContactEmail) .build(); diff --git a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetHttpsProxyClientTest.java b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetHttpsProxyClientTest.java index bd147fecbe76..27d57ca2abc8 100644 --- a/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetHttpsProxyClientTest.java +++ b/google-cloud-clients/google-cloud-compute/src/test/java/com/google/cloud/compute/v1/TargetHttpsProxyClientTest.java @@ -189,6 +189,7 @@ public void getTargetHttpsProxyTest() { String name = "name3373707"; String description = "description-1724546052"; String id = "id3355"; + String quicOverride = "quicOverride2067189933"; String selfLink = "selfLink-1691268851"; TargetHttpsProxy expectedResponse = TargetHttpsProxy.newBuilder() @@ -199,6 +200,7 @@ public void getTargetHttpsProxyTest() { .setName(name) .setDescription(description) .setId(id) + .setQuicOverride(quicOverride) .setSelfLink(selfLink) .build(); mockService.addResponse(expectedResponse); From ba43efa8caf073bd3fba3f88ba419e3eff261072 Mon Sep 17 00:00:00 2001 From: Andrea Lin Date: Tue, 10 Jul 2018 12:45:38 -0700 Subject: [PATCH 8/9] updated README.md with examples --- .../google-cloud-compute/README.md | 135 +++++++----------- 1 file changed, 51 insertions(+), 84 deletions(-) diff --git a/google-cloud-clients/google-cloud-compute/README.md b/google-cloud-clients/google-cloud-compute/README.md index 974e22b6c48f..05f1dabb5af6 100644 --- a/google-cloud-clients/google-cloud-compute/README.md +++ b/google-cloud-clients/google-cloud-compute/README.md @@ -88,10 +88,24 @@ These credentials are automatically inferred from your environment, so you only code to create your service object: ```java -import com.google.cloud.compute.deprecated.Compute; -import com.google.cloud.compute.deprecated.ComputeOptions; - -Compute compute = ComputeOptions.getDefaultInstance().getService(); +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.auth.Credentials; +import com.google.auth.oauth2.GoogleCredentials; +import com.google.cloud.compute.v1.AddressClient; +import com.google.cloud.compute.v1.AddressSettings; + +Credentials myCredentials = GoogleCredentials.getApplicationDefault(); + String myEndpoint = AddressSettings.getDefaultEndpoint(); + + AddressSettings addressSettings = + AddressSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .setTransportChannelProvider( + AddressSettings.defaultHttpJsonTransportProviderBuilder() + .setEndpoint(myEndpoint) + .build()) + .build(); + return AddressClient.create(addressSettings); ``` For other authentication options, see the [Authentication](https://github.com/GoogleCloudPlatform/google-cloud-java#authentication) @@ -105,9 +119,9 @@ Engine. In this code snippet, we will create a new external region address. Add the following imports at the top of your file: ```java -import com.google.cloud.compute.deprecated.AddressInfo; -import com.google.cloud.compute.deprecated.Operation; -import com.google.cloud.compute.deprecated.RegionAddressId; +import com.google.cloud.compute.v1.InsertAddressHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectRegionAddressName; ``` Then add the following code to create an address. Most Compute Engine calls return an `Operation` @@ -115,14 +129,19 @@ object that can be used to wait for operation completion and to check whether op succeeded: ```java -RegionAddressId addressId = RegionAddressId.of("us-central1", "test-address"); -Operation operation = compute.create(AddressInfo.of(addressId)); -// Wait for operation to complete -operation = operation.waitFor(); -if (operation.getErrors() == null) { +ProjectRegionName region = ProjectRegionName.of(PROJECT_NAME, REGION); +Address address = Address.newBuilder().build(); +InsertAddressHttpRequest request = + InsertAddressHttpRequest.newBuilder() + .setRegion(region.toString()) + .setAddressResource(address) + .build(); + +Operation response = client.insertAddress(request); +if (operation.getError() == null) { System.out.println("Address " + addressId + " was successfully created"); } else { - // inspect operation.getErrors() + // inspect operation.getError() throw new RuntimeException("Address creation failed"); } ``` @@ -137,94 +156,42 @@ a publicly-available image. Add the following imports at the top of your file: ```java -import com.google.cloud.compute.deprecated.DiskInfo; -import com.google.cloud.compute.deprecated.DiskId; -import com.google.cloud.compute.deprecated.ImageDiskConfiguration; -import com.google.cloud.compute.deprecated.ImageId; +import com.google.api.core.ApiFuture; +import com.google.cloud.compute.v1.Disk; +import com.google.cloud.compute.v1.DiskClient; +import com.google.cloud.compute.v1.InsertDiskHttpRequest; +import com.google.cloud.compute.v1.Operation; +import com.google.cloud.compute.v1.ProjectZoneName; ``` Then add the following code to create a disk and wait for disk creation to terminate. ```java -ImageId imageId = ImageId.of("debian-cloud", "debian-8-jessie-v20160329"); -DiskId diskId = DiskId.of("us-central1-a", "test-disk"); -ImageDiskConfiguration diskConfiguration = ImageDiskConfiguration.of(imageId); -DiskInfo disk = DiskInfo.of(diskId, diskConfiguration); -Operation operation = compute.create(disk); -// Wait for operation to complete -operation = operation.waitFor(); -if (operation.getErrors() == null) { - System.out.println("Disk " + diskId + " was successfully created"); -} else { - // inspect operation.getErrors() +ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]"); +Disk diskResource = Disk.newBuilder().build(); +InsertDiskHttpRequest request = InsertDiskHttpRequest.newBuilder() + .setZone(zone.toString()) + .setDiskResource(diskResource) + .build(); +ApiFuture future = client.insertDiskCallable().futureCall(request); +Operation response; +try { + response = future.get(); +} catch (InterruptedException | ExecutionException e) { + // inspect operation.getError() throw new RuntimeException("Disk creation failed"); } ``` -#### Creating a virtual machine instance -A Google Compute Engine instance is a virtual machine (VM) hosted on Google's infrastructure. An -instance can be created given its identity, a machine type, one boot disk and a network interface. -In this code snippet, we will create a virtual machine instance in the default network using as a -boot disk the disk we have just created and assigning to it the just created IP address. - -Add the following imports at the top of your file: - -```java -import com.google.cloud.compute.deprecated.AttachedDisk; -import com.google.cloud.compute.deprecated.AttachedDisk.PersistentDiskConfiguration; -import com.google.cloud.compute.deprecated.InstanceId; -import com.google.cloud.compute.deprecated.InstanceInfo; -import com.google.cloud.compute.deprecated.MachineTypeId; -import com.google.cloud.compute.deprecated.NetworkConfiguration; -import com.google.cloud.compute.deprecated.NetworkConfiguration.AccessConfig; -import com.google.cloud.compute.deprecated.NetworkId; -import com.google.cloud.compute.deprecated.NetworkInterface; -``` - -Then add the following code to create an instance and wait for instance creation to terminate. - -```java -Address externalIp = compute.getAddress(addressId); -InstanceId instanceId = InstanceId.of("us-central1-a", "test-instance"); -NetworkId networkId = NetworkId.of("default"); -PersistentDiskConfiguration attachConfiguration = - PersistentDiskConfiguration.newBuilder(diskId).setBoot(true).build(); -AttachedDisk attachedDisk = AttachedDisk.of("dev0", attachConfiguration); -NetworkInterface networkInterface = NetworkInterface.newBuilder(networkId) - .setAccessConfigurations(AccessConfig.of(externalIp.getAddress())) - .build(); -MachineTypeId machineTypeId = MachineTypeId.of("us-central1-a", "n1-standard-1"); -InstanceInfo instance = - InstanceInfo.of(instanceId, machineTypeId, attachedDisk, networkInterface); -Operation operation = compute.create(instance); -// Wait for operation to complete -operation = operation.waitFor(); -if (operation.getErrors() == null) { - System.out.println("Instance " + instanceId + " was successfully created"); -} else { - // inspect operation.getErrors() - throw new RuntimeException("Instance creation failed"); -} -``` - #### Complete source code In -[CreateAddressDiskAndInstance.java](../../google-cloud-examples/src/main/java/com/google/cloud/examples/compute/snippets/CreateAddressDiskAndInstance.java) +[ComputeExample.java](../../google-cloud-examples/src/main/java/com/google/cloud/examples/compute/v1/ComputeExample.java) we put together all the code shown above into one program. The program assumes that you are running on Compute Engine or from your own desktop. To run the example on App Engine, simply move the code from the main method to your application's servlet class and change the print statements to display on your webpage. -#### Other examples - -Other examples are available too: - -- [CreateSnapshot.java](../../google-cloud-examples/src/main/java/com/google/cloud/examples/compute/snippets/CreateSnapshot.java) shows -how to create a snapshot from an existing disk -- [CreateInstance.java](../../google-cloud-examples/src/main/java/com/google/cloud/examples/compute/snippets/CreateInstance.java) shows -how to create a virtual machine instance (shorter sample than the one above) - Troubleshooting --------------- From 167fc3d5ff949302e0c71a21e4d0a3c7a6291efa Mon Sep 17 00:00:00 2001 From: Andrea Lin Date: Tue, 10 Jul 2018 12:56:07 -0700 Subject: [PATCH 9/9] merge maste --- .../google/cloud/compute/v1/InterconnectAttachment.java | 7 +++++-- .../com/google/cloud/compute/v1/SourceInstanceParams.java | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachment.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachment.java index c51cdee5dfd2..1845856c7041 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachment.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/InterconnectAttachment.java @@ -17,7 +17,7 @@ import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.ApiMessage; -import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import java.util.Objects; import javax.annotation.Generated; @@ -492,13 +492,16 @@ public List getCandidateSubnetsList() { public Builder addAllCandidateSubnets(List candidateSubnets) { if (this.candidateSubnets == null) { - this.candidateSubnets = new ArrayList<>(candidateSubnets.size()); + this.candidateSubnets = new LinkedList<>(); } this.candidateSubnets.addAll(candidateSubnets); return this; } public Builder addCandidateSubnets(String candidateSubnets) { + if (this.candidateSubnets == null) { + this.candidateSubnets = new LinkedList<>(); + } this.candidateSubnets.add(candidateSubnets); return this; } diff --git a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SourceInstanceParams.java b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SourceInstanceParams.java index e87db68d8d84..519563f6da5a 100644 --- a/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SourceInstanceParams.java +++ b/google-cloud-clients/google-cloud-compute/src/main/java/com/google/cloud/compute/v1/SourceInstanceParams.java @@ -17,7 +17,7 @@ import com.google.api.core.BetaApi; import com.google.api.gax.httpjson.ApiMessage; -import java.util.ArrayList; +import java.util.LinkedList; import java.util.List; import java.util.Objects; import javax.annotation.Generated; @@ -105,13 +105,16 @@ public List getDiskConfigsList() { public Builder addAllDiskConfigs(List diskConfigs) { if (this.diskConfigs == null) { - this.diskConfigs = new ArrayList<>(diskConfigs.size()); + this.diskConfigs = new LinkedList<>(); } this.diskConfigs.addAll(diskConfigs); return this; } public Builder addDiskConfigs(DiskInstantiationConfig diskConfigs) { + if (this.diskConfigs == null) { + this.diskConfigs = new LinkedList<>(); + } this.diskConfigs.add(diskConfigs); return this; }