Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion src/Common/CustomAttributes/CmdletDeprecationAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,22 +28,34 @@ public class CmdletDeprecationAttribute : GenericBreakingChangeAttribute
{
public string ReplacementCmdletName { get; set; }

[Obsolete("Please provide the deprecate version", false)]
[Obsolete("Please provide the deprecate Az version and module version")]
public CmdletDeprecationAttribute() :
base(string.Empty)
{
}

[Obsolete("Please provide the deprecate Az version and module version")]
public CmdletDeprecationAttribute(string deprecateByVersione) :
base(string.Empty, deprecateByVersione)
{
}

[Obsolete("Please provide the deprecate Az version and module version")]
public CmdletDeprecationAttribute(string deprecateByVersion, string changeInEfectByDate) :
base(string.Empty, deprecateByVersion, changeInEfectByDate)
{
}

public CmdletDeprecationAttribute(Version deprecateByAzVersion, Version deprecateByVersion) :
base(string.Empty, deprecateByAzVersion, deprecateByVersion)
{
}

public CmdletDeprecationAttribute(Version deprecateByAzVersion, Version deprecateByVersion, string changeInEfectByDate) :
base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate)
{
}

protected override string GetAttributeSpecificMessage()
{
if (string.IsNullOrWhiteSpace(ReplacementCmdletName))
Expand Down
18 changes: 16 additions & 2 deletions src/Common/CustomAttributes/CmdletOutputBreakingChangeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,24 +36,38 @@ public class CmdletOutputBreakingChangeAttribute : GenericBreakingChangeAttribut

public string[] NewOutputProperties { get; set; }

[Obsolete("Please provide the deprecate version", false)]
[Obsolete("Please provide the deprecate Az version and module version")]
public CmdletOutputBreakingChangeAttribute(Type deprecatedCmdletOutputTypeName) :
base(string.Empty)
{
this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputTypeName;
}


[Obsolete("Please provide the deprecate Az version and module version")]
public CmdletOutputBreakingChangeAttribute(Type deprecatedCmdletOutputTypeName, string deprecateByVersion) :
base(string.Empty, deprecateByVersion)
{
this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputTypeName;
}

[Obsolete("Please provide the deprecate Az version and module version")]
public CmdletOutputBreakingChangeAttribute(Type deprecatedCmdletOutputTypeName, string deprecateByVersion, string changeInEfectByDate) :
base(string.Empty, deprecateByVersion, changeInEfectByDate)
{
this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputTypeName;
}

public CmdletOutputBreakingChangeAttribute(Type deprecatedCmdletOutputTypeName, Version deprecateByAzVersion, Version deprecateByVersion) :
base(string.Empty, deprecateByAzVersion, deprecateByVersion)
{
this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputTypeName;
}

public CmdletOutputBreakingChangeAttribute(Type deprecatedCmdletOutputTypeName, Version deprecateByAzVersion, Version deprecateByVersion, string changeInEfectByDate) :
base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate)
{
this.DeprecatedCmdLetOutputType = deprecatedCmdletOutputTypeName;
}

protected override string GetAttributeSpecificMessage()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,32 @@ public CmdletParameterBreakingChangeAttribute(string nameOfParameterChanging) :
{
this.NameOfParameterChanging = nameOfParameterChanging;
}


[Obsolete("Please provide the deprecate Az version and module version")]
public CmdletParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByVersion) :
base(string.Empty, deprecateByVersion)
{
this.NameOfParameterChanging = nameOfParameterChanging;
}

[Obsolete("Please provide the deprecate Az version and module version")]
public CmdletParameterBreakingChangeAttribute(string nameOfParameterChanging, string deprecateByVersion, string changeInEfectByDate) :
base(string.Empty, deprecateByVersion, changeInEfectByDate)
{
this.NameOfParameterChanging = nameOfParameterChanging;
}

public CmdletParameterBreakingChangeAttribute(string nameOfParameterChanging, Version deprecateByAzVersion, Version deprecateByVersion) :
base(string.Empty, deprecateByAzVersion, deprecateByVersion)
{
this.NameOfParameterChanging = nameOfParameterChanging;
}

public CmdletParameterBreakingChangeAttribute(string nameOfParameterChanging, Version deprecateByAzVersion, Version deprecateByVersion, string changeInEfectByDate) :
base(string.Empty, deprecateByAzVersion, deprecateByVersion, changeInEfectByDate)
{
this.NameOfParameterChanging = nameOfParameterChanging;
}

protected override string GetAttributeSpecificMessage()
{
Expand Down
29 changes: 27 additions & 2 deletions src/Common/CustomAttributes/GenericBreakingChangeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public class GenericBreakingChangeAttribute : System.Attribute

//The version the change is effective from, non mandatory
public string DeprecateByVersion { get; }
public string DeprecateByAzVersion { get; }
public bool DeprecateByVersionSet { get; } = false;

//The date on which the change comes in effect
Expand All @@ -51,19 +52,21 @@ public class GenericBreakingChangeAttribute : System.Attribute
//New way fo calling the cmdlet
public string NewWay { get; set; }

[Obsolete("Please provide the deprecate version", false)]
[Obsolete("Please provide the deprecate Az version and module version")]
public GenericBreakingChangeAttribute(string message)
{
_message = message;
}

[Obsolete("Please provide the deprecate Az version and module version")]
public GenericBreakingChangeAttribute(string message, string deprecateByVersion)
{
_message = message;
this.DeprecateByVersion = deprecateByVersion;
this.DeprecateByVersionSet = true;
}


[Obsolete("Please provide the deprecate Az version and module version")]
public GenericBreakingChangeAttribute(string message, string deprecateByVersion, string changeInEfectByDate)
{
_message = message;
Expand All @@ -77,6 +80,28 @@ public GenericBreakingChangeAttribute(string message, string deprecateByVersion,
}
}

public GenericBreakingChangeAttribute(string message, Version deprecateByAzVersion, Version deprecateByVersion)
{
_message = message;
this.DeprecateByAzVersion = deprecateByAzVersion.ToString();
this.DeprecateByVersion = deprecateByVersion.ToString();
this.DeprecateByVersionSet = true;
}

public GenericBreakingChangeAttribute(string message, Version deprecateByAzVersion, Version deprecateByVersion, string changeInEfectByDate)
{
_message = message;
this.DeprecateByVersion = deprecateByVersion.ToString();
this.DeprecateByVersionSet = true;
this.DeprecateByAzVersion = deprecateByAzVersion.ToString();

if (DateTime.TryParse(changeInEfectByDate, new CultureInfo("en-US"), DateTimeStyles.None, out DateTime result))
{
this.ChangeInEfectByDate = result;
this.ChangeInEfectByDateSet = true;
}
}

public DateTime getInEffectByDate()
{
return this.ChangeInEfectByDate.Date;
Expand Down