C# Class Microsoft.WindowsAzure.Commands.Utilities.Common.AzurePSCmdlet

Represents base class for all Azure cmdlets.
Inheritance: System.Management.Automation.PSCmdlet, IDisposable
Show file Open project: Azure/azure-powershell Class Usage Examples

Protected Properties

Property Type Description
_adalListener Microsoft.WindowsAzure.Commands.Common.DebugStreamTraceListener
_clientRequestId string
_dataCollectionProfile Microsoft.WindowsAzure.Commands.Common.AzurePSDataCollectionProfile
_errorRecordFolderPath string
_metricHelper Microsoft.WindowsAzure.Commands.Common.MetricHelper
_qosEvent AzurePSQoSEvent
_sessionId string

Public Methods

Method Description
AzurePSCmdlet ( ) : Microsoft.ApplicationInsights

Initializes AzurePSCmdlet properties.

Dispose ( ) : void
ExecuteCmdlet ( ) : void
IsDataCollectionAllowed ( ) : bool

Check whether the data collection is opted in from user

Protected Methods

Method Description
BeginProcessing ( ) : void

Cmdlet begin process. Write to logs, setup Http Tracing and initialize profile

CheckIfInteractive ( ) : bool
ConfirmAction ( bool force, string continueMessage, string processMessage, string target, System.Action action ) : void

Guards execution of the given action using ShouldProcess and ShouldContinue. This is a legacy version forcompatibility with older RDFE cmdlets.

ConfirmAction ( bool force, string continueMessage, string processMessage, string target, System.Action action, Func useShouldContinue ) : void

Guards execution of the given action using ShouldProcess and ShouldContinue. The optional useSHouldContinue predicate determines whether SHouldContinue should be called for this particular action (e.g. a resource is being overwritten). By default, both ShouldProcess and ShouldContinue will be executed. Cmdlets that use this method overload must have a force parameter.

ConfirmAction ( string processMessage, string target, System.Action action ) : void

Prompt for confirmation depending on the ConfirmLevel. By default No confirmation prompt occurs unless ConfirmLevel >= $ConfirmPreference. Guarding the actions of a cmdlet with this method will enable the cmdlet to support -WhatIf and -Confirm parameters.

ConstructPSObject ( string typeName ) : System.Management.Automation.PSObject
CurrentPath ( ) : string
Dispose ( bool disposing ) : void
EndProcessing ( ) : void

Perform end of pipeline processing.

GetDataCollectionProfile ( ) : AzurePSDataCollectionProfile

Get the data collection profile

InitializeDataCollectionProfile ( ) : void

Initialize the data collection profile

InitializeQosEvent ( ) : void
IsVerbose ( ) : bool
LogCmdletEndInvocationInfo ( ) : void
LogCmdletStartInvocationInfo ( ) : void
LogQosEvent ( ) : void

Invoke this method when the cmdlet is completed or terminated.

ProcessRecord ( ) : void
PromptForDataCollectionProfileIfNotExists ( ) : void

Prompt for the current data collection profile

SafeWriteOutputPSObject ( string typeName ) : void
SaveDataCollectionProfile ( ) : void

Save the current data collection profile JSON data into the default file path

SetupDebuggingTraces ( ) : void
SetupHttpClientPipeline ( ) : void
TearDownDebuggingTraces ( ) : void
TearDownHttpClientPipeline ( ) : void
ThrowTerminatingError ( ErrorRecord errorRecord ) : void
WriteCommandDetail ( string text ) : void
WriteDebug ( string text ) : void
WriteDebugWithTimestamp ( string message ) : void
WriteError ( ErrorRecord errorRecord ) : void
WriteErrorWithTimestamp ( string message ) : void
WriteExceptionError ( Exception ex ) : void

Write an error message for a given exception.

WriteObject ( object sendToPipeline ) : void
WriteObject ( object sendToPipeline, bool enumerateCollection ) : void
WriteProgress ( System.Management.Automation.ProgressRecord progressRecord ) : void
WriteVerbose ( string text ) : void
WriteVerboseWithTimestamp ( string message ) : void
WriteWarning ( string text ) : void
WriteWarningWithTimestamp ( string message ) : void

Private Methods

Method Description
FlushDebugMessages ( bool record = false ) : void
RecordDebugMessages ( ) : void

Method Details

AzurePSCmdlet() public method

Initializes AzurePSCmdlet properties.
public AzurePSCmdlet ( ) : Microsoft.ApplicationInsights
return Microsoft.ApplicationInsights

BeginProcessing() protected method

Cmdlet begin process. Write to logs, setup Http Tracing and initialize profile
protected BeginProcessing ( ) : void
return void

CheckIfInteractive() protected method

protected CheckIfInteractive ( ) : bool
return bool

ConfirmAction() protected method

Guards execution of the given action using ShouldProcess and ShouldContinue. This is a legacy version forcompatibility with older RDFE cmdlets.
protected ConfirmAction ( bool force, string continueMessage, string processMessage, string target, System.Action action ) : void
force bool Do not ask for confirmation
continueMessage string Message to describe the action
processMessage string Message to prompt after the active is performed.
target string The target name.
action System.Action The action code
return void

ConfirmAction() protected method

Guards execution of the given action using ShouldProcess and ShouldContinue. The optional useSHouldContinue predicate determines whether SHouldContinue should be called for this particular action (e.g. a resource is being overwritten). By default, both ShouldProcess and ShouldContinue will be executed. Cmdlets that use this method overload must have a force parameter.
protected ConfirmAction ( bool force, string continueMessage, string processMessage, string target, System.Action action, Func useShouldContinue ) : void
force bool Do not ask for confirmation
continueMessage string Message to describe the action
processMessage string Message to prompt after the active is performed.
target string The target name.
action System.Action The action code
useShouldContinue Func A predicate indicating whether ShouldContinue should be invoked for thsi action
return void

ConfirmAction() protected method

Prompt for confirmation depending on the ConfirmLevel. By default No confirmation prompt occurs unless ConfirmLevel >= $ConfirmPreference. Guarding the actions of a cmdlet with this method will enable the cmdlet to support -WhatIf and -Confirm parameters.
protected ConfirmAction ( string processMessage, string target, System.Action action ) : void
processMessage string The change being made to the resource
target string The resource that is being changed
action System.Action The action to perform if confirmed
return void

ConstructPSObject() protected method

protected ConstructPSObject ( string typeName ) : System.Management.Automation.PSObject
typeName string
return System.Management.Automation.PSObject

CurrentPath() protected method

protected CurrentPath ( ) : string
return string

Dispose() public method

public Dispose ( ) : void
return void

Dispose() protected method

protected Dispose ( bool disposing ) : void
disposing bool
return void

EndProcessing() protected method

Perform end of pipeline processing.
protected EndProcessing ( ) : void
return void

ExecuteCmdlet() public method

public ExecuteCmdlet ( ) : void
return void

GetDataCollectionProfile() protected static method

Get the data collection profile
protected static GetDataCollectionProfile ( ) : AzurePSDataCollectionProfile
return Microsoft.WindowsAzure.Commands.Common.AzurePSDataCollectionProfile

InitializeDataCollectionProfile() protected static method

Initialize the data collection profile
protected static InitializeDataCollectionProfile ( ) : void
return void

InitializeQosEvent() protected abstract method

protected abstract InitializeQosEvent ( ) : void
return void

IsDataCollectionAllowed() public static method

Check whether the data collection is opted in from user
public static IsDataCollectionAllowed ( ) : bool
return bool

IsVerbose() protected method

protected IsVerbose ( ) : bool
return bool

LogCmdletEndInvocationInfo() protected method

protected LogCmdletEndInvocationInfo ( ) : void
return void

LogCmdletStartInvocationInfo() protected method

