Skip to content

Upgrade parameters on Cmdlet Get-AzureRmConsumptionUsageDetail #6023

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

Merged
merged 14 commits into from
May 9, 2018

Conversation

bgsky
Copy link
Contributor

@bgsky bgsky commented Apr 23, 2018

Description

  • Depreciated parameter InvoiceName on Cmdlet Get-AzureRmConsumptionUsageDetail
  • Add new parameter Expand, ResourceGroup, InstanceName, InstanceId, Tag, and Top on Cmdlet Get-AzureRmConsumptionUsageDetail

Checklist

@azuresdkci
Copy link

Can one of the admins verify this patch?

@bgsky
Copy link
Contributor Author

bgsky commented Apr 24, 2018

@azuresdkci Just joined Azure, please verify the status.

@maddieclayton
Copy link
Contributor

@azuresdkci Add to whitelist

@markcowl
Copy link
Member

markcowl commented May 1, 2018

@bgsky Please fill out a cmdlet design review here: https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues

@bgsky
Copy link
Contributor Author

bgsky commented May 2, 2018

@@ -84,6 +85,14 @@
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.IdentityModel.Clients.ActiveDirectory.2.28.3\lib\net45\Microsoft.IdentityModel.Clients.ActiveDirectory.WindowsForms.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Rest.ClientRuntime, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these two references, as it is included in the common targets.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing out. Removed.

<HintPath>..\..\..\packages\Microsoft.Azure.Management.Consumption.1.1.0-preview\lib\net452\Microsoft.Azure.Management.Consumption.dll</HintPath>
<Reference Include="Microsoft.Azure.Management.Consumption, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Consumption.3.0.0\lib\net452\Microsoft.Azure.Management.Consumption.dll</HintPath>
<Private>True</Private>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need this private tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tag was added by accident. Already removed.

$usageDetails = Get-AzureRmConsumptionUsageDetail -MaxCount 10

$usageDetails = Get-AzureRmConsumptionUsageDetail -Top 10
Assert-NotNull $usageDetails
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these tests only work on a specific subscription?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, we have the same internal implementation for MaxCount and Top.

@@ -14,6 +14,8 @@
<package id="Microsoft.Bcl.Build" version="1.0.14" targetFramework="net45" />
<package id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="2.28.3" targetFramework="net45" />
<package id="Microsoft.Net.Http" version="2.2.28" targetFramework="net45" />
<package id="Microsoft.Rest.ClientRuntime" version="2.3.10" targetFramework="net452" />
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove these two packages as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for pointing out. Removed.


[Parameter(Mandatory = false, HelpMessage = "The tag of the usages to filter.")]
[ValidateNotNull]
public string Tags { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename to "Tag" (powershell guidelines)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tags is renamed as Tag, and .md file and recorded sessions are regenerated accordingly.


[Parameter(Mandatory = false, HelpMessage = "Name of a specific invoice to get the usage details that associate with.")]
[ValidateNotNullOrEmpty]
public string InvoiceName { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added an attribute of CmdletParameterBreakingChange on InvoiceName.

<HintPath>..\..\..\packages\Microsoft.Azure.Management.Consumption.1.1.0-preview\lib\net452\Microsoft.Azure.Management.Consumption.dll</HintPath>
<Reference Include="Microsoft.Azure.Management.Consumption, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Consumption.3.0.0\lib\net452\Microsoft.Azure.Management.Consumption.dll</HintPath>
<Private>True</Private>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the private tag?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added by accident. Already removed.

public string Id { get; private set; }
public string Name { get; private set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renaming properties is a breaking change - please add back InvoiceName and BillingPeriodName

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for confusion of shuffling the parameters on alphabetic order. InvoiceName and BillingPeriodName were added back.

```

Get usage details of the invoice with specified name, and include MeterDetails property in the result.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide example output for these examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maddieclayton Our model of usage detail has 28 output parameters. Can we skip output example to avoid user distraction?

Accept wildcard characters: False
```

### -Tags
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Be sure to rengenerate the file after changing Tags to Tag to reflect the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.md file is regenerated accordingly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it is still tags

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change it to tag

@maddieclayton maddieclayton removed their assignment May 4, 2018
@bgsky bgsky added this to the 2018-05-18 milestone May 4, 2018
@bgsky
Copy link
Contributor Author

bgsky commented May 5, 2018

@maddieclayton @ms-premp We addressed your comments on Tag, redundant csproj references, depreciated InvoiceName attribute, missing parameters in PSUsageDetail model. Please review the latest iteration. Pull request description is also updated with the latest changes.

@@ -21,6 +21,7 @@

## Version 0.3.2
* Set minimum dependency of module to PowerShell 5.0
* Add new parameters Expand, ResourceGroup, InstanceName, InstanceId, Tags, and Top on Cmdlet Get-AzureRmConsumptionUsageDetail
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move this to "Current Release"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will move to Current Release

public string Product { get; set; }
public string SubscriptionGuid { get; set; }
public string SubscriptionName { get; set; }
public IDictionary<string, string> Tag { get; private set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep this one as "Tags" because otherwise it is a breaking change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will keep it as Tags

Accept wildcard characters: False
```

### -Tags
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it is still tags

public DateTime? UsageStart { get; private set; }
public DateTime? UsageEnd { get; private set; }
public string AccountName { get; set; }
public string AdditionalProperties { get; set; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this changed type - please change back.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@maddieclayton @ms-premp As we need this output as string, we keep AdditionalProperties as dictionary type (will depreciate it and label as future breaking change), and introduce a new output parameter as AdditionalInfo with string type.

@bgsky
Copy link
Contributor Author

bgsky commented May 8, 2018

@maddieclayton @ms-premp The new iteration fixed typo on Tag parameter. In terms of a parameter of AdditionalProperties, we need string type, therefore keep it as dictionary type, and introduce a new parameter AdditionalInfo as string type. Recorded test sessions are also regenerated with those changes. Please review and let me know any comments

this.UsageStart = usageDetail.UsageStart;
this.UsageEnd = usageDetail.UsageEnd;
this.AccountName = usageDetail.AccountName;
this.AdditionalInfo = usageDetail.AdditionalProperties;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What was AdditionalProperties before? It seems like now a property that was previously populated will always be null. Is it possible to populate this value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will always be null. AdditionalProperties of dictionary type was developed by previous team long ago. We don't have information on how to populate it in a dictionary type. Instead we do AdditionInfo in string type, and mark AdditionalProperties as future breaking change. Let me know your advice in that case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As long as the current behavior is that it always returns null, it is fine that it now will not be populated.

@bgsky bgsky assigned maddieclayton and unassigned bgsky May 8, 2018
@maddieclayton
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants