protected override void ProcessRecord() { base.ProcessRecord(); var powershellAssembly = TypeFactory.GetTypeInfo(typeof(BaseCmdlet)).Assembly; using (var sw = new StringWriter()) { var powershellInfo = FileVersionInfo.GetVersionInfo(powershellAssembly.Location); sw.WriteLine(); sw.WriteLine(powershellInfo.ProductName); sw.WriteLine("Version {0}", powershellInfo.FileVersion); sw.WriteLine(powershellInfo.LegalCopyright); var sdkAssembly = TypeFactory.GetTypeInfo(typeof(AWSCredentials)).Assembly; var sdkInfo = FileVersionInfo.GetVersionInfo(sdkAssembly.Location); sw.WriteLine(); sw.WriteLine(sdkInfo.ProductName); sw.WriteLine("Core Runtime Version {0}", sdkInfo.FileVersion); sw.WriteLine(sdkInfo.LegalCopyright); sw.WriteLine(); sw.WriteLine("Release notes: {0}", "https://github.com/aws/aws-tools-for-powershell/blob/master/CHANGELOG.md"); sw.WriteLine(); // recognise 3rd party libraries sw.WriteLine("This software includes third party software subject to the following copyrights:"); sw.WriteLine("- Logging from log4net, Apache License"); sw.WriteLine("[http://logging.apache.org/log4net/license.html]"); WriteObject(sw.ToString()); } if (ListServiceVersionInfo.IsPresent) { var services = GetAWSServiceCmdlet.GetServices(); foreach (var service in services.OrderBy(service => service.Name)) { var result = new PSObject(); result.Properties.Add(new PSNoteProperty("Service", service.Description)); result.Properties.Add(new PSNoteProperty("Noun Prefix", service.CmdletNounPrefix)); #if MODULAR result.Properties.Add(new PSNoteProperty("Module Name", service.ModuleName)); #endif result.Properties.Add(new PSNoteProperty("SDK Assembly Version", service.SDKAssemblyVersion)); WriteObject(result); } } }
protected override void ProcessRecord() { base.ProcessRecord(); #pragma warning disable CS0618 //A class member was marked with the Obsolete attribute string awsCliServiceName = null; string awsCliOperationName = null; if (AwsCliCommand != null) { ParseAwsCliCommand(AwsCliCommand, out awsCliServiceName, out awsCliOperationName); if (string.IsNullOrEmpty(awsCliServiceName) || string.IsNullOrEmpty(awsCliOperationName)) { ThrowArgumentError("Unable to extract service and/or operation name from command. Expected text format of 'aws [options] <command> <subcommand>'.", this.AwsCliCommand); } WriteVerbose($"Searching for {awsCliOperationName} in service {awsCliServiceName}"); } #pragma warning restore CS0618 var services = GetAWSServiceCmdlet.GetFilteredServices(awsCliServiceName ?? Service); var results = new List <PSObject>(); Regex operationNameRegex = null; if (awsCliOperationName != null) { operationNameRegex = new Regex($"^{awsCliOperationName}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled); } if (ApiOperation != null) { operationNameRegex = new Regex(MatchWithRegex.IsPresent ? ApiOperation : $"^{ApiOperation}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled); } Regex cmdletNameRegex = null; if (CmdletName != null) { cmdletNameRegex = new Regex(MatchWithRegex.IsPresent ? CmdletName : $"^{CmdletName}$", RegexOptions.CultureInvariant | RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.Compiled); } foreach (var service in services) { var cmdlets = GetCmdlets(service); if (cmdletNameRegex != null) { cmdlets = cmdlets.Where(cmdlet => cmdletNameRegex.IsMatch(cmdlet.Name)); } if (operationNameRegex != null) { cmdlets = cmdlets.Where(cmdlet => cmdlet.Operations.Any(operation => operationNameRegex.IsMatch(operation))); } results.AddRange(cmdlets .OrderBy(cmdlet => cmdlet.Name) .Select(cmdlet => ConvertToPSObject(service, cmdlet))); } if (results.Any()) { WriteObject(results, true); } else { WriteVerbose("The specified parameters did not match any service."); } }