protected LogCmdletStartInvocationInfo ( ) : void
return void

LogQosEvent() protected method

Invoke this method when the cmdlet is completed or terminated.
protected LogQosEvent ( ) : void
return void

ProcessRecord() protected method

protected ProcessRecord ( ) : void
return void

PromptForDataCollectionProfileIfNotExists() protected abstract method

Prompt for the current data collection profile
protected abstract PromptForDataCollectionProfileIfNotExists ( ) : void
return void

SafeWriteOutputPSObject() protected method

protected SafeWriteOutputPSObject ( string typeName ) : void
typeName string
return void

SaveDataCollectionProfile() protected abstract method

Save the current data collection profile JSON data into the default file path
protected abstract SaveDataCollectionProfile ( ) : void
return void

SetupDebuggingTraces() protected method

protected SetupDebuggingTraces ( ) : void
return void

SetupHttpClientPipeline() protected method

protected SetupHttpClientPipeline ( ) : void
return void

TearDownDebuggingTraces() protected method

protected TearDownDebuggingTraces ( ) : void
return void

TearDownHttpClientPipeline() protected method

protected TearDownHttpClientPipeline ( ) : void
return void

ThrowTerminatingError() protected method

protected ThrowTerminatingError ( ErrorRecord errorRecord ) : void
errorRecord System.Management.Automation.ErrorRecord
return void

WriteCommandDetail() protected method

protected WriteCommandDetail ( string text ) : void
text string
return void

WriteDebug() protected method

protected WriteDebug ( string text ) : void
text string
return void

WriteDebugWithTimestamp() protected method

protected WriteDebugWithTimestamp ( string message ) : void
message string
return void

WriteError() protected method

protected WriteError ( ErrorRecord errorRecord ) : void
errorRecord System.Management.Automation.ErrorRecord
return void

WriteErrorWithTimestamp() protected method

protected WriteErrorWithTimestamp ( string message ) : void
message string
return void

WriteExceptionError() protected method

Write an error message for a given exception.
protected WriteExceptionError ( Exception ex ) : void
ex System.Exception The exception resulting from the error.
return void

WriteObject() protected method

protected WriteObject ( object sendToPipeline ) : void
sendToPipeline object
return void

WriteObject() protected method

protected WriteObject ( object sendToPipeline, bool enumerateCollection ) : void
sendToPipeline object
enumerateCollection bool
return void

WriteProgress() protected method

protected WriteProgress ( System.Management.Automation.ProgressRecord progressRecord ) : void
progressRecord System.Management.Automation.ProgressRecord
return void

WriteVerbose() protected method

protected WriteVerbose ( string text ) : void
text string
return void

WriteVerboseWithTimestamp() protected method

protected WriteVerboseWithTimestamp ( string message ) : void
message string
return void

WriteWarning() protected method

protected WriteWarning ( string text ) : void
text string
return void

WriteWarningWithTimestamp() protected method

protected WriteWarningWithTimestamp ( string message ) : void
message string
return void

Property Details

_adalListener protected property

protected DebugStreamTraceListener,Microsoft.WindowsAzure.Commands.Common _adalListener
return Microsoft.WindowsAzure.Commands.Common.DebugStreamTraceListener

_clientRequestId protected property

protected string _clientRequestId
return string

_dataCollectionProfile protected static property

protected static AzurePSDataCollectionProfile,Microsoft.WindowsAzure.Commands.Common _dataCollectionProfile
return Microsoft.WindowsAzure.Commands.Common.AzurePSDataCollectionProfile

_errorRecordFolderPath protected static property

protected static string _errorRecordFolderPath
return string

_metricHelper protected property

protected MetricHelper,Microsoft.WindowsAzure.Commands.Common _metricHelper
return Microsoft.WindowsAzure.Commands.Common.MetricHelper

_qosEvent protected property

protected AzurePSQoSEvent _qosEvent
return AzurePSQoSEvent

_sessionId protected static property

protected static string _sessionId
return string