Skip to content

Conversation

@isra-fel
Copy link
Member

@isra-fel isra-fel commented Mar 22, 2022

This PR implements the abstractions defined in Azure/azure-powershell-common#313

You can review this PR by commits:

  1. 8efa0f9 brought in the code of Microsoft.Extensions.Configuration library we use as the storage layer, with some modification that allows us to update the configuration; to read environment variables from different targets (user/system) etc.
  2. e54b3cb is the main implementation of the interfaces, the core types being ConfigManager which provides all the CRUD APIs to the config; and ConfigInitializer which initializes the config file and config manager. This commit also includes helper classes and abstract config definitions.
  3. 3f59938 is about the PowerShell cmdlets, for example, Get-AzConfig.
  4. c1e967f is tests.

Description

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:

Copy link
Member Author

Choose a reason for hiding this comment

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

Docs will be updated in a following PR.
I merely included them for CI.

Copy link
Member Author

Choose a reason for hiding this comment

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

This refactoring is low priority

Copy link
Member Author

Choose a reason for hiding this comment

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

This method will be implemented in a follow up PR

Copy link
Member

Choose a reason for hiding this comment

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

It is great that those code can be removed.

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

@isra-fel isra-fel marked this pull request as ready for review March 24, 2022 08:53
public static class AppliesToHelper
{
internal static readonly Regex ModulePattern = new Regex(@"^az\.[a-z]+$", RegexOptions.IgnoreCase);
internal static readonly Regex CmdletPattern = new Regex(@"^[a-z]+-[a-z]+$", RegexOptions.IgnoreCase);
Copy link
Member

@dingmeng-xue dingmeng-xue Apr 12, 2022

Choose a reason for hiding this comment

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

Cmdlet may contains digital number. such as Get-AzDataFactoryV2 I recommend that module supports digital number too.

Copy link
Member Author

Choose a reason for hiding this comment

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

Added numbers to the regex and moved the logic of handling regex into a new PSNamingUtilities class.

</EmbeddedResource>
</ItemGroup>

<ItemGroup>
Copy link
Member

Choose a reason for hiding this comment

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

Can we remove this part? it seems it is not required.

Copy link
Member Author

Choose a reason for hiding this comment

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

removed

@isra-fel isra-fel self-assigned this Apr 12, 2022
Comment on lines +58 to +61
private bool IsMultiContent(object value)
{
return value is Array;
}
Copy link
Member

Choose a reason for hiding this comment

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

seems not required. nice to have.

Copy link
Member Author

Choose a reason for hiding this comment

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

Agreed, nice to have.

@dingmeng-xue
Copy link
Member

A general question. If class is defined as interface, why is its namespace internal?

@isra-fel
Copy link
Member Author

A general question. If class is defined as interface, why is its namespace internal?

The code in the internal namespace works as the data layer of the config framework. It is not supposed to be exposed as public API, so I made it explicit by the namespace.

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.

2 participants