Ejemplo n.º 1
0
        /// <summary>Snippet for DeleteClusterAsync</summary>
        public async Task DeleteClusterAsync()
        {
            // Snippet: DeleteClusterAsync(string,string,string,CallSettings)
            // Additional: DeleteClusterAsync(string,string,string,CancellationToken)
            // Create client
            ClusterControllerClient clusterControllerClient = await ClusterControllerClient.CreateAsync();

            // Initialize request argument(s)
            string projectId   = "";
            string region      = "";
            string clusterName = "";
            // Make the request
            Operation <Empty, ClusterOperationMetadata> response =
                await clusterControllerClient.DeleteClusterAsync(projectId, region, clusterName);

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

            // 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 =
                await clusterControllerClient.PollOnceDeleteClusterAsync(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 DeleteClusterAsync</summary>
        public async Task DeleteClusterRequestObjectAsync()
        {
            // Snippet: DeleteClusterAsync(DeleteClusterRequest, CallSettings)
            // Additional: DeleteClusterAsync(DeleteClusterRequest, CancellationToken)
            // Create client
            ClusterControllerClient clusterControllerClient = await ClusterControllerClient.CreateAsync();

            // Initialize request argument(s)
            DeleteClusterRequest request = new DeleteClusterRequest
            {
                ProjectId   = "",
                ClusterName = "",
                Region      = "",
                ClusterUuid = "",
                RequestId   = "",
            };
            // Make the request
            Operation <Empty, ClusterOperationMetadata> response = await clusterControllerClient.DeleteClusterAsync(request);

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

            // 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 = await clusterControllerClient.PollOnceDeleteClusterAsync(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
        }