/// <summary> /// Terminate the link. /// </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/tenantmanagercontrolplane/DeleteLink.cs.html">here</a> to see an example of how to use DeleteLink API.</example> public async Task <DeleteLinkResponse> DeleteLink(DeleteLinkRequest request, RetryConfiguration retryConfiguration = null, CancellationToken cancellationToken = default) { logger.Trace("Called deleteLink"); Uri uri = new Uri(this.restClient.GetEndpoint(), System.IO.Path.Combine(basePathWithoutHost, "/links/{linkId}".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 <DeleteLinkResponse>(responseMessage)); } catch (Exception e) { logger.Error($"DeleteLink failed with error: {e.Message}"); throw; } }
protected override void ProcessRecord() { base.ProcessRecord(); if (!ConfirmDelete("OCITenantmanagercontrolplaneLink", "Remove")) { return; } DeleteLinkRequest request; try { request = new DeleteLinkRequest { LinkId = LinkId, IfMatch = IfMatch, OpcRequestId = OpcRequestId }; response = client.DeleteLink(request).GetAwaiter().GetResult(); WriteOutput(response, CreateWorkRequestObject(response.OpcWorkRequestId)); FinishProcessing(response); } catch (Exception ex) { TerminatingErrorDuringExecution(ex); } }
public IActionResult DeleteLink([FromBody] DeleteLinkRequest deleteLinkRequest) { var linksJsonData = System.IO.File.ReadAllText(linksFilePath); var linksData = JsonConvert.DeserializeObject <List <GroupItem> >(linksJsonData); var group = linksData.FirstOrDefault(g => g.GroupId == deleteLinkRequest.GroupId); group.Links.RemoveAll(l => l.LinkId == deleteLinkRequest.LinkId); SaveLinkData(linksData); return(Ok()); }
public void DeleteLink(DeleteLinkRequest request) { _logger.Debug($"Deleting link between {request.SourceCode} and {request.TargetCode}."); DoWithErrorHandling(() => { if (request.IsRelation) { _catalogImporter.DeleteRelation(request.SourceCode, request.TargetCode); } else { _catalogImporter.DeleteAssociation(request.SourceCode, request.TargetCode); } } ); }
public void Delete(DeleteLinkRequest request) { Repository.Delete(request.Id.ToEnumerable()); }