-
Notifications
You must be signed in to change notification settings - Fork 4k
New version of cmdlets for AzureRM.Billing and AzureRM.Consumption #3852
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -12,7 +12,7 @@ | |||
# RootModule = '' | |||
|
|||
# Version number of this module. | |||
ModuleVersion = '0.11.0' | |||
ModuleVersion = '0.12.0' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Panda-Wang please revert this change; we will update the module versions during the release
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted
@@ -19,6 +19,13 @@ | |||
--> | |||
## Current Release | |||
|
|||
## Version 0.12.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Panda-Wang please remove the ## Version 0.12.0
header you have added and move the content you have added to under the ## Current Release
header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
[assembly: AssemblyVersion("0.11.0")] | ||
[assembly: AssemblyFileVersion("0.11.0")] | ||
[assembly: AssemblyVersion("0.12.0")] | ||
[assembly: AssemblyFileVersion("0.12.0")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Panda-Wang please revert the changes made to this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted
{ | ||
if (ParameterSetName.Equals(Constants.ParameterSetNames.ListParameterSet)) | ||
{ | ||
if (MaxCount.HasValue && (MaxCount.Value > 100 || MaxCount.Value < 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Panda-Wang you can use the ValidateRange
attribute to limit the values that users pass through to the MaxCount
parameter. Here is an example of a parameter using the ValidateRange
attribute
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
} | ||
if (MaxCount.HasValue && (MaxCount.Value > 100 || MaxCount.Value < 1)) | ||
{ | ||
throw new PSArgumentException(Resources.MaxCountExceedRangeError); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Panda-Wang same comment about ValidateRange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
[assembly: AssemblyVersion("0.11.0")] | ||
[assembly: AssemblyFileVersion("0.11.0")] | ||
[assembly: AssemblyVersion("0.12.0")] | ||
[assembly: AssemblyFileVersion("0.12.0")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Panda-Wang please revert the changes made in this file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reverted
--> | ||
## Current Release | ||
|
||
## Version 0.1.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Panda-Wang you can remove the ## Version 0.1.0
header and place the content you have added under the ## Current Release
header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed
[Cmdlet(VerbsCommon.Get, "AzureRmConsumptionUsageDetail", DefaultParameterSetName = Constants.ParameterSetNames.SubscriptionItemParameterSet), OutputType(typeof(List<PSUsageDetail>))] | ||
public class GetAzureRmConsumptionUsageDetail : AzureConsumptionCmdletBase | ||
{ | ||
const int MaxNumberToFetch = 1000; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Panda-Wang I believe you can get rid of this if you use the ValidateRange
attribute for MaxCount
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is still needed. This is the number of items to fetch in each request. as suggested by Mark, we keep pulling the next page until we have everything. but API has output size limit, thus we pull max 1000 result in each request to API call.
[Parameter(Mandatory = false, HelpMessage = "Determine the maximum number of records to return.", ParameterSetName = Constants.ParameterSetNames.InvoiceItemParameterSet)] | ||
[Parameter(Mandatory = false, HelpMessage = "Determine the maximum number of records to return.", ParameterSetName = Constants.ParameterSetNames.BillingPeriodItemParameterSet)] | ||
[ValidateNotNull] | ||
public int? MaxCount { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Panda-Wang it looks like for MaxCount
, IncludeMeterDetails
, IncludeAdditionalProperties
, StartDate
and EndDate
you don't need to have a Parameter
attribute for each parameter set. Since these parameters appear in all of the parameter sets and have the same attributes across them all, you can make them global, meaning you only need one Parameter
attribute per parameter, and you don't need to include a parameter set name for them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
@Panda-Wang PR is failing because of the names of parameters |
@azuresdkci retest this please |
@Panda-Wang You will need to pull the latest and rebuild your wxi file. BTW - are you adding new dependency files? If not, you don't need to update the wxi. |
@Panda-Wang It looks like you have added a bunch of changed files outside your own changes. Can you please fetch the latest locally before updating your PR |
Re-submitted from a clean fork: #3880 |
Description
New version of cmdlets for AzureRM.Billing and AzureRM.Consumption
This checklist is used to make sure that common guidelines for a pull request are followed. You can find a more complete discussion of PowerShell cmdlet best practices here.
General Guidelines
Testing Guidelines
Cmdlet Signature Guidelines
ShouldProcess
and haveSupportShouldProcess=true
specified in the cmdlet attribute. You can find more information onShouldProcess
here.OutputType
attribute if any output is produced - if the cmdlet produces no output, it should implement aPassThru
parameter.Cmdlet Parameter Guidelines