Skip to content

Conversation

@pilor
Copy link
Contributor

@pilor pilor commented Dec 4, 2019

Description

Adding a new parameter to the New-AzPolicySetDefinition and Set-AzPolicySetDefinition cmdlets to support grouping of policy definitions within the policy set.

Design review is at: https://github.com/Azure/azure-powershell-cmdlet-review-pr/issues/446

Checklist

  • I have read the Submitting Changes section of CONTRIBUTING.md
  • The title of the PR is clear and informative
  • The appropriate ChangeLog.md file(s) has been updated:
    • For any service, the ChangeLog.md file can be found at src/{{SERVICE}}/{{SERVICE}}/ChangeLog.md
    • A snippet outlining the change(s) made in the PR should be written under the ## Upcoming Release header -- no new version header should be added
  • The PR does not introduce breaking changes
  • If applicable, the changes made in the PR have proper test coverage
  • For public API changes to cmdlets:
    • a cmdlet design review was approved for the changes in this repository (Microsoft internal only)
    • the markdown help files have been regenerated using the commands listed here

/// <returns></returns>
protected JArray GetArrayFromParameter(string parameter, string parameterName)
{
var result = this.GetTokenFromParameter(parameter) as JArray;
Copy link
Member

Choose a reason for hiding this comment

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

You can use an is-pattern here (and above in GetObjectFromParameter()):

if (this.GetTokenFromParameter(parameter) is JArray result)
{
  return result;
}

throw new PSArgumentException(string.Format(ProjectResources.JsonArrayExpected, parameterName), parameterName);

public const string NewPolicySetDefinitionMetadataHelp = "The metadata for the new policy set definition. This can either be a path to a file name containing the metadata, or the metadata as a string.";
public const string NewPolicySetDefinitionPolicyDefinitionHelp = "The policy definition for the new policy set definition. This can either be a path to a file name containing the policy definitions, or the policy set definition as a string.";
public const string NewPolicySetDefinitionParametersHelp = "The parameters declaration for the new policy set definition. This can either be a path to a file name or uri containing the parameters declaration, or the parameters declaration as a string.";
public const string NewPolicySetDefinitionPolicyDefinitionHelp = "The policy definitions for the new policy set definition. This can either be a path to a file containing the policy definitions, or the policy set definition as a JSON string.";
Copy link
Member

Choose a reason for hiding this comment

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

Nice catch/fixes here.

@VeryEarly VeryEarly merged commit 0ded3e0 into Azure:master Dec 5, 2019
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.

4 participants