-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split out context interfaces for discovery (#2546)
- Loading branch information
1 parent
272b874
commit 4650fcc
Showing
12 changed files
with
391 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using PSRule.Pipeline; | ||
using PSRule.Runtime; | ||
|
||
namespace PSRule.Definitions; | ||
|
||
#nullable enable | ||
|
||
/// <summary> | ||
/// A context that is used for discovery of resources. | ||
/// </summary> | ||
internal interface IResourceDiscoveryContext | ||
{ | ||
/// <summary> | ||
/// A writer to log messages. | ||
/// </summary> | ||
IPipelineWriter Writer { get; } | ||
|
||
/// <summary> | ||
/// Enter a language scope. | ||
/// </summary> | ||
/// <param name="file">The source file to enter.</param> | ||
void EnterLanguageScope(ISourceFile file); | ||
|
||
/// <summary> | ||
/// Exit a language scope. | ||
/// </summary> | ||
/// <param name="file">The source file to exit.</param> | ||
void ExitLanguageScope(ISourceFile file); | ||
|
||
void PushScope(RunspaceScope scope); | ||
|
||
void PopScope(RunspaceScope scope); | ||
} | ||
|
||
#nullable restore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using System.Management.Automation; | ||
using PSRule.Options; | ||
|
||
namespace PSRule.Definitions; | ||
|
||
/// <summary> | ||
/// A context that is used for discovery of resources defined as script blocks. | ||
/// </summary> | ||
internal interface IScriptResourceDiscoveryContext : IResourceDiscoveryContext | ||
{ | ||
PowerShell GetPowerShell(); | ||
|
||
ExecutionOption GetExecutionOption(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
|
||
using PSRule.Definitions; | ||
|
||
namespace PSRule.Pipeline; | ||
|
||
/// <summary> | ||
/// A cache that stores resources. | ||
/// </summary> | ||
internal interface IResourceCache | ||
{ | ||
bool Import(IResource resource); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.