-
Notifications
You must be signed in to change notification settings - Fork 229
Added update-metadata tool #12761
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
Added update-metadata tool #12761
Changes from 2 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6dc13fd
Added update-metadata tool
raych1 6494451
Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/Package/MetadataUpda…
raych1 bbb53f7
Removed update-ci and returned no-op for non-implemented language-spe…
raych1 76ee70e
Merge branch 'main' into user/raych1/update-metadata-tool
raych1 7bcc263
Fxied test failures
raych1 6f0a3b3
Added tests
raych1 85259aa
Log messages when error happens in parsing configuration
raych1 d132247
Refactored code to use extension methods
raych1 1988ef4
Enabled mcp tool
raych1 74f505e
Reverted change on languageservice
raych1 e790b25
Update tools/azsdk-cli/Azure.Sdk.Tools.Cli/Tools/Package/MetadataUpda…
raych1 d12a6d0
Fixed namespace reference
raych1 e86b46f
Merge branch 'user/raych1/update-metadata-tool' of https://github.com…
raych1 63f2a04
Added dummy class for dotnetpackageupdate
raych1 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
29 changes: 29 additions & 0 deletions
29
tools/azsdk-cli/Azure.Sdk.Tools.Cli/Helpers/IResponseFactory.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,29 @@ | ||
| using Azure.Sdk.Tools.Cli.Models; | ||
| using Azure.Sdk.Tools.Cli.Models.Responses.Package; | ||
|
|
||
| namespace Azure.Sdk.Tools.Cli.Helpers; | ||
|
|
||
| /// <summary> | ||
| /// Factory for creating standardized command responses. | ||
| /// </summary> | ||
| public interface IResponseFactory | ||
| { | ||
| /// <summary> | ||
| /// Creates a package failure response with the specified error message and package info. | ||
| /// </summary> | ||
| /// <param name="message">The error message to include in the response.</param> | ||
| /// <param name="packageInfo">Optional package information to include in the response.</param> | ||
| /// <param name="nextSteps">Optional next steps to include in the response.</param> | ||
| /// <returns>A PackageOperationResponse indicating failure.</returns> | ||
| PackageOperationResponse CreateFailureResponse(string message, PackageInfo? packageInfo = null, string[]? nextSteps = null); | ||
|
|
||
| /// <summary> | ||
| /// Creates a success response with the specified message. | ||
| /// Only works with PackageOperationResponse. | ||
| /// </summary> | ||
| /// <param name="message">The success message to include in the response.</param> | ||
| /// <param name="packageInfo">Optional package information to include in the response.</param> | ||
| /// <param name="nextSteps">Optional next steps to include in the response.</param> | ||
| /// <returns>A PackageOperationResponse indicating success.</returns> | ||
| PackageOperationResponse CreateSuccessResponse(string message, PackageInfo? packageInfo = null, string[]? nextSteps = null); | ||
| } | ||
38 changes: 38 additions & 0 deletions
38
tools/azsdk-cli/Azure.Sdk.Tools.Cli/Helpers/ResponseFactory.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,38 @@ | ||
| using Azure.Sdk.Tools.Cli.Models; | ||
| using Azure.Sdk.Tools.Cli.Models.Responses.Package; | ||
|
|
||
| namespace Azure.Sdk.Tools.Cli.Helpers; | ||
|
|
||
| /// <summary> | ||
| /// Factory for creating standardized command responses. | ||
| /// </summary> | ||
| public class ResponseFactory : IResponseFactory | ||
| { | ||
| /// <inheritdoc /> | ||
| public PackageOperationResponse CreateFailureResponse(string message, PackageInfo? packageInfo = null, string[]? nextSteps = null) | ||
| { | ||
| return new PackageOperationResponse | ||
raych1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| ResponseErrors = [message], | ||
| PackageName = packageInfo?.PackageName ?? string.Empty, | ||
| Language = packageInfo?.Language ?? SdkLanguage.Unknown, | ||
| PackageType = packageInfo?.SdkType ?? SdkType.Unknown, | ||
| Result = "failed", | ||
| NextSteps = nextSteps?.ToList() ?? [] | ||
| }; | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public PackageOperationResponse CreateSuccessResponse(string message, PackageInfo? packageInfo = null, string[]? nextSteps = null) | ||
| { | ||
| return new PackageOperationResponse | ||
| { | ||
| Result = "succeeded", | ||
| Message = message, | ||
| PackageName = packageInfo?.PackageName ?? string.Empty, | ||
| Language = packageInfo?.Language ?? SdkLanguage.Unknown, | ||
| PackageType = packageInfo?.SdkType ?? SdkType.Unknown, | ||
| NextSteps = nextSteps?.ToList() ?? [] | ||
| }; | ||
| } | ||
| } | ||
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
45 changes: 45 additions & 0 deletions
45
tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/IProcessConfigurationService.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,45 @@ | ||
| using Azure.Sdk.Tools.Cli.Models; | ||
| using Azure.Sdk.Tools.Cli.Models.Responses.Package; | ||
| using Azure.Sdk.Tools.Cli.Helpers; | ||
|
|
||
| namespace Azure.Sdk.Tools.Cli.Services; | ||
|
|
||
| /// <summary> | ||
| /// Service for creating process options based on configuration and executing processes with standardized response handling. | ||
| /// </summary> | ||
| public interface IProcessConfigurationService | ||
weshaggard marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| { | ||
| /// <summary> | ||
| /// Creates process options based on configuration type and parameters. | ||
| /// </summary> | ||
| /// <param name="configType">The type of configuration content type.</param> | ||
| /// <param name="configValue">The configuration value (e.g., command or script path).</param> | ||
| /// <param name="sdkRepoRoot">The root path of the SDK repository.</param> | ||
| /// <param name="workingDirectory">The working directory for the process.</param> | ||
| /// <param name="parameters">Dictionary of parameters to pass to the script/command.</param> | ||
| /// <param name="timeoutMinutes">Timeout in minutes for the process execution.</param> | ||
| /// <returns>Configured ProcessOptions for execution.</returns> | ||
| ProcessOptions CreateProcessOptionsAsync( | ||
| SpecGenSdkConfigContentType configType, | ||
| string configValue, | ||
| string sdkRepoRoot, | ||
| string workingDirectory, | ||
| Dictionary<string, string> parameters, | ||
| int timeoutMinutes = 30); | ||
|
|
||
| /// <summary> | ||
| /// Executes a process with common error handling and response formatting. | ||
| /// </summary> | ||
| /// <param name="options">The process options for execution.</param> | ||
| /// <param name="ct">Cancellation token for the operation.</param> | ||
| /// <param name="packageInfo">Optional package information to include in the response.</param> | ||
| /// <param name="successMessage">Message to include on successful execution.</param> | ||
| /// <param name="nextSteps">Array of next steps to include on successful execution.</param> | ||
| /// <returns>A response indicating the result of the process execution.</returns> | ||
| Task<PackageOperationResponse> ExecuteProcessAsync( | ||
| ProcessOptions options, | ||
| CancellationToken ct, | ||
| PackageInfo? packageInfo = null, | ||
| string successMessage = "Process completed successfully.", | ||
| string[]? nextSteps = null); | ||
| } | ||
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
44 changes: 44 additions & 0 deletions
44
tools/azsdk-cli/Azure.Sdk.Tools.Cli/Services/Languages/PackageUpdate/DotNetPackageUpdate.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,44 @@ | ||
| using Azure.Sdk.Tools.Cli.Models.Responses.Package; | ||
| using Azure.Sdk.Tools.Cli.Services; | ||
| using Azure.Sdk.Tools.Cli.Helpers; | ||
| using Microsoft.Extensions.Logging; | ||
|
|
||
| namespace Azure.Sdk.Tools.Cli.Services; | ||
|
|
||
| /// <summary> | ||
| /// .NET-specific implementation for package update operations. | ||
| /// </summary> | ||
| public class DotNetPackageUpdate : ILanguagePackageUpdate | ||
weshaggard marked this conversation as resolved.
Show resolved
Hide resolved
raych1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| private readonly ILogger<DotNetPackageUpdate> _logger; | ||
| private readonly IResponseFactory _responseFactory; | ||
|
|
||
| public DotNetPackageUpdate( | ||
| ILogger<DotNetPackageUpdate> logger, | ||
| IResponseFactory responseFactory) | ||
| { | ||
| _logger = logger; | ||
| _responseFactory = responseFactory; | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public async Task<PackageOperationResponse> UpdateMetadataAsync(string packagePath, CancellationToken ct) | ||
| { | ||
| await Task.CompletedTask; | ||
| throw new NotImplementedException(".NET metadata update is not yet implemented."); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public async Task<PackageOperationResponse> UpdateChangelogContentAsync(string packagePath, CancellationToken ct) | ||
| { | ||
| await Task.CompletedTask; | ||
| throw new NotImplementedException(".NET changelog update is not yet implemented."); | ||
| } | ||
|
|
||
| /// <inheritdoc /> | ||
| public async Task<PackageOperationResponse> UpdateVersionAsync(string packagePath, CancellationToken ct) | ||
| { | ||
| await Task.CompletedTask; | ||
raych1 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| throw new NotImplementedException(".NET version update is not yet implemented."); | ||
| } | ||
| } | ||
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.