/// <summary>Snippet for DeleteService</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void DeleteServiceRequestObject() { // Create client ServicesClient servicesClient = ServicesClient.Create(); // Initialize request argument(s) DeleteServiceRequest request = new DeleteServiceRequest { Name = "", }; // Make the request Operation <Empty, OperationMetadataV1> response = servicesClient.DeleteService(request); // Poll until the returned long-running operation is complete Operation <Empty, OperationMetadataV1> 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, OperationMetadataV1> retrievedResponse = servicesClient.PollOnceDeleteService(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; } }
private void Delete(IWebClient client) { var request = new DeleteServiceRequest { ServiceId = _serviceId }; try { var response = client.GetResponse(request); Console.WriteLine("==========================Result=========================="); Console.WriteLine("Response: \r\n{0}", response.ResponseJsonString); Console.WriteLine("==========================Result=========================="); } catch (ServerException ex) { Console.WriteLine("ServerException happened: \r\n\tErrorCode: {0}\r\n\tErrorMessage: {1}", ex.ErrorCode, ex.ErrorMessage); } catch (ClientException ex) { Console.WriteLine("ClientException happened: \r\n\tRequestId: {0}\r\n\tErrorCode: {1}\r\n\tErrorMessage: {2}", ex.RequestId, ex.ErrorCode, ex.ErrorMessage); } catch (Exception ex) { Console.WriteLine("Unknown Exception happened: {0}\r\n{1}", ex.Message, ex.StackTrace); } }
public bool DeleteService(DeleteServiceRequest request) { var conn = GetConnection(ConnectionNames.CSPSqlDatabase); var commandWrapper = GetStoredProcCommand("dbo.Delete_Service", conn); AddInParameter(commandWrapper, "@ServiceId", DbType.Int16, request.ServiceId); AddInParameter(commandWrapper, "@ERROR", DbType.String, 1000); AddInParameter(commandWrapper, "@ERROR_CODE", DbType.String, 4); try { conn.Open(); int results = commandWrapper.ExecuteNonQuery(); var isProcedureSucced = Convert.ToBoolean(results); MakeDboLog(request.ToString(), isProcedureSucced.ToString(), "dbo.Delete_Service"); var errorObject = GetParameterValue(commandWrapper, "@ERROR"); var errorCodeObject = GetParameterValue(commandWrapper, "@ERROR_CODE"); return(Convert.ToBoolean(results)); } finally { commandWrapper.Dispose(); conn.Close(); } }
public DeleteServiceResponse DeleteService(DeleteServiceRequest request) { var response = new DeleteServiceResponse { ResponseStatus = ResponseStatus.Success }; var settingsProvider = new SettingsProvider(); try { if (request.ActionType == ActionType.Delete) { response.isSuccessful = settingsProvider.DeleteService(request); } else { response.ResponseStatus = ResponseStatus.Failure; response.ResponseDescription = "Not update action"; } } catch (Exception ex) { response.ResponseStatus = ResponseStatus.Failure; response.ResponseDescription = ex.Message; } return(response); }
internal DeleteServiceResponse DeleteService(DeleteServiceRequest request) { var marshaller = new DeleteServiceRequestMarshaller(); var unmarshaller = DeleteServiceResponseUnmarshaller.Instance; return(Invoke <DeleteServiceRequest, DeleteServiceResponse>(request, marshaller, unmarshaller)); }
/// <summary>Snippet for DeleteServiceAsync</summary> public async Task DeleteServiceRequestObjectAsync() { // Snippet: DeleteServiceAsync(DeleteServiceRequest, CallSettings) // Additional: DeleteServiceAsync(DeleteServiceRequest, CancellationToken) // Create client ServicesClient servicesClient = await ServicesClient.CreateAsync(); // Initialize request argument(s) DeleteServiceRequest request = new DeleteServiceRequest { Name = "", }; // Make the request Operation <Empty, OperationMetadataV1> response = await servicesClient.DeleteServiceAsync(request); // Poll until the returned long-running operation is complete Operation <Empty, OperationMetadataV1> 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, OperationMetadataV1> retrievedResponse = await servicesClient.PollOnceDeleteServiceAsync(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 }
/// <summary> /// Initiates the asynchronous execution of the DeleteService operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteService operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> public Task <DeleteServiceResponse> DeleteServiceAsync(DeleteServiceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteServiceRequestMarshaller(); var unmarshaller = DeleteServiceResponseUnmarshaller.Instance; return(InvokeAsync <DeleteServiceRequest, DeleteServiceResponse>(request, marshaller, unmarshaller, cancellationToken)); }
internal virtual DeleteServiceResponse DeleteService(DeleteServiceRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteServiceRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteServiceResponseUnmarshaller.Instance; return(Invoke <DeleteServiceResponse>(request, options)); }
/// <summary> /// Initiates the asynchronous execution of the DeleteService operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteService operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/servicediscovery-2017-03-14/DeleteService">REST API Reference for DeleteService Operation</seealso> public virtual Task <DeleteServiceResponse> DeleteServiceAsync(DeleteServiceRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteServiceRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteServiceResponseUnmarshaller.Instance; return(InvokeAsync <DeleteServiceResponse>(request, options, cancellationToken)); }
public DeleteServiceRequest GetDeleteServiceRequest(int serviceId) { var request = new DeleteServiceRequest() { ActionType = Requests.ActionType.Delete, ServiceId = serviceId }; return(request); }
private async Task DeleteService() { _context.Logger.WriteLine("DeleteService"); var request = new DeleteServiceRequest { Cluster = _cluster.Name, Service = _task.Name }; await _client.DeleteServiceAsync(request); }
/// <summary>Snippet for DeleteService</summary> public void DeleteService_RequestObject() { // Snippet: DeleteService(DeleteServiceRequest,CallSettings) // Create client ServiceMonitoringServiceClient serviceMonitoringServiceClient = ServiceMonitoringServiceClient.Create(); // Initialize request argument(s) DeleteServiceRequest request = new DeleteServiceRequest { ServiceName = new ServiceName("[PROJECT]", "[SERVICE]"), }; // Make the request serviceMonitoringServiceClient.DeleteService(request); // End snippet }
/// <summary> /// 删除服务 /// </summary> /// <param name="req"><see cref="DeleteServiceRequest"/></param> /// <returns><see cref="DeleteServiceResponse"/></returns> public DeleteServiceResponse DeleteServiceSync(DeleteServiceRequest req) { JsonResponseModel <DeleteServiceResponse> rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteService"); rsp = JsonConvert.DeserializeObject <JsonResponseModel <DeleteServiceResponse> >(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return(rsp.Response); }
public void DeleteService2() { Mock <ServiceMonitoringService.ServiceMonitoringServiceClient> mockGrpcClient = new Mock <ServiceMonitoringService.ServiceMonitoringServiceClient>(MockBehavior.Strict); DeleteServiceRequest request = new DeleteServiceRequest { ServiceName = new ServiceName("[PROJECT]", "[SERVICE]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteService(request, It.IsAny <CallOptions>())) .Returns(expectedResponse); ServiceMonitoringServiceClient client = new ServiceMonitoringServiceClientImpl(mockGrpcClient.Object, null); client.DeleteService(request); mockGrpcClient.VerifyAll(); }
public async Task DeleteServiceAsync2() { Mock <ServiceMonitoringService.ServiceMonitoringServiceClient> mockGrpcClient = new Mock <ServiceMonitoringService.ServiceMonitoringServiceClient>(MockBehavior.Strict); DeleteServiceRequest request = new DeleteServiceRequest { ServiceName = new ServiceName("[PROJECT]", "[SERVICE]"), }; Empty expectedResponse = new Empty(); mockGrpcClient.Setup(x => x.DeleteServiceAsync(request, It.IsAny <CallOptions>())) .Returns(new Grpc.Core.AsyncUnaryCall <Empty>(Task.FromResult(expectedResponse), null, null, null, null)); ServiceMonitoringServiceClient client = new ServiceMonitoringServiceClientImpl(mockGrpcClient.Object, null); await client.DeleteServiceAsync(request); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for DeleteServiceAsync</summary> public async Task DeleteServiceAsync_RequestObject() { // Snippet: DeleteServiceAsync(DeleteServiceRequest,CallSettings) // Additional: DeleteServiceAsync(DeleteServiceRequest,CancellationToken) // Create client ServiceMonitoringServiceClient serviceMonitoringServiceClient = await ServiceMonitoringServiceClient.CreateAsync(); // Initialize request argument(s) DeleteServiceRequest request = new DeleteServiceRequest { ServiceName = new ServiceName("[PROJECT]", "[SERVICE]"), }; // Make the request await serviceMonitoringServiceClient.DeleteServiceAsync(request); // End snippet }
/// <summary> /// Deletes the service. /// </summary> /// <returns>The service.</returns> /// <param name="deleteServiceRequest">Delete service request.</param> public DeleteServiceResponse DeleteService(DeleteServiceRequest deleteServiceRequest) { return(this.DoRequestCommon <DeleteServiceResponse>(deleteServiceRequest.GenHttpRequest(Config))); }
/// <summary> /// Deletes the specified service and all enclosed versions. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override async stt::Task <lro::Operation <wkt::Empty, OperationMetadataV1> > DeleteServiceAsync(DeleteServiceRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_DeleteServiceRequest(ref request, ref callSettings); return(new lro::Operation <wkt::Empty, OperationMetadataV1>(await _callDeleteService.Async(request, callSettings).ConfigureAwait(false), DeleteServiceOperationsClient)); }
/// <summary> /// Deletes the specified service and all enclosed versions. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public override lro::Operation <wkt::Empty, OperationMetadataV1> DeleteService(DeleteServiceRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_DeleteServiceRequest(ref request, ref callSettings); return(new lro::Operation <wkt::Empty, OperationMetadataV1>(_callDeleteService.Sync(request, callSettings), DeleteServiceOperationsClient)); }
partial void Modify_DeleteServiceRequest(ref DeleteServiceRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Deletes the specified service and all enclosed versions. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <lro::Operation <wkt::Empty, OperationMetadataV1> > DeleteServiceAsync(DeleteServiceRequest request, st::CancellationToken cancellationToken) => DeleteServiceAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Deletes the specified service and all enclosed versions. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <lro::Operation <wkt::Empty, OperationMetadataV1> > DeleteServiceAsync(DeleteServiceRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();