public async Task CreateComponentTokenToThisNode(CreateComponentTokenDetails createComponentTokenDetails) { if (_tenantRepository.GetComponentToken(createComponentTokenDetails.Tenant, createComponentTokenDetails.Product, createComponentTokenDetails.Component, createComponentTokenDetails.Token.Token) == null) { _componentApiService.AddComponentToken(createComponentTokenDetails.Tenant, createComponentTokenDetails.Product, createComponentTokenDetails.Component, createComponentTokenDetails.Token, false); } // send to other nodes.... await _storageHubService.SendCreateComponentTokenStorage(createComponentTokenDetails); }
public ActionResult <Component> PostComponentToken(string tenantName, string productName, string componentName, [FromBody] ComponentToken componentToken) { var isFromCli = HttpContext.Request.Headers["x-called-by"].ToString(); if (isFromCli != "") { _logger.LogInformation($"{isFromCli} POST '{HttpContext.Request.Path}' is called"); } else { _logger.LogInformation($"POST '{HttpContext.Request.Path}' is called"); } var token = _componentService.AddComponentToken(tenantName, productName, componentName, componentToken); if (token == null) { return(BadRequest("Something went wrong, try to create Token one more time")); } return(Ok($"Token '{token}' has been created for component '{componentName}'")); }