/// <summary>
 /// Delete a function and all it's artifacts.
 /// </summary>
 /// <param name="function">Function to be deleted</param>
 /// <returns>(success, errorMessage)</returns>
 public (bool, string) TryDeleteFunction(FunctionMetadataResponse function)
 {
     try
     {
         FileUtility.DeleteDirectoryContentsSafe(function.GetFunctionPath(_config));
         DeleteFunctionArtifacts(function);
         return(true, string.Empty);
     }
     catch (Exception e)
     {
         return(false, e.ToString());
     }
 }
예제 #2
0
        /// <summary>
        /// Delete a function and all it's artifacts.
        /// </summary>
        /// <param name="function">Function to be deleted</param>
        /// <returns>(success, errorMessage)</returns>
        public (bool, string) TryDeleteFunction(FunctionMetadataResponse function)
        {
            try
            {
                var functionPath = function.GetFunctionPath(_hostOptions);
                if (!string.IsNullOrEmpty(functionPath))
                {
                    FileUtility.DeleteDirectoryContentsSafe(functionPath);
                }

                DeleteFunctionArtifacts(function);
                return(true, string.Empty);
            }
            catch (Exception e)
            {
                return(false, e.ToString());
            }
        }
예제 #3
0
        /// <summary>
        /// Delete a function and all it's artifacts.
        /// </summary>
        /// <param name="function">Function to be deleted</param>
        /// <returns>(success, errorMessage)</returns>
        public (bool, string) TryDeleteFunction(FunctionMetadataResponse function)
        {
            try
            {
                var hostOptions  = _applicationHostOptions.CurrentValue.ToHostOptions();
                var functionPath = function.GetFunctionPath(hostOptions);
                if (!string.IsNullOrEmpty(functionPath))
                {
                    FileUtility.DeleteDirectoryContentsSafe(functionPath);
                }

                DeleteFunctionArtifacts(function);

                _functionsSyncManager.TrySyncTriggersAsync();

                return(true, string.Empty);
            }
            catch (Exception e)
            {
                return(false, e.ToString());
            }
        }