-
Notifications
You must be signed in to change notification settings - Fork 1.7k
.NET: Add Microsoft.Agents.AI.Hyperlight package for CodeAct integration (.NET) #5329
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
eavanvalkenburg
merged 6 commits into
microsoft:main
from
eavanvalkenburg:codeact_dotnet
May 5, 2026
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a74fb8b
Add Microsoft.Agents.AI.Hyperlight package for CodeAct integration
eavanvalkenburg 87320ab
Address PR #5329 review feedback for Hyperlight CodeAct provider
eavanvalkenburg a5b7448
Align Hyperlight package id and JS warm-up with merged upstream SDK
eavanvalkenburg 3f3a03a
Bump Hyperlight package to 0.4.0 and fix build/test issues
eavanvalkenburg 8de1459
Fix CI check failures: file encoding (UTF-8 BOM + LF) and broken mark…
eavanvalkenburg 5270c37
Address PR review: AIFunction inheritance, packaging, GetService appr…
eavanvalkenburg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
22 changes: 22 additions & 0 deletions
22
...ithCodeAct/AgentWithCodeAct_Step01_Interpreter/AgentWithCodeAct_Step01_Interpreter.csproj
This file contains hidden or 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,22 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFrameworks>net10.0</TargetFrameworks> | ||
|
|
||
| <Nullable>enable</Nullable> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Azure.AI.OpenAI" /> | ||
| <PackageReference Include="Azure.Identity" /> | ||
| <PackageReference Include="Microsoft.Extensions.AI.OpenAI" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\..\..\src\Microsoft.Agents.AI.OpenAI\Microsoft.Agents.AI.OpenAI.csproj" /> | ||
| <ProjectReference Include="..\..\..\..\src\Microsoft.Agents.AI.Hyperlight\Microsoft.Agents.AI.Hyperlight.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
30 changes: 30 additions & 0 deletions
30
dotnet/samples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step01_Interpreter/Program.cs
This file contains hidden or 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,30 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| // This sample shows how to use HyperlightCodeActProvider as a sandboxed Python | ||
| // code interpreter: the model can write and execute arbitrary Python code to | ||
| // answer quantitative questions without calling any additional tools. | ||
|
|
||
| using Azure.AI.OpenAI; | ||
| using Azure.Identity; | ||
| using Microsoft.Agents.AI; | ||
| using Microsoft.Agents.AI.Hyperlight; | ||
| using OpenAI.Chat; | ||
|
|
||
| var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set."); | ||
| var deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME") ?? "gpt-5.4-mini"; | ||
| var guestPath = Environment.GetEnvironmentVariable("HYPERLIGHT_PYTHON_GUEST_PATH") ?? throw new InvalidOperationException("HYPERLIGHT_PYTHON_GUEST_PATH is not set."); | ||
|
|
||
| using var codeAct = new HyperlightCodeActProvider(HyperlightCodeActProviderOptions.CreateForWasm(guestPath)); | ||
|
|
||
| AIAgent agent = new AzureOpenAIClient( | ||
| new Uri(endpoint), | ||
| new DefaultAzureCredential()) | ||
| .GetChatClient(deploymentName) | ||
| .AsAIAgent(new ChatClientAgentOptions() | ||
| { | ||
| ChatOptions = new() { Instructions = "You are a helpful assistant. When the user asks something quantitative, write Python and call `execute_code` instead of guessing." }, | ||
| AIContextProviders = [codeAct], | ||
| }); | ||
|
|
||
| Console.WriteLine(await agent.RunAsync("What is the 20th Fibonacci number?")); | ||
| Console.WriteLine(await agent.RunAsync("Compute the mean and standard deviation of [1, 4, 9, 16, 25, 36].")); | ||
35 changes: 35 additions & 0 deletions
35
...amples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step01_Interpreter/README.md
This file contains hidden or 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,35 @@ | ||
| # AgentWithCodeAct_Step01_Interpreter | ||
|
|
||
| A minimal CodeAct sample. The agent uses `HyperlightCodeActProvider` as a | ||
| sandboxed Python interpreter: when the user asks something quantitative, the | ||
| model writes Python and invokes the `execute_code` tool rather than answering | ||
| from memory. | ||
|
|
||
| ## Configuration | ||
|
|
||
| | Variable | Description | | ||
| |--------------------------------|-------------------------------------------------------------------------------------------| | ||
| | `AZURE_OPENAI_ENDPOINT` | Azure OpenAI endpoint. Required. | | ||
| | `AZURE_OPENAI_DEPLOYMENT_NAME` | Azure OpenAI deployment. Defaults to `gpt-5.4-mini`. | | ||
| | `HYPERLIGHT_PYTHON_GUEST_PATH` | Absolute path to the Hyperlight Python guest module (`.wasm` or `.aot` file). Required. | | ||
|
eavanvalkenburg marked this conversation as resolved.
|
||
|
|
||
| Authentication uses `DefaultAzureCredential`. | ||
|
|
||
| ## Getting the guest module | ||
|
|
||
| The Python guest module is built from the | ||
| [hyperlight-dev/hyperlight-sandbox](https://github.com/hyperlight-dev/hyperlight-sandbox) | ||
| repository — see its README for the exact `cargo`/`just` invocations and | ||
| the location of the resulting `.wasm` / `.aot` file. Set | ||
| `HYPERLIGHT_PYTHON_GUEST_PATH` to the absolute path of that artifact | ||
| before running the sample. | ||
|
|
||
| Hyperlight requires a hardware virtualization back end on the host: | ||
| KVM on Linux or WHP (Windows Hypervisor Platform) on Windows. | ||
|
|
||
| ## Run | ||
|
|
||
| ```shell | ||
| cd AgentWithCodeAct_Step01_Interpreter | ||
| dotnet run | ||
| ``` | ||
22 changes: 22 additions & 0 deletions
22
...ithCodeAct/AgentWithCodeAct_Step02_ToolEnabled/AgentWithCodeAct_Step02_ToolEnabled.csproj
This file contains hidden or 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,22 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFrameworks>net10.0</TargetFrameworks> | ||
|
|
||
| <Nullable>enable</Nullable> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Azure.AI.OpenAI" /> | ||
| <PackageReference Include="Azure.Identity" /> | ||
| <PackageReference Include="Microsoft.Extensions.AI.OpenAI" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\..\..\src\Microsoft.Agents.AI.OpenAI\Microsoft.Agents.AI.OpenAI.csproj" /> | ||
| <ProjectReference Include="..\..\..\..\src\Microsoft.Agents.AI.Hyperlight\Microsoft.Agents.AI.Hyperlight.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
52 changes: 52 additions & 0 deletions
52
dotnet/samples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step02_ToolEnabled/Program.cs
This file contains hidden or 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,52 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| // This sample shows how to use HyperlightCodeActProvider with provider-owned | ||
| // tools (exposed inside the sandbox via `call_tool(...)`). The model can | ||
| // orchestrate those tools in a single Python block, reducing round-trips. A | ||
| // sensitive tool (`send_email`) is additionally wrapped in | ||
| // ApprovalRequiredAIFunction so any code that reaches it requires user approval | ||
| // for the entire execute_code invocation. | ||
|
|
||
| using Azure.AI.OpenAI; | ||
| using Azure.Identity; | ||
| using Microsoft.Agents.AI; | ||
| using Microsoft.Agents.AI.Hyperlight; | ||
| using Microsoft.Extensions.AI; | ||
| using OpenAI.Chat; | ||
|
|
||
| var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set."); | ||
| var deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME") ?? "gpt-5.4-mini"; | ||
| var guestPath = Environment.GetEnvironmentVariable("HYPERLIGHT_PYTHON_GUEST_PATH") ?? throw new InvalidOperationException("HYPERLIGHT_PYTHON_GUEST_PATH is not set."); | ||
|
|
||
| AIFunction fetchDocs = AIFunctionFactory.Create( | ||
| (string topic) => $"Docs for {topic}: (...)", | ||
| name: "fetch_docs", | ||
| description: "Fetch documentation for a given topic."); | ||
|
|
||
| AIFunction queryData = AIFunctionFactory.Create( | ||
| (string query) => $"Rows for `{query}`: []", | ||
| name: "query_data", | ||
| description: "Run a read-only SQL-like query against the sample store."); | ||
|
|
||
| AIFunction sendEmail = new ApprovalRequiredAIFunction( | ||
| AIFunctionFactory.Create( | ||
| (string to, string subject) => $"Sent '{subject}' to {to}.", | ||
| name: "send_email", | ||
| description: "Send an email on behalf of the user.")); | ||
|
|
||
| var options = HyperlightCodeActProviderOptions.CreateForWasm(guestPath); | ||
| options.Tools = [fetchDocs, queryData, sendEmail]; | ||
|
|
||
| using var codeAct = new HyperlightCodeActProvider(options); | ||
|
|
||
| AIAgent agent = new AzureOpenAIClient( | ||
| new Uri(endpoint), | ||
| new DefaultAzureCredential()) | ||
| .GetChatClient(deploymentName) | ||
| .AsAIAgent(new ChatClientAgentOptions() | ||
| { | ||
| ChatOptions = new() { Instructions = "You are a helpful assistant. Prefer orchestrating your work in a single `execute_code` block using `call_tool(...)` over issuing many direct tool calls." }, | ||
| AIContextProviders = [codeAct], | ||
| }); | ||
|
|
||
| Console.WriteLine(await agent.RunAsync("Look up docs on 'retries' and query the 'orders' table, then summarize.")); |
34 changes: 34 additions & 0 deletions
34
...amples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step02_ToolEnabled/README.md
This file contains hidden or 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,34 @@ | ||
| # AgentWithCodeAct_Step02_ToolEnabled | ||
|
|
||
| Demonstrates adding provider-owned tools to `HyperlightCodeActProvider`. Those | ||
| tools are **only** available to code running inside the sandbox via | ||
| `call_tool("<name>", ...)` — they are never exposed to the model as direct | ||
|
eavanvalkenburg marked this conversation as resolved.
|
||
| tools. This lets the model orchestrate multiple tool calls in a single Python | ||
| block. | ||
|
|
||
| One tool (`send_email`) is wrapped in `ApprovalRequiredAIFunction`, which causes | ||
| the entire `execute_code` invocation to require user approval when that tool | ||
| is configured. | ||
|
|
||
| ## Configuration | ||
|
|
||
| | Variable | Description | | ||
| |--------------------------------|-------------------------------------------------------------------------------------------| | ||
| | `AZURE_OPENAI_ENDPOINT` | Azure OpenAI endpoint. Required. | | ||
| | `AZURE_OPENAI_DEPLOYMENT_NAME` | Azure OpenAI deployment. Defaults to `gpt-5.4-mini`. | | ||
| | `HYPERLIGHT_PYTHON_GUEST_PATH` | Absolute path to the Hyperlight Python guest module (`.wasm` or `.aot` file). Required. | | ||
|
|
||
| ## Run | ||
|
|
||
| ```shell | ||
| cd AgentWithCodeAct_Step02_ToolEnabled | ||
| dotnet run | ||
| ``` | ||
|
|
||
| ## Planned follow-up | ||
|
|
||
| A more realistic "upload a file (e.g. an Excel workbook), have the agent | ||
| analyze it with code" sample is planned as a separate step that will use | ||
| `HostInputDirectory` together with a guest tool capable of reading the | ||
| uploaded file. It will be added in a follow-up PR once the corresponding | ||
| guest module support is in place. | ||
22 changes: 22 additions & 0 deletions
22
...hCodeAct/AgentWithCodeAct_Step03_ManualWiring/AgentWithCodeAct_Step03_ManualWiring.csproj
This file contains hidden or 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,22 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <OutputType>Exe</OutputType> | ||
| <TargetFrameworks>net10.0</TargetFrameworks> | ||
|
|
||
| <Nullable>enable</Nullable> | ||
| <ImplicitUsings>enable</ImplicitUsings> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="Azure.AI.OpenAI" /> | ||
| <PackageReference Include="Azure.Identity" /> | ||
| <PackageReference Include="Microsoft.Extensions.AI.OpenAI" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\..\..\..\src\Microsoft.Agents.AI.OpenAI\Microsoft.Agents.AI.OpenAI.csproj" /> | ||
| <ProjectReference Include="..\..\..\..\src\Microsoft.Agents.AI.Hyperlight\Microsoft.Agents.AI.Hyperlight.csproj" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
40 changes: 40 additions & 0 deletions
40
dotnet/samples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step03_ManualWiring/Program.cs
This file contains hidden or 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,40 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| // This sample shows how to wire up CodeAct manually using | ||
| // HyperlightExecuteCodeFunction rather than the AIContextProvider. Use this | ||
| // when you want a fixed tool surface for the agent's lifetime and don't need | ||
| // the per-run snapshot/registry semantics of HyperlightCodeActProvider. | ||
|
|
||
| using Azure.AI.OpenAI; | ||
| using Azure.Identity; | ||
| using Microsoft.Agents.AI; | ||
| using Microsoft.Agents.AI.Hyperlight; | ||
| using Microsoft.Extensions.AI; | ||
| using OpenAI.Chat; | ||
|
|
||
| var endpoint = Environment.GetEnvironmentVariable("AZURE_OPENAI_ENDPOINT") ?? throw new InvalidOperationException("AZURE_OPENAI_ENDPOINT is not set."); | ||
| var deploymentName = Environment.GetEnvironmentVariable("AZURE_OPENAI_DEPLOYMENT_NAME") ?? "gpt-5.4-mini"; | ||
| var guestPath = Environment.GetEnvironmentVariable("HYPERLIGHT_PYTHON_GUEST_PATH") ?? throw new InvalidOperationException("HYPERLIGHT_PYTHON_GUEST_PATH is not set."); | ||
|
|
||
| AIFunction calculate = AIFunctionFactory.Create( | ||
| (double a, double b) => a * b, | ||
| name: "multiply", | ||
| description: "Multiply two numbers."); | ||
|
|
||
| var options = HyperlightCodeActProviderOptions.CreateForWasm(guestPath); | ||
| options.Tools = [calculate]; | ||
|
|
||
| using var executeCode = new HyperlightExecuteCodeFunction(options); | ||
|
|
||
| var instructions = | ||
| "You are a helpful assistant. When math is involved, solve it by writing Python " | ||
| + "and calling `execute_code` instead of computing values yourself.\n\n" | ||
| + executeCode.BuildInstructions(toolsVisibleToModel: false); | ||
|
|
||
| AIAgent agent = new AzureOpenAIClient( | ||
| new Uri(endpoint), | ||
| new DefaultAzureCredential()) | ||
| .GetChatClient(deploymentName) | ||
| .AsAIAgent(instructions: instructions, tools: [executeCode]); | ||
|
|
||
| Console.WriteLine(await agent.RunAsync("What is 12.3 * 4.5? Use the multiply tool from within `execute_code`.")); |
21 changes: 21 additions & 0 deletions
21
...mples/02-agents/AgentWithCodeAct/AgentWithCodeAct_Step03_ManualWiring/README.md
This file contains hidden or 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,21 @@ | ||
| # AgentWithCodeAct_Step03_ManualWiring | ||
|
|
||
| Shows how to wire CodeAct manually using `HyperlightExecuteCodeFunction` as a | ||
| direct agent tool instead of via an `AIContextProvider`. This is useful when | ||
| the sandbox's tool surface and capabilities are fixed for the agent's | ||
| lifetime, avoiding per-run snapshot/restore of the provider registry. | ||
|
|
||
| ## Configuration | ||
|
|
||
| | Variable | Description | | ||
| |--------------------------------|-------------------------------------------------------------------------------------------| | ||
| | `AZURE_OPENAI_ENDPOINT` | Azure OpenAI endpoint. Required. | | ||
| | `AZURE_OPENAI_DEPLOYMENT_NAME` | Azure OpenAI deployment. Defaults to `gpt-5.4-mini`. | | ||
| | `HYPERLIGHT_PYTHON_GUEST_PATH` | Absolute path to the Hyperlight Python guest module (`.wasm` or `.aot` file). Required. | | ||
|
|
||
| ## Run | ||
|
|
||
| ```shell | ||
| cd AgentWithCodeAct_Step03_ManualWiring | ||
| dotnet run | ||
| ``` |
This file contains hidden or 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,16 @@ | ||
| # Agent Framework CodeAct (Hyperlight) Samples | ||
|
|
||
| These samples show how to enable an agent to write and execute code in a | ||
| Hyperlight-backed sandbox via the CodeAct pattern. Guest code can be pure | ||
| Python (interpreter mode) or orchestrate host-provided tools through | ||
| `call_tool(...)` — all inside a secure sandbox with opt-in filesystem and | ||
| network access. | ||
|
|
||
| |Sample|Description| | ||
| |---|---| | ||
| |[Code interpreter](./AgentWithCodeAct_Step01_Interpreter/)|Uses `HyperlightCodeActProvider` as a sandboxed Python interpreter with no host tools.| | ||
| |[Tool-enabled CodeAct](./AgentWithCodeAct_Step02_ToolEnabled/)|Registers provider-owned tools that guest code can orchestrate via `call_tool(...)`, with an approval-required tool for sensitive actions.| | ||
| |[Manual wiring](./AgentWithCodeAct_Step03_ManualWiring/)|Uses `HyperlightExecuteCodeFunction` directly as an agent tool when the sandbox configuration is fixed.| | ||
|
|
||
| All samples require a Hyperlight Python guest module. Set | ||
| `HYPERLIGHT_PYTHON_GUEST_PATH` to its absolute path before running. |
This file contains hidden or 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
32 changes: 32 additions & 0 deletions
32
dotnet/src/Microsoft.Agents.AI.Hyperlight/AllowedDomain.cs
This file contains hidden or 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,32 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| using System.Collections.Generic; | ||
|
|
||
| namespace Microsoft.Agents.AI.Hyperlight; | ||
|
|
||
| /// <summary> | ||
| /// Represents a single entry in the outbound network allow-list applied to the | ||
| /// Hyperlight sandbox. | ||
| /// </summary> | ||
| public sealed class AllowedDomain | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="AllowedDomain"/> class. | ||
| /// </summary> | ||
| /// <param name="target">URL or domain to allow, for example <c>"https://api.github.com"</c>.</param> | ||
| /// <param name="methods"> | ||
| /// Optional list of HTTP methods to allow (for example <c>["GET", "POST"]</c>). | ||
| /// When <see langword="null"/>, all methods supported by the backend are allowed. | ||
| /// </param> | ||
| public AllowedDomain(string target, IReadOnlyList<string>? methods = null) | ||
| { | ||
| this.Target = target; | ||
| this.Methods = methods; | ||
| } | ||
|
|
||
| /// <summary>Gets the URL or domain to allow.</summary> | ||
| public string Target { get; } | ||
|
|
||
| /// <summary>Gets the optional list of HTTP methods to allow.</summary> | ||
| public IReadOnlyList<string>? Methods { get; } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.