/// <summary>Snippet for RestartInstanceAsync</summary> public async Task RestartInstanceRequestObjectAsync() { // Snippet: RestartInstanceAsync(RestartInstanceRequest, CallSettings) // Additional: RestartInstanceAsync(RestartInstanceRequest, CancellationToken) // Create client DataFusionClient dataFusionClient = await DataFusionClient.CreateAsync(); // Initialize request argument(s) RestartInstanceRequest request = new RestartInstanceRequest { Name = "", }; // Make the request Operation <Instance, OperationMetadata> response = await dataFusionClient.RestartInstanceAsync(request); // Poll until the returned long-running operation is complete Operation <Instance, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Instance 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 <Instance, OperationMetadata> retrievedResponse = await dataFusionClient.PollOnceRestartInstanceAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Instance retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary> /// 重启实例 /// </summary> public static void RestartInstance(DdsClient client) { RestartInstanceRequest req = new RestartInstanceRequest { InstanceId = "95fafd4e2b864e48a5fa162b6bce4f75in02", Body = new RestartInstanceRequestBody() { // TargetType = "shard", TargetId = "95fafd4e2b864e48a5fa162b6bce4f75in02" } }; try { RestartInstanceResponse resp = client.RestartInstance(req); Console.WriteLine(resp.JobId); Console.WriteLine("Restart Instance Success!"); } catch (RequestTimeoutException requestTimeoutException) { Console.WriteLine(requestTimeoutException.ErrorMessage); } catch (ServiceResponseException clientRequestException) { Console.WriteLine(clientRequestException.HttpStatusCode); Console.WriteLine(clientRequestException.ErrorCode); Console.WriteLine(clientRequestException.ErrorMsg); } catch (ConnectionException connectionException) { Console.WriteLine(connectionException.ErrorMessage); } }
/// <summary>Snippet for RestartInstance</summary> public void RestartInstanceRequestObject() { // Snippet: RestartInstance(RestartInstanceRequest, CallSettings) // Create client DataFusionClient dataFusionClient = DataFusionClient.Create(); // Initialize request argument(s) RestartInstanceRequest request = new RestartInstanceRequest { InstanceName = InstanceName.FromProjectLocationInstance("[PROJECT]", "[LOCATION]", "[INSTANCE]"), }; // Make the request Operation <Instance, OperationMetadata> response = dataFusionClient.RestartInstance(request); // Poll until the returned long-running operation is complete Operation <Instance, OperationMetadata> completedResponse = response.PollUntilCompleted(); // Retrieve the operation result Instance 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 <Instance, OperationMetadata> retrievedResponse = dataFusionClient.PollOnceRestartInstance(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Instance retrievedResult = retrievedResponse.Result; } // End snippet }
/// <summary> /// 重启实例的数据库服务 /// </summary> public RestartInstanceResponse RestartInstance(RestartInstanceRequest restartInstanceRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("instance_id", restartInstanceRequest.InstanceId.ToString()); string urlPath = HttpUtils.AddUrlPath("/v3/{project_id}/instances/{instance_id}/restart", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json", restartInstanceRequest); SdkResponse response = DoHttpRequest("POST", request); return(JsonUtils.DeSerialize <RestartInstanceResponse>(response)); }
/// <summary> /// 重启ES集群实例(用于系统版本更新等操作) /// </summary> /// <param name="req"><see cref="RestartInstanceRequest"/></param> /// <returns><see cref="RestartInstanceResponse"/></returns> public RestartInstanceResponse RestartInstanceSync(RestartInstanceRequest req) { JsonResponseModel <RestartInstanceResponse> rsp = null; try { var strResp = this.InternalRequestSync(req, "RestartInstance"); rsp = JsonConvert.DeserializeObject <JsonResponseModel <RestartInstanceResponse> >(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return(rsp.Response); }
/// <summary> /// 重启实例 /// </summary> /// <param name="request">请求参数信息</param> /// <returns>请求结果信息</returns> public async Task <RestartInstanceResponse> RestartInstance(RestartInstanceRequest request) { return(await new RestartInstanceExecutor().Client(this).Execute <RestartInstanceResponse, RestartInstanceResult, RestartInstanceRequest>(request).ConfigureAwait(false)); }
/// <summary> /// 重启实例 /// </summary> /// <param name="request">请求参数信息</param> /// <returns>请求结果信息</returns> public RestartInstanceResponse RestartInstance(RestartInstanceRequest request) { return(new RestartInstanceExecutor().Client(this).Execute <RestartInstanceResponse, RestartInstanceResult, RestartInstanceRequest>(request)); }