diff --git a/gameservices/v1alpha/pom.xml b/gameservices/v1alpha/pom.xml
deleted file mode 100644
index c4a7b82a24f..00000000000
--- a/gameservices/v1alpha/pom.xml
+++ /dev/null
@@ -1,59 +0,0 @@
-
-
-
- 4.0.0
- com.google.gameservices.snippets
- gameservices
- jar
- 1.0
- gameservices
-
-
-
- com.google.cloud.samples
- shared-configuration
- 1.0.11
-
-
-
- 1.8
- 1.8
-
-
-
-
- com.google.cloud
- google-cloud-gameservices
- 0.1.0
-
-
-
-
- junit
- junit
- 4.13
- test
-
-
- com.google.truth
- truth
- 0.46
- test
-
-
-
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/CreateAllocationPolicy.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/CreateAllocationPolicy.java
deleted file mode 100644
index fcb892a003b..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/CreateAllocationPolicy.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.allocationpolicies;
-
-// [START cloud_game_servers_allocation_policy_create]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.AllocationPoliciesServiceClient;
-import com.google.cloud.gaming.v1alpha.AllocationPolicy;
-import com.google.cloud.gaming.v1alpha.CreateAllocationPolicyRequest;
-import com.google.protobuf.Empty;
-import com.google.protobuf.Int32Value;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class CreateAllocationPolicy {
- public static void createAllocationPolicy(String projectId, String policyId) {
- // String projectId = "your-project-id";
- // String policyId = "your-policy-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (AllocationPoliciesServiceClient client = AllocationPoliciesServiceClient.create()) {
- String parent = String.format("projects/%s/locations/global", projectId);
- String policyName = String.format("%s/allocationPolicies/%s", parent, policyId);
-
- AllocationPolicy policy = AllocationPolicy
- .newBuilder()
- .setName(policyName)
- .setPriority(Int32Value.newBuilder().setValue(1))
- .build();
-
- CreateAllocationPolicyRequest request = CreateAllocationPolicyRequest
- .newBuilder()
- .setParent(parent)
- .setAllocationPolicyId(policyId)
- .setAllocationPolicy(policy)
- .build();
-
- OperationFuture call = client.createAllocationPolicyAsync(request);
-
- AllocationPolicy result = call.get(1, TimeUnit.MINUTES);
- System.out.println("Allocation Policy created: " + result.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Allocation Policy create request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_allocation_policy_create]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/DeleteAllocationPolicy.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/DeleteAllocationPolicy.java
deleted file mode 100644
index bb92f8e2c88..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/DeleteAllocationPolicy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.allocationpolicies;
-
-// [START cloud_game_servers_allocation_policy_delete]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.AllocationPoliciesServiceClient;
-import com.google.protobuf.Empty;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class DeleteAllocationPolicy {
-
- public static void deleteAllocationPolicy(String projectId, String policyId) {
- // String projectId = "your-project-id";
- // String policyId = "your-policy-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (AllocationPoliciesServiceClient client = AllocationPoliciesServiceClient.create()) {
- String parent = String.format("projects/%s/locations/global", projectId);
- String policyName = String.format("%s/allocationPolicies/%s", parent, policyId);
-
- OperationFuture call = client.deleteAllocationPolicyAsync(policyName);
-
- call.get(1, TimeUnit.MINUTES);
- System.out.println("Allocation Policy deleted: " + policyName);
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Allocation Policy delete request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_allocation_policy_delete]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/GetAllocationPolicy.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/GetAllocationPolicy.java
deleted file mode 100644
index 196df80493b..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/GetAllocationPolicy.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.allocationpolicies;
-
-// [START cloud_game_servers_allocation_policy_get]
-
-import com.google.cloud.gaming.v1alpha.AllocationPoliciesServiceClient;
-import com.google.cloud.gaming.v1alpha.AllocationPolicy;
-
-import java.io.IOException;
-
-public class GetAllocationPolicy {
- public static void getAllocationPolicy(String projectId, String policyId) {
- // String projectId = "your-project-id";
- // String policyId = "your-policy-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (AllocationPoliciesServiceClient client = AllocationPoliciesServiceClient.create()) {
- String policyName = String.format(
- "projects/%s/locations/global/allocationPolicies/%s", projectId, policyId);
-
- AllocationPolicy allocationPolicy = client.getAllocationPolicy(policyName);
-
- System.out.println("Allocation Policy found: " + allocationPolicy.getName());
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_allocation_policy_get]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/ListAllocationPolicies.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/ListAllocationPolicies.java
deleted file mode 100644
index 14b4c0b04a7..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/ListAllocationPolicies.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.allocationpolicies;
-
-// [START cloud_game_servers_allocation_policy_list]
-
-import com.google.cloud.gaming.v1alpha.AllocationPoliciesServiceClient;
-import com.google.cloud.gaming.v1alpha.AllocationPoliciesServiceClient.ListAllocationPoliciesPagedResponse;
-import com.google.cloud.gaming.v1alpha.AllocationPolicy;
-import com.google.cloud.gaming.v1alpha.ListAllocationPoliciesRequest;
-import com.google.common.base.Strings;
-
-import java.io.IOException;
-
-public class ListAllocationPolicies {
- public static void listAllocationPolicies(String projectId) {
- // String projectId = "your-project-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (AllocationPoliciesServiceClient client = AllocationPoliciesServiceClient.create()) {
- String parent = String.format("projects/%s/locations/global", projectId);
-
- ListAllocationPoliciesPagedResponse response = client.listAllocationPolicies(parent);
- for (AllocationPolicy policy : response.iterateAll()) {
- System.out.println("Allocation Policy found: " + policy.getName());
- }
-
- while (!Strings.isNullOrEmpty(response.getNextPageToken())) {
- ListAllocationPoliciesRequest request = ListAllocationPoliciesRequest
- .newBuilder()
- .setParent(parent)
- .setPageToken(response.getNextPageToken())
- .build();
- response = client.listAllocationPolicies(request);
- for (AllocationPolicy policy : response.iterateAll()) {
- System.out.println("Allocation Policy found: " + policy.getName());
- }
- }
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_allocation_policy_list]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/UpdateAllocationPolicy.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/UpdateAllocationPolicy.java
deleted file mode 100644
index c326b5b4a33..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/allocationpolicies/UpdateAllocationPolicy.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.allocationpolicies;
-
-// [START cloud_game_servers_allocation_policy_update]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.AllocationPoliciesServiceClient;
-import com.google.cloud.gaming.v1alpha.AllocationPolicy;
-import com.google.protobuf.Empty;
-import com.google.protobuf.FieldMask;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class UpdateAllocationPolicy {
- public static void updateAllocationPolicy(String projectId, String policyId) {
- // String projectId = "your-project-id";
- // String policyId = "your-policy-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (AllocationPoliciesServiceClient client = AllocationPoliciesServiceClient.create()) {
- String policyName = String.format(
- "projects/%s/locations/global/allocationPolicies/%s", projectId, policyId);
-
- AllocationPolicy policy = client
- .getAllocationPolicy(policyName)
- .toBuilder()
- .setWeight(5)
- .build();
-
- FieldMask fieldMask = FieldMask.newBuilder().addPaths("weight").build();
-
- OperationFuture call = client.updateAllocationPolicyAsync(
- policy, fieldMask);
-
- AllocationPolicy updated = call.get(1, TimeUnit.MINUTES);
- System.out.println("Allocation Policy updated: " + updated.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Allocation Policy update request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_allocation_policy_update]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/CreateCluster.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/CreateCluster.java
deleted file mode 100644
index 6d569d14e0b..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/CreateCluster.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.clusters;
-
-// [START cloud_game_servers_cluster_create]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.CreateGameServerClusterRequest;
-import com.google.cloud.gaming.v1alpha.GameServerCluster;
-import com.google.cloud.gaming.v1alpha.GameServerClusterConnectionInfo;
-import com.google.cloud.gaming.v1alpha.GameServerClustersServiceClient;
-import com.google.protobuf.Empty;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class CreateCluster {
-
- public static void createGameServerCluster(
- String projectId, String regionId, String realmId, String clusterId, String gkeName) {
- // String projectId = "your-project-id";
- // String regionId = "us-central1-f";
- // String realmId = "your-realm-id";
- // String clusterId = "your-game-server-cluster-id";
- // String gkeName = "projects/your-project-id/locations/us-central1/clusters/test";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerClustersServiceClient client = GameServerClustersServiceClient.create()) {
- String parent = String.format(
- "projects/%s/locations/%s/realms/%s", projectId, regionId, realmId);
- String clusterName = String.format("%s/gameServerClusters/%s", parent, clusterId);
-
- GameServerCluster gameServerCluster = GameServerCluster
- .newBuilder()
- .setName(clusterName)
- .setConnectionInfo(GameServerClusterConnectionInfo
- .newBuilder()
- .setGkeName(gkeName)
- .setNamespace("default"))
- .build();
-
- CreateGameServerClusterRequest request = CreateGameServerClusterRequest
- .newBuilder()
- .setParent(parent)
- .setGameServerClusterId(clusterId)
- .setGameServerCluster(gameServerCluster)
- .build();
-
- OperationFuture call = client.createGameServerClusterAsync(request);
-
- GameServerCluster created = call.get(1, TimeUnit.MINUTES);
- System.out.println("Game Server Cluster created: " + created.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Game Server Cluster create request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_cluster_create]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/DeleteCluster.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/DeleteCluster.java
deleted file mode 100644
index aa6631896cd..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/DeleteCluster.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.clusters;
-
-// [START cloud_game_servers_cluster_delete]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.GameServerClustersServiceClient;
-import com.google.protobuf.Empty;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class DeleteCluster {
-
- public static void deleteGameServerCluster(
- String projectId, String regionId, String realmId, String clusterId) {
- // String projectId = "your-project-id";
- // String regionId = "us-central1-f";
- // String clusterId = "your-game-server-cluster-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerClustersServiceClient client = GameServerClustersServiceClient.create()) {
- String parent = String.format(
- "projects/%s/locations/%s/realms/%s", projectId, regionId, realmId);
- String clusterName = String.format("%s/gameServerClusters/%s", parent, clusterId);
-
- OperationFuture call = client.deleteGameServerClusterAsync(clusterName);
-
- call.get(1, TimeUnit.MINUTES);
- System.out.println("Game Server Cluster deleted: " + clusterName);
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Game Server Cluster delete request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_cluster_delete]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/GetCluster.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/GetCluster.java
deleted file mode 100644
index 528b931c498..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/GetCluster.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.clusters;
-
-// [START cloud_game_servers_cluster_get]
-
-import com.google.cloud.gaming.v1alpha.GameServerCluster;
-import com.google.cloud.gaming.v1alpha.GameServerClustersServiceClient;
-
-import java.io.IOException;
-
-public class GetCluster {
-
- public static void getGameServerCluster(
- String projectId, String regionId, String realmId, String clusterId) {
- // String projectId = "your-project-id";
- // String regionId = "us-central1-f";
- // String realmId = "your-realm-id";
- // String clusterId = "your-game-server-cluster-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerClustersServiceClient client = GameServerClustersServiceClient.create()) {
- String parent = String.format(
- "projects/%s/locations/%s/realms/%s", projectId, regionId, realmId);
- String clusterName = String.format("%s/gameServerClusters/%s", parent, clusterId);
-
- GameServerCluster cluster = client.getGameServerCluster(clusterName);
-
- System.out.println("Game Server Cluster found: " + cluster.getName());
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_cluster_get]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/ListClusters.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/ListClusters.java
deleted file mode 100644
index 1b778f39c2d..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/ListClusters.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.clusters;
-
-// [START cloud_game_servers_cluster_list]
-
-import com.google.cloud.gaming.v1alpha.GameServerCluster;
-import com.google.cloud.gaming.v1alpha.GameServerClustersServiceClient;
-import com.google.cloud.gaming.v1alpha.GameServerClustersServiceClient.ListGameServerClustersPagedResponse;
-import com.google.cloud.gaming.v1alpha.ListGameServerClustersRequest;
-import com.google.common.base.Strings;
-
-import java.io.IOException;
-
-public class ListClusters {
-
- public static void listGameServerClusters(String projectId, String regionId, String realmId) {
- // String projectId = "your-project-id";
- // String regionId = "us-central1-f";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerClustersServiceClient client = GameServerClustersServiceClient.create()) {
- String parent = String.format(
- "projects/%s/locations/%s/realms/%s", projectId, regionId, realmId);
-
- ListGameServerClustersPagedResponse response = client.listGameServerClusters(parent);
- for (GameServerCluster cluster : response.iterateAll()) {
- System.out.println("Game Server Cluster found: " + cluster.getName());
- }
-
- while (!Strings.isNullOrEmpty(response.getNextPageToken())) {
- ListGameServerClustersRequest request = ListGameServerClustersRequest
- .newBuilder()
- .setParent(parent)
- .setPageToken(response.getNextPageToken())
- .build();
- response = client.listGameServerClusters(request);
- for (GameServerCluster cluster : response.iterateAll()) {
- System.out.println("Game Server Cluster found: " + cluster.getName());
- }
- }
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_cluster_list]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/UpdateCluster.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/UpdateCluster.java
deleted file mode 100644
index a7c29a51831..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/clusters/UpdateCluster.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.clusters;
-
-// [START cloud_game_servers_cluster_update]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.GameServerCluster;
-import com.google.cloud.gaming.v1alpha.GameServerClustersServiceClient;
-import com.google.protobuf.Empty;
-import com.google.protobuf.FieldMask;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class UpdateCluster {
- public static void updateGameServerCluster(
- String projectId, String regionId, String realmId, String clusterId) {
- // String projectId = "your-project-id";
- // String regionId = "us-central1-f";
- // String realmId = "your-realm-id";
- // String clusterId = "your-game-server-cluster-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerClustersServiceClient client = GameServerClustersServiceClient.create()) {
- String parent = String.format(
- "projects/%s/locations/%s/realms/%s", projectId, regionId, realmId);
- String clusterName = String.format(
- "%s/gameServerClusters/%s", parent, clusterId);
-
- GameServerCluster cluster = GameServerCluster
- .newBuilder()
- .setName(clusterName)
- .putLabels("key", "value")
- .build();
-
- FieldMask fieldMask = FieldMask.newBuilder().addPaths("labels").build();
- OperationFuture call = client.updateGameServerClusterAsync(
- cluster, fieldMask);
-
- GameServerCluster updated = call.get(1, TimeUnit.MINUTES);
- System.out.println("Game Server Cluster updated: " + updated.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Game Server Cluster update request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_cluster_update]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/CommitRollout.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/CommitRollout.java
deleted file mode 100644
index c5062996edb..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/CommitRollout.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.deployments;
-
-// [START cloud_game_servers_deployment_start_rollout]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.GameServerDeployment;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient;
-import com.google.protobuf.Empty;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class CommitRollout {
- public static void commitRollout(String deploymentName) {
- // String deploymentName =
- // "projects/{project_id}/locations/{location}/gameServerDeployments/{deployment_id}";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerDeploymentsServiceClient client = GameServerDeploymentsServiceClient.create()) {
- OperationFuture call = client.commitRolloutAsync(deploymentName);
-
- GameServerDeployment result = call.get(1, TimeUnit.MINUTES);
- System.out.println("Rollout committed: " + result.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Commit Rollout request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_deployment_start_rollout]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/CreateDeployment.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/CreateDeployment.java
deleted file mode 100644
index e5994350e62..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/CreateDeployment.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.deployments;
-
-// [START cloud_game_servers_deployment_create]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.CreateGameServerDeploymentRequest;
-import com.google.cloud.gaming.v1alpha.GameServerDeployment;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient;
-import com.google.cloud.gaming.v1alpha.GameServerTemplate;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.protobuf.Empty;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class CreateDeployment {
- public static void createGameServerDeployment(String projectId, String deploymentId) {
- // String projectId = "your-project-id";
- // String deploymentId = "your-game-server-deployment-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerDeploymentsServiceClient client = GameServerDeploymentsServiceClient.create()) {
-
- // Build a spec as shown at https://agones.dev/site/docs/reference/gameserver/
- JsonObject container = new JsonObject();
- container.addProperty("name", "default");
- container.addProperty("image", "gcr.io/agones-images/default:1.0");
-
- JsonArray containers = new JsonArray();
- containers.add(container);
-
- JsonObject spec = new JsonObject();
- spec.add("containers", containers);
-
- JsonObject template = new JsonObject();
- template.add("spec", spec);
-
- JsonObject port = new JsonObject();
- port.addProperty("name", "default");
-
- JsonArray ports = new JsonArray();
- ports.add(port);
-
- JsonObject specObject = new JsonObject();
- specObject.add("ports", ports);
- specObject.add("template", template);
-
- String parent = String.format("projects/%s/locations/global", projectId);
- String deploymentName = String.format("%s/gameServerDeployments/%s", parent, deploymentId);
-
- GameServerTemplate gameServerTemplate = GameServerTemplate
- .newBuilder()
- .setSpec(specObject.toString())
- .setTemplateId("default")
- .build();
-
- GameServerDeployment gameServerDeployment = GameServerDeployment
- .newBuilder()
- .setName(deploymentName)
- .setNewGameServerTemplate(gameServerTemplate)
- .build();
-
- CreateGameServerDeploymentRequest request = CreateGameServerDeploymentRequest
- .newBuilder()
- .setParent(parent)
- .setDeploymentId(deploymentId)
- .setGameServerDeployment(gameServerDeployment)
- .build();
-
- OperationFuture call = client.createGameServerDeploymentAsync(
- request);
-
- GameServerDeployment created = call.get(1, TimeUnit.MINUTES);
- System.out.println("Game Server Deployment created: " + created.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Game Server Deployment create request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_deployment_create]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/DeleteDeployment.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/DeleteDeployment.java
deleted file mode 100644
index 9f793be29d9..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/DeleteDeployment.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.deployments;
-
-// [START cloud_game_servers_deployment_delete]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient;
-import com.google.protobuf.Empty;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class DeleteDeployment {
- public static void deleteGameServerDeployment(String projectId, String deploymentId) {
- // String projectId = "your-project-id";
- // String deploymentId = "your-game-server-deployment-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerDeploymentsServiceClient client = GameServerDeploymentsServiceClient.create()) {
- String parent = String.format("projects/%s/locations/global", projectId);
- String deploymentName = String.format("%s/gameServerDeployments/%s", parent, deploymentId);
-
- OperationFuture call = client.deleteGameServerDeploymentAsync(deploymentName);
- call.get(1, TimeUnit.MINUTES);
- System.out.println("Game Server Deployment deleted: " + deploymentName);
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Game Server Deployment delete request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_deployment_delete]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/GetDeployment.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/GetDeployment.java
deleted file mode 100644
index a7c4e31c4ed..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/GetDeployment.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.deployments;
-
-// [START cloud_game_servers_deployment_get]
-
-import com.google.cloud.gaming.v1alpha.GameServerDeployment;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient;
-
-import java.io.IOException;
-
-public class GetDeployment {
- public static void getGameServerDeployment(String projectId, String deploymentId) {
- // String projectId = "your-project-id";
- // String deploymentId = "your-game-server-deployment-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerDeploymentsServiceClient client = GameServerDeploymentsServiceClient.create()) {
- String deploymentName = String.format(
- "projects/%s/locations/global/gameServerDeployments/%s",
- projectId,
- deploymentId);
-
- GameServerDeployment deployment = client.getGameServerDeployment(deploymentName);
-
- System.out.println("Game Server Deployment found: " + deployment.getName());
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_deployment_get]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/GetDeploymentTarget.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/GetDeploymentTarget.java
deleted file mode 100644
index c43f98d3ba2..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/GetDeploymentTarget.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.deployments;
-
-// [START cloud_game_servers_deployment_start_rollout]
-
-import com.google.cloud.gaming.v1alpha.DeploymentTarget;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient;
-
-import java.io.IOException;
-
-public class GetDeploymentTarget {
- public static void getDeploymentTarget(String deploymentName) {
- // String deploymentName =
- // "projects/{project_id}/locations/{location}/gameServerDeployments/{deployment_id}";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerDeploymentsServiceClient client = GameServerDeploymentsServiceClient.create()) {
- DeploymentTarget target = client.getDeploymentTarget(deploymentName);
-
- System.out.printf("Found target with %d clusters.", target.getClustersCount());
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_deployment_start_rollout]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/ListDeployments.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/ListDeployments.java
deleted file mode 100644
index ce24272d80d..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/ListDeployments.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.deployments;
-
-// [START cloud_game_servers_deployment_list]
-
-import com.google.cloud.gaming.v1alpha.GameServerDeployment;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient.ListGameServerDeploymentsPagedResponse;
-import com.google.cloud.gaming.v1alpha.ListGameServerDeploymentsRequest;
-import com.google.common.base.Strings;
-
-import java.io.IOException;
-
-public class ListDeployments {
- public static void listGameServerDeployments(String projectId) {
- // String projectId = "your-project-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerDeploymentsServiceClient client = GameServerDeploymentsServiceClient.create()) {
- String parent = String.format("projects/%s/locations/global", projectId);
-
- ListGameServerDeploymentsPagedResponse response = client.listGameServerDeployments(parent);
- for (GameServerDeployment deployment : response.iterateAll()) {
- System.out.println("Game Server Deployment found: " + deployment.getName());
- }
-
- while (!Strings.isNullOrEmpty(response.getNextPageToken())) {
- ListGameServerDeploymentsRequest request = ListGameServerDeploymentsRequest
- .newBuilder()
- .setParent(parent)
- .setPageToken(response.getNextPageToken())
- .build();
- response = client.listGameServerDeployments(request);
- for (GameServerDeployment deployment : response.iterateAll()) {
- System.out.println("Game Server Deployment found: " + deployment.getName());
- }
- }
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_deployment_list]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/RevertRollout.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/RevertRollout.java
deleted file mode 100644
index e5423a4ee1e..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/RevertRollout.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.deployments;
-
-// [START cloud_game_servers_deployment_start_rollout]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.GameServerDeployment;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient;
-import com.google.protobuf.Empty;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class RevertRollout {
- public static void revertRollout(String deploymentName) {
- // String deploymentName =
- // "projects/{project_id}/locations/{location}/gameServerDeployments/{deployment_id}";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerDeploymentsServiceClient client = GameServerDeploymentsServiceClient.create()) {
- OperationFuture call = client.revertRolloutAsync(deploymentName);
-
- GameServerDeployment result = call.get(1, TimeUnit.MINUTES);
- System.out.println("Rollout reverted: " + result.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Revert Rollout request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_deployment_start_rollout]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/SetRolloutTarget.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/SetRolloutTarget.java
deleted file mode 100644
index 6674e38c4a2..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/SetRolloutTarget.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.deployments;
-
-// [START cloud_game_servers_deployment_start_rollout]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.ClusterPercentageSelector;
-import com.google.cloud.gaming.v1alpha.GameServerDeployment;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient;
-import com.google.cloud.gaming.v1alpha.SetRolloutTargetRequest;
-import com.google.protobuf.Empty;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class SetRolloutTarget {
- public static void setRolloutTarget(String deploymentName) {
- // String deploymentName =
- // "projects/{project_id}/locations/{location}/gameServerDeployments/{deployment_id}";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerDeploymentsServiceClient client = GameServerDeploymentsServiceClient.create()) {
- ClusterPercentageSelector percentageSelector = ClusterPercentageSelector
- .newBuilder()
- .setPercent(50)
- .build();
- SetRolloutTargetRequest request = SetRolloutTargetRequest
- .newBuilder()
- .setName(deploymentName)
- .addClusterPercentageSelector(percentageSelector)
- .build();
-
- OperationFuture call = client.setRolloutTargetAsync(request);
-
- GameServerDeployment result = call.get(1, TimeUnit.MINUTES);
- System.out.println("Rollout target set: " + result.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Set Rollout Target request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_deployment_set_rollout_target]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/StartRollout.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/StartRollout.java
deleted file mode 100644
index e09e0c12c2d..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/StartRollout.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.deployments;
-
-// [START cloud_game_servers_deployment_start_rollout]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.GameServerDeployment;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient;
-import com.google.cloud.gaming.v1alpha.GameServerTemplate;
-import com.google.gson.JsonArray;
-import com.google.gson.JsonObject;
-import com.google.protobuf.Empty;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class StartRollout {
- public static void startRollout(String deploymentName, String templateId) {
- // String deploymentName =
- // "projects/{project_id}/locations/{location}/gameServerDeployments/{deployment_id}";
- // String templateId = "your-game-server-template-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerDeploymentsServiceClient client = GameServerDeploymentsServiceClient.create()) {
-
- // Build a spec as shown at https://agones.dev/site/docs/reference/gameserver/
- JsonObject container = new JsonObject();
- container.addProperty("name", "default");
- container.addProperty("image", "gcr.io/agones-images/default:1.0");
-
- JsonArray containers = new JsonArray();
- containers.add(container);
-
- JsonObject spec = new JsonObject();
- spec.add("containers", containers);
-
- JsonObject template = new JsonObject();
- template.add("spec", spec);
-
- JsonObject port = new JsonObject();
- port.addProperty("name", "default");
-
- JsonArray ports = new JsonArray();
- ports.add(port);
-
- JsonObject specObject = new JsonObject();
- specObject.add("ports", ports);
- specObject.add("template", template);
-
- GameServerTemplate gameServerTemplate = GameServerTemplate
- .newBuilder()
- .setTemplateId(templateId)
- .setSpec(specObject.toString())
- .build();
-
- OperationFuture call = client.startRolloutAsync(
- deploymentName, gameServerTemplate);
-
- GameServerDeployment result = call.get(1, TimeUnit.MINUTES);
- System.out.println("Rollout started: " + result.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Start Rollout request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_deployment_start_rollout]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/UpdateDeployment.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/UpdateDeployment.java
deleted file mode 100644
index 24dd7470c56..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/deployments/UpdateDeployment.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.deployments;
-
-// [START cloud_game_servers_deployment_update]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.GameServerDeployment;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient;
-import com.google.protobuf.Empty;
-import com.google.protobuf.FieldMask;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class UpdateDeployment {
- public static void updateGameServerDeployment(String projectId, String deploymentId) {
- // String projectId = "your-project-id";
- // String deploymentId = "your-game-server-deployment-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (GameServerDeploymentsServiceClient client = GameServerDeploymentsServiceClient.create()) {
- String deploymentName = String.format(
- "projects/%s/locations/global/gameServerDeployments/%s",
- projectId,
- deploymentId);
-
- GameServerDeployment deployment = GameServerDeployment
- .newBuilder()
- .setName(deploymentName)
- .putLabels("key", "value")
- .build();
-
- FieldMask fieldMask = FieldMask
- .newBuilder()
- .addPaths("labels")
- .build();
-
- OperationFuture call = client.updateGameServerDeploymentAsync(
- deployment, fieldMask);
-
- GameServerDeployment updated = call.get(1, TimeUnit.MINUTES);
- System.out.println("Game Server Deployment updated: " + updated.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Game Server Deployment update request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_deployment_update]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/CreateRealm.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/CreateRealm.java
deleted file mode 100644
index 47515f68c45..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/CreateRealm.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.realms;
-
-// [START cloud_game_servers_realm_create]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.CreateRealmRequest;
-import com.google.cloud.gaming.v1alpha.Realm;
-import com.google.cloud.gaming.v1alpha.RealmsServiceClient;
-import com.google.protobuf.Empty;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class CreateRealm {
- public static void createRealm(String projectId, String regionId, String realmId) {
- // String projectId = "your-project-id";
- // String regionId = "us-central1-f";
- // String realmId = "your-realm-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (RealmsServiceClient client = RealmsServiceClient.create()) {
- String parent = String.format("projects/%s/locations/%s", projectId, regionId);
- String realmName = String.format("%s/realms/%s", parent, realmId);
-
- Realm realm = Realm
- .newBuilder()
- .setName(realmName)
- .setTimeZone("America/Los_Angeles")
- .build();
-
- CreateRealmRequest request = CreateRealmRequest
- .newBuilder()
- .setParent(parent)
- .setRealmId(realmId)
- .setRealm(realm)
- .build();
-
- OperationFuture call = client.createRealmAsync(request);
- Realm result = call.get(1, TimeUnit.MINUTES);
-
- System.out.println("Realm created: " + result.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Realm create request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_realm_create]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/DeleteRealm.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/DeleteRealm.java
deleted file mode 100644
index 5e9df3d3f57..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/DeleteRealm.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.realms;
-
-// [START cloud_game_servers_realm_delete]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.RealmsServiceClient;
-import com.google.protobuf.Empty;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class DeleteRealm {
- public static void deleteRealm(String projectId, String regionId, String realmId) {
- // String projectId = "your-project-id";
- // String regionId = "us-central1-f";
- // String realmId = "your-realm-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (RealmsServiceClient client = RealmsServiceClient.create()) {
- String parent = String.format("projects/%s/locations/%s", projectId, regionId);
- String realmName = String.format("%s/realms/%s", parent, realmId);
-
- OperationFuture call = client.deleteRealmAsync(realmName);
-
- call.get(1, TimeUnit.MINUTES);
- System.out.println("Realm deleted: " + realmName);
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Realm delete request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_realm_delete]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/GetRealm.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/GetRealm.java
deleted file mode 100644
index f377ebb8c58..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/GetRealm.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.realms;
-
-// [START cloud_game_servers_realm_get]
-
-import com.google.cloud.gaming.v1alpha.Realm;
-import com.google.cloud.gaming.v1alpha.RealmsServiceClient;
-
-import java.io.IOException;
-
-public class GetRealm {
- public static void getRealm(String projectId, String regionId, String realmId) {
- // String projectId = "your-project-id";
- // String regionId = "us-central1-f";
- // String realmId = "your-realm-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (RealmsServiceClient client = RealmsServiceClient.create()) {
- String realmName = String.format(
- "projects/%s/locations/%s/realms/%s", projectId, regionId, realmId);
-
- Realm allocationPolicy = client.getRealm(realmName);
-
- System.out.println("Realm found: " + allocationPolicy.getName());
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_realm_get]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/ListRealms.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/ListRealms.java
deleted file mode 100644
index eaaa9b6093f..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/ListRealms.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.realms;
-
-// [START cloud_game_servers_realm_list]
-
-import com.google.cloud.gaming.v1alpha.ListRealmsRequest;
-import com.google.cloud.gaming.v1alpha.Realm;
-import com.google.cloud.gaming.v1alpha.RealmsServiceClient;
-import com.google.cloud.gaming.v1alpha.RealmsServiceClient.ListRealmsPagedResponse;
-import com.google.common.base.Strings;
-
-import java.io.IOException;
-
-public class ListRealms {
- public static void listRealms(String projectId, String regionId) {
- // String projectId = "your-project-id";
- // String regionId = "us-central1-f";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (RealmsServiceClient client = RealmsServiceClient.create()) {
- String parent = String.format("projects/%s/locations/%s", projectId, regionId);
-
- ListRealmsPagedResponse response = client.listRealms(parent);
- for (Realm realm : response.iterateAll()) {
- System.out.println("Realm found: " + realm.getName());
- }
-
- while (!Strings.isNullOrEmpty(response.getNextPageToken())) {
- ListRealmsRequest request = ListRealmsRequest
- .newBuilder()
- .setParent(parent)
- .setPageToken(response.getNextPageToken())
- .build();
- response = client.listRealms(request);
- for (Realm realm : response.iterateAll()) {
- System.out.println("Realm found: " + realm.getName());
- }
- }
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_realm_list]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/UpdateRealm.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/UpdateRealm.java
deleted file mode 100644
index 75967314b80..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/realms/UpdateRealm.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.realms;
-
-// [START cloud_game_servers_realm_update]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.Realm;
-import com.google.cloud.gaming.v1alpha.RealmsServiceClient;
-import com.google.protobuf.Empty;
-import com.google.protobuf.FieldMask;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class UpdateRealm {
- public static void updateRealm(String projectId, String regionId, String realmId) {
- // String projectId = "your-project-id";
- // String regionId = "us-central1-f";
- // String realmId = "your-realm-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (RealmsServiceClient client = RealmsServiceClient.create()) {
- String parent = String.format("projects/%s/locations/%s", projectId, regionId);
- String realmName = String.format("%s/realms/%s", parent, realmId);
-
- Realm realm = Realm
- .newBuilder()
- .setName(realmName)
- .setTimeZone("America/New_York")
- .build();
-
- FieldMask fieldMask = FieldMask.newBuilder().addPaths("time_zone").build();
-
- OperationFuture call = client.updateRealmAsync(realm, fieldMask);
-
- Realm updated = call.get(1, TimeUnit.MINUTES);
- System.out.println("Realm updated: " + updated.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Realm update request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_realm_update]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/CreateScalingPolicy.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/CreateScalingPolicy.java
deleted file mode 100644
index ccc04bbd29e..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/CreateScalingPolicy.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.scalingpolicies;
-
-// [START cloud_game_servers_scaling_policy_create]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.CreateScalingPolicyRequest;
-import com.google.cloud.gaming.v1alpha.FleetAutoscalerSettings;
-import com.google.cloud.gaming.v1alpha.ScalingPoliciesServiceClient;
-import com.google.cloud.gaming.v1alpha.ScalingPolicy;
-import com.google.protobuf.Empty;
-import com.google.protobuf.Int32Value;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class CreateScalingPolicy {
- public static void createScalingPolicy(String projectId, String policyId, String deploymentId) {
- // String projectId = "your-project-id";
- // String policyId = "your-policy-id";
- // String deploymentId = "your-deployment-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (ScalingPoliciesServiceClient client = ScalingPoliciesServiceClient.create()) {
- String parent = String.format("projects/%s/locations/global", projectId);
- String policyName = String.format("%s/scalingPolicies/%s", parent, policyId);
-
- String deploymentName = String.format("%s/gameServerDeployments/%s", parent, deploymentId);
-
- FleetAutoscalerSettings autoscalerSettings = FleetAutoscalerSettings
- .newBuilder()
- .setBufferSizeAbsolute(1)
- .setMinReplicas(1)
- .setMaxReplicas(2)
- .build();
-
- ScalingPolicy policy = ScalingPolicy
- .newBuilder()
- .setName(policyName)
- .setPriority(Int32Value.newBuilder().setValue(1))
- .setFleetAutoscalerSettings(autoscalerSettings)
- .setGameServerDeployment(deploymentName)
- .build();
-
- CreateScalingPolicyRequest request = CreateScalingPolicyRequest
- .newBuilder()
- .setParent(parent)
- .setScalingPolicyId(policyId)
- .setScalingPolicy(policy)
- .build();
-
- OperationFuture call = client.createScalingPolicyAsync(request);
-
- ScalingPolicy created = call.get(1, TimeUnit.MINUTES);
- System.out.println("Scaling Policy created: " + created.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Scaling Policy create request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_scaling_policy_create]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/DeleteScalingPolicy.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/DeleteScalingPolicy.java
deleted file mode 100644
index 976cc56eb0f..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/DeleteScalingPolicy.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.scalingpolicies;
-
-// [START cloud_game_servers_scaling_policy_delete]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.ScalingPoliciesServiceClient;
-import com.google.protobuf.Empty;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class DeleteScalingPolicy {
- public static void deleteScalingPolicy(String projectId, String policyId) {
- // String projectId = "your-project-id";
- // String policyId = "your-policy-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (ScalingPoliciesServiceClient client = ScalingPoliciesServiceClient.create()) {
- String parent = String.format("projects/%s/locations/global", projectId);
- String policyName = String.format("%s/scalingPolicies/%s", parent, policyId);
-
- OperationFuture call = client.deleteScalingPolicyAsync(policyName);
-
- call.get(1, TimeUnit.MINUTES);
- System.out.println("Scaling Policy deleted: " + policyName);
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Scaling Policy delete request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_scaling_policy_delete]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/GetScalingPolicy.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/GetScalingPolicy.java
deleted file mode 100644
index b8e6738a7d6..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/GetScalingPolicy.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.scalingpolicies;
-
-// [START cloud_game_servers_scaling_policy_get]
-
-import com.google.cloud.gaming.v1alpha.ScalingPoliciesServiceClient;
-import com.google.cloud.gaming.v1alpha.ScalingPolicy;
-
-import java.io.IOException;
-
-public class GetScalingPolicy {
- public static void getScalingPolicy(String projectId, String policyId) {
- // String projectId = "your-project-id";
- // String policyId = "your-policy-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (ScalingPoliciesServiceClient client = ScalingPoliciesServiceClient.create()) {
- String policyName = String.format(
- "projects/%s/locations/global/scalingPolicies/%s", projectId, policyId);
-
- ScalingPolicy scalingPolicy = client.getScalingPolicy(policyName);
-
- System.out.println("Scaling Policy found: " + scalingPolicy.getName());
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_scaling_policy_get]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/ListScalingPolicies.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/ListScalingPolicies.java
deleted file mode 100644
index b024f58669f..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/ListScalingPolicies.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.scalingpolicies;
-
-// [START cloud_game_servers_scaling_policy_list]
-
-import com.google.cloud.gaming.v1alpha.ListScalingPoliciesRequest;
-import com.google.cloud.gaming.v1alpha.ScalingPoliciesServiceClient;
-import com.google.cloud.gaming.v1alpha.ScalingPoliciesServiceClient.ListScalingPoliciesPagedResponse;
-import com.google.cloud.gaming.v1alpha.ScalingPolicy;
-import com.google.common.base.Strings;
-
-import java.io.IOException;
-
-public class ListScalingPolicies {
- public static void listScalingPolicies(String projectId) {
- // String projectId = "your-project-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (ScalingPoliciesServiceClient client = ScalingPoliciesServiceClient.create()) {
- String parent = String.format("projects/%s/locations/global", projectId);
-
- ListScalingPoliciesPagedResponse response = client.listScalingPolicies(parent);
- for (ScalingPolicy policy : response.iterateAll()) {
- System.out.println("Scaling Policy found: " + policy.getName());
- }
-
- while (!Strings.isNullOrEmpty(response.getNextPageToken())) {
- ListScalingPoliciesRequest request = ListScalingPoliciesRequest
- .newBuilder()
- .setParent(parent)
- .setPageToken(response.getNextPageToken())
- .build();
- response = client.listScalingPolicies(request);
- for (ScalingPolicy policy : response.iterateAll()) {
- System.out.println("Scaling Policy found: " + policy.getName());
- }
- }
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_scaling_policy_list]
diff --git a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/UpdateScalingPolicy.java b/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/UpdateScalingPolicy.java
deleted file mode 100644
index 01cf95c1498..00000000000
--- a/gameservices/v1alpha/src/main/java/com/google/cloud/gameservices/samples/scalingpolicies/UpdateScalingPolicy.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples.scalingpolicies;
-
-// [START cloud_game_servers_scaling_policy_update]
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.ScalingPoliciesServiceClient;
-import com.google.cloud.gaming.v1alpha.ScalingPolicy;
-import com.google.protobuf.Empty;
-import com.google.protobuf.FieldMask;
-import com.google.protobuf.Int32Value;
-
-import java.io.IOException;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.TimeoutException;
-
-public class UpdateScalingPolicy {
- public static void updateScalingPolicy(String projectId, String policyId) {
- // String projectId = "your-project-id";
- // String policyId = "your-policy-id";
- // Initialize client that will be used to send requests. This client only needs to be created
- // once, and can be reused for multiple requests. After completing all of your requests, call
- // the "close" method on the client to safely clean up any remaining background resources.
- try (ScalingPoliciesServiceClient client = ScalingPoliciesServiceClient.create()) {
- String policyName = String.format(
- "projects/%s/locations/global/scalingPolicies/%s", projectId, policyId);
-
- ScalingPolicy policy = ScalingPolicy
- .newBuilder()
- .setName(policyName)
- .setPriority(Int32Value.newBuilder().setValue(10).build())
- .build();
-
- FieldMask fieldMask = FieldMask.newBuilder().addPaths("priority").build();
-
- OperationFuture call = client.updateScalingPolicyAsync(
- policy, fieldMask);
-
- ScalingPolicy updated = call.get(1, TimeUnit.MINUTES);
- System.out.println("Scaling Policy updated: " + updated.getName());
- } catch (IOException | InterruptedException | ExecutionException | TimeoutException e) {
- System.err.println("Scaling Policy update request unsuccessful.");
- e.printStackTrace(System.err);
- }
- }
-}
-// [END cloud_game_servers_scaling_policy_update]
diff --git a/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/AllocationPolicyTests.java b/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/AllocationPolicyTests.java
deleted file mode 100644
index 52574bc180b..00000000000
--- a/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/AllocationPolicyTests.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples;
-
-import static org.junit.Assert.assertTrue;
-
-import com.google.cloud.gameservices.samples.allocationpolicies.CreateAllocationPolicy;
-import com.google.cloud.gameservices.samples.allocationpolicies.DeleteAllocationPolicy;
-import com.google.cloud.gameservices.samples.allocationpolicies.GetAllocationPolicy;
-import com.google.cloud.gameservices.samples.allocationpolicies.ListAllocationPolicies;
-import com.google.cloud.gameservices.samples.allocationpolicies.UpdateAllocationPolicy;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class AllocationPolicyTests {
- private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
-
- private static String parentName = String.format("projects/%s/locations/global", PROJECT_ID);
-
- private static String policyId = "policy-1";
- private static String policyName = String.format(
- "%s/allocationPolicies/%s", parentName, policyId);
-
- private final PrintStream originalOut = System.out;
- private ByteArrayOutputStream bout;
-
- @Before
- public void setUp() {
- bout = new ByteArrayOutputStream();
- System.setOut(new PrintStream(bout));
- }
-
- @BeforeClass
- public static void init() {
- GameServicesTestUtil.deleteExistingAllocationPolicies(parentName);
- CreateAllocationPolicy.createAllocationPolicy(PROJECT_ID, policyId);
- }
-
- @After
- public void tearDown() {
- System.setOut(originalOut);
- bout.reset();
- }
-
- @AfterClass
- public static void tearDownClass() {
- GameServicesTestUtil.deleteExistingAllocationPolicies(parentName);
- }
-
- @Test
- public void createDeleteAllocationPolicyTest() {
- String newPolicyId = "policy-2";
- String newPolicyName = String.format("%s/allocationPolicies/%s", parentName, newPolicyId);
- CreateAllocationPolicy.createAllocationPolicy(PROJECT_ID, newPolicyId);
- DeleteAllocationPolicy.deleteAllocationPolicy(PROJECT_ID, newPolicyId);
- String output = bout.toString();
- assertTrue(output.contains("Allocation Policy created: " + newPolicyName));
- assertTrue(output.contains("Allocation Policy deleted: " + newPolicyName));
- }
-
- @Test
- public void getAllocationPolicyTest() {
- GetAllocationPolicy.getAllocationPolicy(PROJECT_ID, policyId);
-
- assertTrue(bout.toString().contains("Allocation Policy found: " + policyName));
- }
-
- @Test
- public void listAllocationPoliciesTest() {
- ListAllocationPolicies.listAllocationPolicies(PROJECT_ID);
-
- assertTrue(bout.toString().contains("Allocation Policy found: " + policyName));
- }
-
- @Test
- public void updateAllocationPoliciesTest() {
- UpdateAllocationPolicy.updateAllocationPolicy(PROJECT_ID, policyId);
-
- assertTrue(bout.toString().contains("Allocation Policy updated: " + policyName));
- }
-}
diff --git a/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/ClusterTests.java b/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/ClusterTests.java
deleted file mode 100644
index b130341e057..00000000000
--- a/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/ClusterTests.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples;
-
-import static org.junit.Assert.assertTrue;
-
-import com.google.cloud.gameservices.samples.clusters.CreateCluster;
-import com.google.cloud.gameservices.samples.clusters.DeleteCluster;
-import com.google.cloud.gameservices.samples.clusters.GetCluster;
-import com.google.cloud.gameservices.samples.clusters.ListClusters;
-import com.google.cloud.gameservices.samples.clusters.UpdateCluster;
-import com.google.cloud.gameservices.samples.realms.CreateRealm;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class ClusterTests {
- private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
- private static final String REGION_ID = "us-central1";
-
- private static String parentName = String.format(
- "projects/%s/locations/%s", PROJECT_ID, REGION_ID);
-
- private static String realmId = "realm-1";
- private static String realmName = String.format("%s/realms/%s", parentName, realmId);
-
- private static String clusterId = "cluster-1";
- private static String clusterName = String.format(
- "%s/gameServerClusters/%s", realmName, clusterId);
-
- private static String gkeClusterName = System.getenv("GKE_CLUSTER");
-
- private final PrintStream originalOut = System.out;
- private ByteArrayOutputStream bout;
-
- @Before
- public void setUp() {
- bout = new ByteArrayOutputStream();
- System.setOut(new PrintStream(bout));
- }
-
- @BeforeClass
- public static void init() {
- // Delete all existing clusters and realms.
- GameServicesTestUtil.deleteExistingClusters(realmName);
- GameServicesTestUtil.deleteExistingRealms(parentName);
- CreateRealm.createRealm(PROJECT_ID, REGION_ID, realmId);
- CreateCluster.createGameServerCluster(
- PROJECT_ID, REGION_ID, realmId, clusterId, gkeClusterName);
- }
-
- @After
- public void tearDown() {
- System.setOut(originalOut);
- bout.reset();
- }
-
- @AfterClass
- public static void tearDownClass() {
- GameServicesTestUtil.deleteExistingClusters(realmName);
- GameServicesTestUtil.deleteExistingRealms(parentName);
- }
-
- @Test
- public void createDeleteClusterTest() {
- String newClusterId = "cluster-2";
- String newClusterName = String.format(
- "%s/gameServerClusters/%s", realmName, newClusterId);
- CreateCluster.createGameServerCluster(
- PROJECT_ID, REGION_ID, realmId, newClusterId, gkeClusterName);
- DeleteCluster.deleteGameServerCluster(PROJECT_ID, REGION_ID, realmId, newClusterId);
- assertTrue(bout.toString().contains("Game Server Cluster created: " + newClusterName));
- assertTrue(bout.toString().contains("Game Server Cluster deleted: " + newClusterName));
- }
-
- @Test
- public void getClusterTest() {
- GetCluster.getGameServerCluster(PROJECT_ID, REGION_ID, realmId, clusterId);
-
- assertTrue(bout.toString().contains("Game Server Cluster found: " + clusterName));
- }
-
- @Test
- public void listClustersTest() {
- ListClusters.listGameServerClusters(PROJECT_ID, REGION_ID, realmId);
-
- assertTrue(bout.toString().contains("Game Server Cluster found: " + clusterName));
- }
-
- @Test
- public void updateClusterTest() {
- UpdateCluster.updateGameServerCluster(PROJECT_ID, REGION_ID, realmId, clusterId);
-
- assertTrue(bout.toString().contains("Game Server Cluster updated: " + clusterName));
- }
-}
diff --git a/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/DeploymentTests.java b/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/DeploymentTests.java
deleted file mode 100644
index c1e28baf6c6..00000000000
--- a/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/DeploymentTests.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples;
-
-import static org.junit.Assert.assertTrue;
-
-import com.google.cloud.gameservices.samples.deployments.CommitRollout;
-import com.google.cloud.gameservices.samples.deployments.CreateDeployment;
-import com.google.cloud.gameservices.samples.deployments.DeleteDeployment;
-import com.google.cloud.gameservices.samples.deployments.GetDeployment;
-import com.google.cloud.gameservices.samples.deployments.GetDeploymentTarget;
-import com.google.cloud.gameservices.samples.deployments.ListDeployments;
-import com.google.cloud.gameservices.samples.deployments.RevertRollout;
-import com.google.cloud.gameservices.samples.deployments.SetRolloutTarget;
-import com.google.cloud.gameservices.samples.deployments.StartRollout;
-import com.google.cloud.gameservices.samples.deployments.UpdateDeployment;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class DeploymentTests {
- private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
-
- private static String parentName = String.format("projects/%s/locations/global", PROJECT_ID);
- private static String deploymentId = "deployment-1";
- private static String deploymentName = String.format(
- "%s/gameServerDeployments/%s", parentName, deploymentId);
-
- private final PrintStream originalOut = System.out;
- private ByteArrayOutputStream bout;
-
- @Before
- public void setUp() {
- bout = new ByteArrayOutputStream();
- System.setOut(new PrintStream(bout));
- }
-
- @BeforeClass
- public static void init() {
- GameServicesTestUtil.deleteExistingDeployments(parentName);
- CreateDeployment.createGameServerDeployment(PROJECT_ID, deploymentId);
- }
-
- @After
- public void tearDown() {
- System.setOut(originalOut);
- bout.reset();
- }
-
- @AfterClass
- public static void tearDownClass() {
- GameServicesTestUtil.deleteExistingDeployments(parentName);
- }
-
- @Test
- public void createDeleteGameServerDeploymentTest() {
- String newDeploymentId = "deployment-2";
- String newDeploymentName = String.format(
- "%s/gameServerDeployments/%s", parentName, newDeploymentId);
- CreateDeployment.createGameServerDeployment(PROJECT_ID, newDeploymentId);
- DeleteDeployment.deleteGameServerDeployment(PROJECT_ID, newDeploymentId);
- assertTrue(bout.toString().contains("Game Server Deployment created: " + newDeploymentName));
- assertTrue(bout.toString().contains("Game Server Deployment deleted: " + newDeploymentName));
- }
-
- @Test
- public void getGameServerDeploymentTest() {
- GetDeployment.getGameServerDeployment(PROJECT_ID, deploymentId);
-
- assertTrue(bout.toString().contains("Game Server Deployment found: " + deploymentName));
- }
-
- @Test
- public void listGameServerDeploymentsTest() {
- ListDeployments.listGameServerDeployments(PROJECT_ID);
-
- assertTrue(bout.toString().contains("Game Server Deployment found: " + deploymentName));
- }
-
- @Test
- public void updateGameServerDeploymentTest() {
- UpdateDeployment.updateGameServerDeployment(PROJECT_ID, deploymentId);
- assertTrue(bout.toString().contains("Game Server Deployment updated: " + deploymentName));
- }
-
- @Test
- @Ignore("b/135051878")
- public void rolloutStartSetGetTargetCommitTests() {
- GetDeploymentTarget.getDeploymentTarget(deploymentName);
- RevertRollout.revertRollout(deploymentName);
- StartRollout.startRollout(deploymentName, "new-template");
- SetRolloutTarget.setRolloutTarget(deploymentName);
- CommitRollout.commitRollout(deploymentName);
-
- assertTrue(bout.toString().contains("Found target with "));
- assertTrue(bout.toString().contains("Rollout reverted:"));
- assertTrue(bout.toString().contains("Rollout started:"));
- assertTrue(bout.toString().contains("Rollout target set:"));
- assertTrue(bout.toString().contains("Rollout target set:"));
- }
-
- @Test
- public void rolloutRevertTest() {
- RevertRollout.revertRollout(deploymentName);
- assertTrue(bout.toString().contains("Rollout reverted:"));
-
- StartRollout.startRollout(deploymentName, "default");
- assertTrue(bout.toString().contains("Rollout started:"));
- }
-}
diff --git a/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/GameServicesTestUtil.java b/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/GameServicesTestUtil.java
deleted file mode 100644
index 235c0351264..00000000000
--- a/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/GameServicesTestUtil.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples;
-
-import com.google.api.gax.longrunning.OperationFuture;
-import com.google.cloud.gaming.v1alpha.AllocationPoliciesServiceClient;
-import com.google.cloud.gaming.v1alpha.AllocationPoliciesServiceClient.ListAllocationPoliciesPagedResponse;
-import com.google.cloud.gaming.v1alpha.AllocationPolicy;
-import com.google.cloud.gaming.v1alpha.GameServerCluster;
-import com.google.cloud.gaming.v1alpha.GameServerClustersServiceClient;
-import com.google.cloud.gaming.v1alpha.GameServerClustersServiceClient.ListGameServerClustersPagedResponse;
-import com.google.cloud.gaming.v1alpha.GameServerDeployment;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient;
-import com.google.cloud.gaming.v1alpha.GameServerDeploymentsServiceClient.ListGameServerDeploymentsPagedResponse;
-import com.google.cloud.gaming.v1alpha.Realm;
-import com.google.cloud.gaming.v1alpha.RealmsServiceClient;
-import com.google.cloud.gaming.v1alpha.RealmsServiceClient.ListRealmsPagedResponse;
-import com.google.cloud.gaming.v1alpha.ScalingPoliciesServiceClient;
-import com.google.cloud.gaming.v1alpha.ScalingPoliciesServiceClient.ListScalingPoliciesPagedResponse;
-import com.google.cloud.gaming.v1alpha.ScalingPolicy;
-
-import java.io.IOException;
-import java.util.concurrent.TimeUnit;
-
-class GameServicesTestUtil {
- private static AllocationPoliciesServiceClient allocationsClient;
- private static GameServerClustersServiceClient clustersClient;
- private static GameServerDeploymentsServiceClient deploymentsClient;
- private static RealmsServiceClient realmsClient;
- private static ScalingPoliciesServiceClient scalingsClient;
-
- static {
- try {
- allocationsClient = AllocationPoliciesServiceClient.create();
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- try {
- clustersClient = GameServerClustersServiceClient.create();
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- try {
- deploymentsClient = GameServerDeploymentsServiceClient.create();
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- try {
- scalingsClient = ScalingPoliciesServiceClient.create();
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- try {
- realmsClient = RealmsServiceClient.create();
- } catch (IOException e) {
- e.printStackTrace(System.err);
- }
- }
-
-
- public static void deleteExistingAllocationPolicies(String parent) {
- try {
- ListAllocationPoliciesPagedResponse response =
- allocationsClient.listAllocationPolicies(parent);
-
- for (AllocationPolicy policy : response.iterateAll()) {
- System.out.println("Deleting allocation policy " + policy.getName());
- OperationFuture poll = allocationsClient.deleteAllocationPolicyAsync(policy.getName());
- poll.get(1, TimeUnit.MINUTES);
- }
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
-
- public static void deleteExistingClusters(String parent) {
- try {
- ListGameServerClustersPagedResponse response = clustersClient.listGameServerClusters(parent);
-
- for (GameServerCluster cluster : response.iterateAll()) {
- System.out.println("Deleting game cluster " + cluster.getName());
- OperationFuture poll =
- clustersClient.deleteGameServerClusterAsync(cluster.getName());
- poll.get(1, TimeUnit.MINUTES);
- }
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
-
- public static void deleteExistingDeployments(String parent) {
- try {
- ListGameServerDeploymentsPagedResponse response =
- deploymentsClient.listGameServerDeployments(parent);
-
- for (GameServerDeployment deployment : response.iterateAll()) {
- System.out.println("Deleting game server deployment " + deployment.getName());
- OperationFuture poll =
- deploymentsClient.deleteGameServerDeploymentAsync(deployment.getName());
- poll.get(1, TimeUnit.MINUTES);
- }
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
-
- public static void deleteExistingRealms(String parent) {
- try {
- ListRealmsPagedResponse response = realmsClient.listRealms(parent);
-
- for (Realm realm : response.iterateAll()) {
- System.out.println("Deleting realm " + realm.getName());
- OperationFuture poll = realmsClient.deleteRealmAsync(realm.getName());
- poll.get(1, TimeUnit.MINUTES);
- }
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
-
- public static void deleteExistingScalingPolicies(String parent) {
- try {
- ListScalingPoliciesPagedResponse response = scalingsClient.listScalingPolicies(parent);
-
- for (ScalingPolicy policy : response.iterateAll()) {
- System.out.println("Deleting scaling policy " + policy.getName());
- OperationFuture poll = scalingsClient.deleteScalingPolicyAsync(policy.getName());
- poll.get(1, TimeUnit.MINUTES);
- }
- } catch (Exception e) {
- e.printStackTrace(System.err);
- }
- }
-}
diff --git a/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/RealmTests.java b/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/RealmTests.java
deleted file mode 100644
index 31f7d71ad8f..00000000000
--- a/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/RealmTests.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples;
-
-import static org.junit.Assert.assertTrue;
-
-import com.google.cloud.gameservices.samples.realms.CreateRealm;
-import com.google.cloud.gameservices.samples.realms.DeleteRealm;
-import com.google.cloud.gameservices.samples.realms.GetRealm;
-import com.google.cloud.gameservices.samples.realms.ListRealms;
-import com.google.cloud.gameservices.samples.realms.UpdateRealm;
-
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class RealmTests {
- private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
- private static final String REGION_ID = "us-central1";
-
- private static String parentName = String.format(
- "projects/%s/locations/%s", PROJECT_ID, REGION_ID);
-
- private static String realmId = "realm-1";
- private static String realmName = String.format("%s/realms/%s", parentName, realmId);
-
- private final PrintStream originalOut = System.out;
- private ByteArrayOutputStream bout;
-
- @Before
- public void setUp() {
- bout = new ByteArrayOutputStream();
- System.setOut(new PrintStream(bout));
- }
-
- @BeforeClass
- public static void init() {
- GameServicesTestUtil.deleteExistingRealms(parentName);
- CreateRealm.createRealm(PROJECT_ID, REGION_ID, realmId);
- }
-
- @After
- public void tearDown() {
- System.setOut(originalOut);
- bout.reset();
- }
-
- @AfterClass
- public static void tearDownClass() {
- GameServicesTestUtil.deleteExistingRealms(parentName);
- }
-
- @Test
- public void createDeleteRealmTest() {
- String newRealmId = "realm-2";
- String newRealmName = String.format(
- "projects/%s/locations/%s/realms/%s", PROJECT_ID, REGION_ID, newRealmId);
- CreateRealm.createRealm(PROJECT_ID, REGION_ID, newRealmId);
- DeleteRealm.deleteRealm(PROJECT_ID, REGION_ID, newRealmId);
- String output = bout.toString();
- assertTrue(output.contains("Realm created: " + newRealmName));
- assertTrue(output.contains("Realm deleted: " + newRealmName));
- }
-
- @Test
- public void getRealmTest() {
- GetRealm.getRealm(PROJECT_ID, REGION_ID, realmId);
-
- assertTrue(bout.toString().contains("Realm found: " + realmName));
- }
-
- @Test
- public void listRealmsTest() {
- ListRealms.listRealms(PROJECT_ID, REGION_ID);
-
- assertTrue(bout.toString().contains("Realm found: " + realmName));
- }
-
- @Test
- public void updateRealmTest() {
- UpdateRealm.updateRealm(PROJECT_ID, REGION_ID, realmId);
-
- assertTrue(bout.toString().contains("Realm updated: " + realmName));
- }
-}
diff --git a/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/ScalingPolicyTests.java b/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/ScalingPolicyTests.java
deleted file mode 100644
index 8b206c8fbd4..00000000000
--- a/gameservices/v1alpha/src/test/java/com/google/cloud/gameservices/samples/ScalingPolicyTests.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright 2019 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
- *
- * http://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.gameservices.samples;
-
-import static org.junit.Assert.assertTrue;
-
-import com.google.cloud.gameservices.samples.deployments.CreateDeployment;
-import com.google.cloud.gameservices.samples.scalingpolicies.CreateScalingPolicy;
-import com.google.cloud.gameservices.samples.scalingpolicies.DeleteScalingPolicy;
-import com.google.cloud.gameservices.samples.scalingpolicies.GetScalingPolicy;
-import com.google.cloud.gameservices.samples.scalingpolicies.ListScalingPolicies;
-import com.google.cloud.gameservices.samples.scalingpolicies.UpdateScalingPolicy;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.TimeoutException;
-
-import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class ScalingPolicyTests {
- private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT");
-
- private static String parentName = String.format("projects/%s/locations/global", PROJECT_ID);
-
- private static String deploymentId = "deployment-1";
- private static String policyId = "policy-1";
- private static String policyName = String.format("%s/scalingPolicies/%s", parentName, policyId);
-
- private final PrintStream originalOut = System.out;
- private ByteArrayOutputStream bout;
-
- @Before
- public void setUp() {
- bout = new ByteArrayOutputStream();
- System.setOut(new PrintStream(bout));
- }
-
- @BeforeClass
- public static void init() {
- GameServicesTestUtil.deleteExistingScalingPolicies(parentName);
- GameServicesTestUtil.deleteExistingDeployments(parentName);
- CreateDeployment.createGameServerDeployment(PROJECT_ID, deploymentId);
- CreateScalingPolicy.createScalingPolicy(PROJECT_ID, policyId, deploymentId);
- }
-
- @After
- public void tearDown() {
- System.setOut(originalOut);
- bout.reset();
- }
-
- @AfterClass
- public static void tearDownClass() {
- GameServicesTestUtil.deleteExistingScalingPolicies(parentName);
- GameServicesTestUtil.deleteExistingDeployments(parentName);
- }
-
- @Test
- public void createDeleteScalingPolicyTest() {
- String newPolicyId = "policy-2";
- String newPolicyName = String.format("%s/scalingPolicies/%s", parentName, newPolicyId);
- CreateScalingPolicy.createScalingPolicy(PROJECT_ID, newPolicyId, deploymentId);
- assertTrue(bout.toString().contains("Scaling Policy created: " + newPolicyName));
-
- DeleteScalingPolicy.deleteScalingPolicy(PROJECT_ID, newPolicyId);
- assertTrue(bout.toString().contains("Scaling Policy deleted: " + newPolicyName));
- }
-
- @Test
- public void getScalingPolicyTest() {
- GetScalingPolicy.getScalingPolicy(PROJECT_ID, policyId);
-
- assertTrue(bout.toString().contains("Scaling Policy found: " + policyName));
- }
-
- @Test
- public void listScalingPoliciesTest() {
- ListScalingPolicies.listScalingPolicies(PROJECT_ID);
-
- assertTrue(bout.toString().contains("Scaling Policy found: " + policyName));
- }
-
- @Test
- public void updateScalingPoliciesTest() {
- UpdateScalingPolicy.updateScalingPolicy(PROJECT_ID, policyId);
-
- assertTrue(bout.toString().contains("Scaling Policy updated: " + policyName));
- }
-}