Microsoft.Azure.Commands.DataFactories.SaveAzureDataFactoryLog.ExecuteCmdlet C# (CSharp) Method

ExecuteCmdlet() private method

private ExecuteCmdlet ( ) : void
return void
        public override void ExecuteCmdlet()
        {
            if (ParameterSetName == ByFactoryObject)
            {
                if (DataFactory == null)
                {
                    throw new PSArgumentNullException(string.Format(CultureInfo.InvariantCulture, Resources.DataFactoryArgumentInvalid));
                }

                DataFactoryName = DataFactory.DataFactoryName;
                ResourceGroupName = DataFactory.ResourceGroupName;
            }

            Uri runLogUri =
                DataFactoryClient.GetDataSliceRunLogsSharedAccessSignature(
                    ResourceGroupName, DataFactoryName, Id);
            if (DownloadLogs.IsPresent)
            {
                string directory = string.IsNullOrWhiteSpace(Output)
                    ? Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments)
                    : Output;

                if (!HaveWriteAccess(directory))
                {
                    throw new IOException(string.Format(CultureInfo.InvariantCulture, Resources.NoWriteAccessToDirectory, directory));
                }

                try
                {
                    DataFactoryClient.DownloadFileToBlob(new BlobDownloadParameters()
                    {
                        Directory = directory,
                        SasUri = runLogUri,
                    });
                }
                catch
                {
                    throw new Exception(string.Format(CultureInfo.InvariantCulture, Resources.DownloadFailed, directory));
                }

                WriteWarning(string.Format(CultureInfo.InvariantCulture, Resources.DownloadLogCompleted, directory));
            }

            WriteObject(new PSRunLogInfo(runLogUri));
        }
SaveAzureDataFactoryLog