/// <summary> /// Deletes a multiplayer server game certificate. /// </summary> public static void DeleteCertificate(DeleteCertificateRequest request, Action <EmptyResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { var context = (request == null ? null : request.AuthenticationContext) ?? PlayFabSettings.staticPlayer; PlayFabHttp.MakeApiCall("/MultiplayerServer/DeleteCertificate", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context); }
private static void deleteCertificate(IoTDAClient client) { DeleteCertificateRequest req = new DeleteCertificateRequest { CertificateId = "9dc7eed5-00e7-4ef1-a1cc-9fb43ad1d767", InstanceId = "1a7ffc5c-d89c-44dd-8265-b1653d951ce0" }; try { var resp = client.DeleteCertificate(req); Console.WriteLine(resp.HttpStatusCode); } 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> /// Deletes a multiplayer server game certificate. /// </summary> public async Task <PlayFabResult <EmptyResponse> > DeleteCertificateAsync(DeleteCertificateRequest request, object customData = null, Dictionary <string, string> extraHeaders = null) { if (PlayFabSettings.EntityToken == null) { throw new PlayFabException(PlayFabExceptionCode.EntityTokenNotSet, "Must call GetEntityToken before calling this method"); } var httpResult = await PlayFabHttp.DoPost("/MultiplayerServer/DeleteCertificate", request, "X-EntityToken", PlayFabSettings.EntityToken, extraHeaders, apiSettings); if (httpResult is PlayFabError) { var error = (PlayFabError)httpResult; PlayFabSettings.GlobalErrorHandler?.Invoke(error); return(new PlayFabResult <EmptyResponse> { Error = error, CustomData = customData }); } var resultRawJson = (string)httpResult; var resultData = PluginManager.GetPlugin <ISerializerPlugin>(PluginContract.PlayFab_Serializer).DeserializeObject <PlayFabJsonSuccess <EmptyResponse> >(resultRawJson); var result = resultData.data; return(new PlayFabResult <EmptyResponse> { Result = result, CustomData = customData }); }
public async Task DeleteCertificate_InvalidFamilyName() { // arrange long uln = 1234567890; string lastname = "INVALID"; string standard = "1"; string certificateReference = "1234567890"; var expectedResponse = new ApiResponse { StatusCode = (int)HttpStatusCode.BadRequest, Message = "Cannot find apprentice with the specified Uln, FamilyName & Standard" }; _MockHttp.When(HttpMethod.Delete, $"{apiBaseAddress}/api/v1/certificate/{uln}/{lastname}/{standard}/{certificateReference}") .Respond(HttpStatusCode.BadRequest, "application/json", JsonConvert.SerializeObject(expectedResponse)); // act var request = new DeleteCertificateRequest { Uln = uln, FamilyName = lastname, Standard = standard, CertificateReference = certificateReference }; var actual = await _ApiClient.DeleteCertificate(request); // assert Assert.That(actual.Error, Is.Not.Null); Assert.That(actual.Error.StatusCode, Is.EqualTo(expectedResponse.StatusCode)); Assert.That(actual.Error.Message, Is.EqualTo(expectedResponse.Message)); }
public async Task Delete(DeleteCertificateRequest deleteCertificateRequest) { using (var httpRequest = new HttpRequestMessage(HttpMethod.Delete, "api/v1/certificates/DeleteCertificate")) { await PostPutRequest(httpRequest, deleteCertificateRequest); } }
/// <summary> /// Deletes an ACM Certificate and its associated private key. If this action succeeds, /// the certificate no longer appears in the list of ACM Certificates that can be displayed /// by calling the <a>ListCertificates</a> action or be retrieved by calling the <a>GetCertificate</a> /// action. The certificate will not be available for use by other AWS services. /// /// <note>You cannot delete an ACM Certificate that is being used by another AWS service. /// To delete a certificate that is in use, the certificate association must first be /// removed. </note> /// </summary> /// <param name="certificateArn"> String that contains the ARN of the ACM Certificate to be deleted. This must be of the form: <code>arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012</code> For more information about ARNs, see <a href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs) and AWS Service Namespaces</a>. </param> /// /// <returns>The response from the DeleteCertificate service method, as returned by CertificateManager.</returns> /// <exception cref="Amazon.CertificateManager.Model.InvalidArnException"> /// The requested Amazon Resource Name (ARN) does not refer to an existing resource. /// </exception> /// <exception cref="Amazon.CertificateManager.Model.ResourceInUseException"> /// The certificate is in use by another AWS service in the caller's account. Remove /// the association and try again. /// </exception> /// <exception cref="Amazon.CertificateManager.Model.ResourceNotFoundException"> /// The specified certificate cannot be found in the caller's account, or the caller's /// account cannot be found. /// </exception> public DeleteCertificateResponse DeleteCertificate(string certificateArn) { var request = new DeleteCertificateRequest(); request.CertificateArn = certificateArn; return(DeleteCertificate(request)); }
protected override void ProcessRecord() { base.ProcessRecord(); if (!ConfirmDelete("OCIWaasCertificate", "Remove")) { return; } DeleteCertificateRequest request; try { request = new DeleteCertificateRequest { CertificateId = CertificateId, OpcRequestId = OpcRequestId, OpcRetryToken = OpcRetryToken, IfMatch = IfMatch }; response = client.DeleteCertificate(request).GetAwaiter().GetResult(); WriteOutput(response); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
protected override void ProcessRecord() { base.ProcessRecord(); if (!ConfirmDelete("OCILoadbalancerCertificate", "Remove")) { return; } DeleteCertificateRequest request; try { request = new DeleteCertificateRequest { LoadBalancerId = LoadBalancerId, CertificateName = CertificateName, OpcRequestId = OpcRequestId }; response = client.DeleteCertificate(request).GetAwaiter().GetResult(); WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId)); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
/// <summary> /// Deletes the certificate with the given identifier. /// </summary> /// <param name="request">The request object containing the details to send. Required.</param> /// <param name="retryConfiguration">The retry configuration that will be used by to send this request. Optional.</param> /// <param name="cancellationToken">The cancellation token to cancel this operation. Optional.</param> /// <returns>A response object containing details about the completed operation</returns> /// <example>Click <a href="https://docs.cloud.oracle.com/en-us/iaas/tools/dot-net-examples/latest/apigateway/DeleteCertificate.cs.html">here</a> to see an example of how to use DeleteCertificate API.</example> public async Task <DeleteCertificateResponse> DeleteCertificate(DeleteCertificateRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { logger.Trace("Called deleteCertificate"); Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/certificates/{certificateId}".Trim('/'))); HttpMethod method = new HttpMethod("DELETE"); HttpRequestMessage requestMessage = Converter.ToHttpRequestMessage(uri, method, request); requestMessage.Headers.Add("Accept", "application/json"); GenericRetrier retryingClient = Retrier.GetPreferredRetrier(retryConfiguration, this.retryConfiguration); HttpResponseMessage responseMessage; try { if (retryingClient != null) { responseMessage = await retryingClient.MakeRetryingCall(this.restClient.HttpSend, requestMessage, cancellationToken).ConfigureAwait(false); } else { responseMessage = await this.restClient.HttpSend(requestMessage).ConfigureAwait(false); } this.restClient.CheckHttpResponseMessage(requestMessage, responseMessage); return(Converter.FromHttpResponseMessage <DeleteCertificateResponse>(responseMessage)); } catch (Exception e) { logger.Error($"DeleteCertificate failed with error: {e.Message}"); throw; } }
internal virtual DeleteCertificateResponse DeleteCertificate(DeleteCertificateRequest request) { var marshaller = new DeleteCertificateRequestMarshaller(); var unmarshaller = DeleteCertificateResponseUnmarshaller.Instance; return(Invoke <DeleteCertificateRequest, DeleteCertificateResponse>(request, marshaller, unmarshaller)); }
/// <summary> /// Deletes an ACM Certificate and its associated private key. If this action succeeds, /// the certificate no longer appears in the list of ACM Certificates that can be displayed /// by calling the <a>ListCertificates</a> action or be retrieved by calling the <a>GetCertificate</a> /// action. The certificate will not be available for use by other AWS services. /// /// <note> /// <para> /// You cannot delete an ACM Certificate that is being used by another AWS service. To /// delete a certificate that is in use, the certificate association must first be removed. /// </para> /// </note> /// </summary> /// <param name="certificateArn">String that contains the ARN of the ACM Certificate to be deleted. This must be of the form: <code>arn:aws:acm:region:123456789012:certificate/12345678-1234-1234-1234-123456789012</code> For more information about ARNs, see <a href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html">Amazon Resource Names (ARNs) and AWS Service Namespaces</a>.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// /// <returns>The response from the DeleteCertificate service method, as returned by CertificateManager.</returns> /// <exception cref="Amazon.CertificateManager.Model.InvalidArnException"> /// The requested Amazon Resource Name (ARN) does not refer to an existing resource. /// </exception> /// <exception cref="Amazon.CertificateManager.Model.ResourceInUseException"> /// The certificate is in use by another AWS service in the caller's account. Remove the /// association and try again. /// </exception> /// <exception cref="Amazon.CertificateManager.Model.ResourceNotFoundException"> /// The specified certificate cannot be found in the caller's account, or the caller's /// account cannot be found. /// </exception> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/acm-2015-12-08/DeleteCertificate">REST API Reference for DeleteCertificate Operation</seealso> public virtual Task <DeleteCertificateResponse> DeleteCertificateAsync(string certificateArn, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var request = new DeleteCertificateRequest(); request.CertificateArn = certificateArn; return(DeleteCertificateAsync(request, cancellationToken)); }
internal virtual DeleteCertificateResponse DeleteCertificate(DeleteCertificateRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteCertificateRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteCertificateResponseUnmarshaller.Instance; return Invoke<DeleteCertificateResponse>(request, options); }
/// <summary> /// Initiates the asynchronous execution of the DeleteCertificate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteCertificate 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/acm-2015-12-08/DeleteCertificate">REST API Reference for DeleteCertificate Operation</seealso> public virtual Task<DeleteCertificateResponse> DeleteCertificateAsync(DeleteCertificateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = DeleteCertificateRequestMarshaller.Instance; options.ResponseUnmarshaller = DeleteCertificateResponseUnmarshaller.Instance; return InvokeAsync<DeleteCertificateResponse>(request, options, cancellationToken); }
/// <summary> /// Initiates the asynchronous execution of the DeleteCertificate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteCertificate operation on AmazonCertificateManagerClient.</param> /// <param name="callback">An AsyncCallback delegate that is invoked when the operation completes.</param> /// <param name="state">A user-defined state object that is passed to the callback procedure. Retrieve this object from within the callback /// procedure using the AsyncState property.</param> /// /// <returns>An IAsyncResult that can be used to poll or wait for results, or both; this value is also needed when invoking EndDeleteCertificate /// operation.</returns> public IAsyncResult BeginDeleteCertificate(DeleteCertificateRequest request, AsyncCallback callback, object state) { var marshaller = new DeleteCertificateRequestMarshaller(); var unmarshaller = DeleteCertificateResponseUnmarshaller.Instance; return(BeginInvoke <DeleteCertificateRequest>(request, marshaller, unmarshaller, callback, state)); }
/// <summary> /// Initiates the asynchronous execution of the DeleteCertificate operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the DeleteCertificate 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/acm-2015-12-08/DeleteCertificate">REST API Reference for DeleteCertificate Operation</seealso> public virtual Task <DeleteCertificateResponse> DeleteCertificateAsync(DeleteCertificateRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = new DeleteCertificateRequestMarshaller(); var unmarshaller = DeleteCertificateResponseUnmarshaller.Instance; return(InvokeAsync <DeleteCertificateRequest, DeleteCertificateResponse>(request, marshaller, unmarshaller, cancellationToken)); }
/// <summary> /// Deletes info about certificate from token service. /// </summary> /// <param name="device"></param> /// <returns></returns> private async Task DeleteCertificate(Device device) { var deleteCertificateRequest = new DeleteCertificateRequest { Thumbprint = device.Thumbprint }; await this.usersDataProvider.DeleteCertificate(deleteCertificateRequest); }
/// <summary> /// Deletes a multiplayer server game certificate. /// </summary> public void DeleteCertificate(DeleteCertificateRequest request, Action <EmptyResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { var context = (request == null ? null : request.AuthenticationContext) ?? authenticationContext; var callSettings = apiSettings ?? PlayFabSettings.staticSettings; if (!context.IsEntityLoggedIn()) { throw new PlayFabException(PlayFabExceptionCode.NotLoggedIn, "Must be logged in to call this method"); } PlayFabHttp.MakeApiCall("/MultiplayerServer/DeleteCertificate", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders, context, callSettings, this); }
/// <summary> /// 删除证书 /// </summary> public DeleteCertificateResponse DeleteCertificate(DeleteCertificateRequest deleteCertificateRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("certificate_id", deleteCertificateRequest.CertificateId.ToString()); string urlPath = HttpUtils.AddUrlPath("/v3/{project_id}/elb/certificates/{certificate_id}", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json", deleteCertificateRequest); HttpResponseMessage response = DoHttpRequestSync("DELETE", request); return(JsonUtils.DeSerializeNull <DeleteCertificateResponse>(response)); }
public async Task <DeleteCertificateResponse> DeleteCertificate(DeleteCertificateRequest request) { var error = await Delete <ApiResponse>($"api/v1/certificate/{request.Uln}/{request.FamilyName}/{request.Standard}/{request.CertificateReference}"); return(new DeleteCertificateResponse { Uln = request.Uln, FamilyName = request.FamilyName, Standard = request.Standard, CertificateReference = request.CertificateReference, Error = error }); }
public async Task <IActionResult> Delete([FromBody] DeleteCertificateRequest deleteCertificateRequest) { try { await _mediator.Send(deleteCertificateRequest); } catch (NotFound) { throw new ResourceNotFoundException(); } return(Ok()); }
/// <summary> /// 删除设备CA证书 /// </summary> public async Task <DeleteCertificateResponse> DeleteCertificateAsync(DeleteCertificateRequest deleteCertificateRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("certificate_id", deleteCertificateRequest.CertificateId.ToString()); string urlPath = HttpUtils.AddUrlPath("/v5/iot/{project_id}/certificates/{certificate_id}", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, deleteCertificateRequest); HttpResponseMessage response = await DoHttpRequestAsync("DELETE", request); DeleteCertificateResponse deleteCertificateResponse = JsonUtils.DeSerializeNull <DeleteCertificateResponse>(response); return(deleteCertificateResponse); }
/// <summary> /// 本接口(DeleteCertificate)用于删除证书。 /// </summary> /// <param name="req"><see cref="DeleteCertificateRequest"/></param> /// <returns><see cref="DeleteCertificateResponse"/></returns> public DeleteCertificateResponse DeleteCertificateSync(DeleteCertificateRequest req) { JsonResponseModel<DeleteCertificateResponse> rsp = null; try { var strResp = this.InternalRequestSync(req, "DeleteCertificate"); rsp = JsonConvert.DeserializeObject<JsonResponseModel<DeleteCertificateResponse>>(strResp); } catch (JsonSerializationException e) { throw new TencentCloudSDKException(e.Message); } return rsp.Response; }
public void Arrange() { _certificateRepository = new Mock <ICertificateRepository>(); _certificateRepository.Setup(c => c.Delete(It.IsAny <long>(), It.IsAny <int>(), It.IsAny <string>(), CertificateActions.Delete, true, It.IsAny <string>(), It.IsAny <string>())) .Returns(() => Task.Run(() => { })).Verifiable(); _deleteCertificateHandler = new DeleteCertificateHandler(_certificateRepository.Object); _deleteCertificateRequest = new DeleteCertificateRequest { Uln = 1111111111, StandardCode = 30, UserName = "******", ReasonForChange = "Reason for Change", IncidentNumber = "12345" }; }
public async Task DeleteCertificate() { // arrange long uln = 1234567890; string lastname = "Bloggs"; string standard = "1"; string certificateReference = "123456790"; _MockHttp.When(HttpMethod.Delete, $"{apiBaseAddress}/api/v1/certificate/{uln}/{lastname}/{standard}/{certificateReference}") .Respond(HttpStatusCode.OK, "application/json", string.Empty); // act var request = new DeleteCertificateRequest { Uln = uln, FamilyName = lastname, Standard = standard, CertificateReference = certificateReference }; var actual = await _ApiClient.DeleteCertificate(request); // assert Assert.That(actual.Error, Is.Null); }
public async Task DeleteCertificateExample() { long uln = 1234567890; string lastName = "Blogs"; string standard = "1"; string certificateReference = "00012001"; DeleteCertificateRequest certificateToDelete = new DeleteCertificateRequest { Uln = uln, FamilyName = lastName, Standard = standard, CertificateReference = certificateReference }; if (certificateToDelete.IsValid(out _)) { // NOTE: The External API performs validation, however it is a good idea to check beforehand await _CertificateApiClient.DeleteCertificate(certificateToDelete); } }
public async Task <IActionResult> SuccessfulDelete(CertificateConfirmDeleteViewModel deleteViewModel) { try { var request = new DeleteCertificateRequest { ReasonForChange = deleteViewModel.ReasonForChange, IncidentNumber = deleteViewModel.IncidentNumber, StandardCode = deleteViewModel.StandardCode, Uln = deleteViewModel.Uln, Username = deleteViewModel.Username }; await _certificateApiClient.Delete(request); return(View("SuccessfullDeletion", deleteViewModel)); } catch (Exception exception) { _logger.LogError($"Could not delete certificate with certificateId:{deleteViewModel.Id}." + $"Exception message:{exception.Message}"); throw new HttpRequestException(); } }
/// <summary> /// Deletes a multiplayer server game certificate. /// </summary> public static void DeleteCertificate(DeleteCertificateRequest request, Action <EmptyResponse> resultCallback, Action <PlayFabError> errorCallback, object customData = null, Dictionary <string, string> extraHeaders = null) { PlayFabHttp.MakeApiCall("/MultiplayerServer/DeleteCertificate", request, AuthType.EntityToken, resultCallback, errorCallback, customData, extraHeaders); }
/// <summary> /// Save info about patient device certificate /// in token service. /// </summary> /// <returns></returns> public async Task DeleteCertificate(DeleteCertificateRequest request) { var url = string.Format("api/certificates/{0}", request.Thumbprint); await _apiClient.SendRequestAsync(url, request, Method.DELETE, null); }