Exemple #1
0
        /// <summary>Snippet for DeleteCluster</summary>
        public void DeleteCluster_RequestObject()
        {
            // Snippet: DeleteCluster(DeleteClusterRequest,CallSettings)
            // Create client
            ClusterControllerClient clusterControllerClient = ClusterControllerClient.Create();
            // Initialize request argument(s)
            DeleteClusterRequest request = new DeleteClusterRequest
            {
                ProjectId   = "",
                Region      = "",
                ClusterName = "",
            };
            // Make the request
            Operation <Empty, ClusterOperationMetadata> response =
                clusterControllerClient.DeleteCluster(request);

            // Poll until the returned long-running operation is complete
            Operation <Empty, ClusterOperationMetadata> completedResponse =
                response.PollUntilCompleted();
            // The long-running operation is now complete.

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, ClusterOperationMetadata> retrievedResponse =
                clusterControllerClient.PollOnceDeleteCluster(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // The long-running operation is now complete.
            }
            // End snippet
        }
        /// <summary>Snippet for DeleteCluster</summary>
        public void DeleteCluster()
        {
            // Snippet: DeleteCluster(string, string, string, CallSettings)
            // Create client
            ClusterControllerClient clusterControllerClient = ClusterControllerClient.Create();
            // Initialize request argument(s)
            string projectId   = "";
            string region      = "";
            string clusterName = "";
            // Make the request
            Operation <Empty, ClusterOperationMetadata> response = clusterControllerClient.DeleteCluster(projectId, region, clusterName);

            // Poll until the returned long-running operation is complete
            Operation <Empty, ClusterOperationMetadata> completedResponse = response.PollUntilCompleted();
            // Retrieve the operation result
            Empty result = completedResponse.Result;

            // Or get the name of the operation
            string operationName = response.Name;
            // This name can be stored, then the long-running operation retrieved later by name
            Operation <Empty, ClusterOperationMetadata> retrievedResponse = clusterControllerClient.PollOnceDeleteCluster(operationName);

            // Check if the retrieved long-running operation has completed
            if (retrievedResponse.IsCompleted)
            {
                // If it has completed, then access the result
                Empty retrievedResult = retrievedResponse.Result;
            }
            // End snippet
        }