[Refresh] Regenerate alertsmanagement Go SDK with latest TypeSpec#26159
[Refresh] Regenerate alertsmanagement Go SDK with latest TypeSpec#26159
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
API Change CheckAPIView identified API level changes in this PR and created the following API reviews |
|
PR base on main branch from swagger tag: package-preview-2025-05-25-preview |
tadelesh
left a comment
There was a problem hiding this comment.
Also need to remove alertprocessingrules_client_example_test.go.
| @@ -0,0 +1,4 @@ | |||
| directory: specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/AlertsManagement | |||
| commit: 402bf21e472d87c1b3abcd0b2675a8b6c8a42700 | |||
| repo: i-specs | |||
|
And pending on the fix of middle layer discriminated model. |
There was a problem hiding this comment.
Pull request overview
Updates the armalertsmanagement management-plane Go SDK to the latest TypeSpec-generated surface (preview 2025-05-25-preview), replacing the prior AutoRest-generated code and bumping the module to v0.11.0.
Changes:
- Switches spec provenance/config to TypeSpec (
tsp-location.yaml,_metadata.json) and updates module versioning (version.go,CHANGELOG.md). - Regenerates client/model plumbing (options/responses/polymorphic helpers) and updates Operations API to
2025-05-25-preview. - Removes legacy AutoRest-era clients/helpers and prunes corresponding fake server surfaces.
Reviewed changes
Copilot reviewed 36 out of 38 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/version.go | Adds TypeSpec-era moduleName/moduleVersion constants for ARM client construction. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/tsp-location.yaml | Adds TypeSpec spec location metadata for regeneration/provenance. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/time_rfc3339.go | Removes AutoRest-era RFC3339 helper (no longer needed with TypeSpec output). |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/testdata/_metadata.json | Adds emitter/apiVersion metadata used by TypeSpec testdata tooling. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/tenantactivitylogalerts_client.go | Removes legacy TenantActivityLogAlerts client (AutoRest-era). |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/smartgroups_client.go | Removes legacy SmartGroups client (AutoRest-era). |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/responses.go | Updates response wrapper types for the regenerated client surface. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/README.md | Updates usage snippets to align with new factory signature and client selection. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/prometheusrulegroups_client.go | Removes legacy PrometheusRuleGroups client (AutoRest-era). |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/polymorphic_helpers.go | Updates polymorphic unmarshal helpers to new TypeSpec discriminators/types. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/options.go | Updates options structs to regenerated set (adds tenant variants, enrichments, etc.). |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/operations_client.go | Updates Operations client to API version 2025-05-25-preview and new response shape. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/operations_client_example_test.go | Updates example to new factory signature and new Operations response type. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/interfaces.go | Updates polymorphic interfaces to new TypeSpec-generated shapes. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/go.sum | Updates dependency checksums after azcore/x/* bumps. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/go.mod | Bumps azcore and indirect golang.org/x/* dependencies. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/fake/time_rfc3339.go | Removes AutoRest-era time helper from fake package. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/fake/tenantactivitylogalerts_server.go | Removes legacy fake server for removed TenantActivityLogAlerts client. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/fake/smartgroups_server.go | Removes legacy fake server for removed SmartGroups client. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/fake/server_factory.go | Updates fake server factory to only expose remaining regenerated clients. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/fake/prometheusrulegroups_server.go | Removes legacy fake server for removed PrometheusRuleGroups client. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/fake/operations_server.go | Updates Operations fake server transport for regenerated surface. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/fake/internal.go | Adds shared helpers used by updated fake transports. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/fake/alerts_server.go | Updates Alerts fake server transport for new/tenant/enrichments APIs. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/fake/alertrulerecommendations_server.go | Removes legacy fake server for removed AlertRuleRecommendations client. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/fake/alertprocessingrules_server.go | Removes legacy fake server for removed AlertProcessingRules client. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/constants.go | Updates enums/constants to regenerated TypeSpec definitions; removes module constants from here. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/client_factory.go | Changes factory to accept scope and only construct remaining clients. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/CHANGELOG.md | Documents 0.11.0 breaking changes and newly added APIs/types. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/build.go | Removes AutoRest-era go generate hook file. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/autorest.md | Removes AutoRest configuration. |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/alertrulerecommendations_client.go | Removes legacy AlertRuleRecommendations client (AutoRest-era). |
| sdk/resourcemanager/alertsmanagement/armalertsmanagement/alertprocessingrules_client.go | Removes legacy AlertProcessingRules client (AutoRest-era). |
| refresh-sdk-task.md | Adds a “refresh SDK task” checklist document. |
Comments suppressed due to low confidence (1)
sdk/resourcemanager/alertsmanagement/armalertsmanagement/options.go:35
- The comment text has a stray trailing apostrophe (e.g. "Default value is false'") and some grammatical issues. Please fix these doc comments (or adjust the generator) to avoid shipping typos in public GoDoc.
// Filter by custom time range in the format <start-time>/<end-time> where time is in (ISO-8601 format)'. Permissible values
// is within 30 days from query time. Either timeRange or customTimeRange could be used but not both. Default is none.
CustomTimeRange *string
// Include context which has contextual data specific to the monitor service. Default value is false'
IncludeContext *bool
// Include egress config which would be used for displaying the content in portal. Default value is 'false'.
IncludeEgressConfig *bool
| directory: specification/alertsmanagement/resource-manager/Microsoft.AlertsManagement/AlertsManagement | ||
| commit: 402bf21e472d87c1b3abcd0b2675a8b6c8a42700 | ||
| repo: i-specs | ||
| additionalDirectories: |
There was a problem hiding this comment.
tsp-location.yaml uses repo: i-specs, but the repo tooling/scripts in this repo expect the canonical Azure/azure-rest-api-specs value (see other ARM TypeSpec packages and the repo validation scripts). Update repo to Azure/azure-rest-api-specs so spec provenance validation and regeneration work.
| @@ -63,26 +46,3 @@ func (c *ClientFactory) NewOperationsClient() *OperationsClient { | |||
| internal: c.internal, | |||
| } | |||
| } | |||
There was a problem hiding this comment.
ClientFactory now only exposes Alerts/Operations clients, but the package still contains many example/live tests that reference removed clients (e.g. alertprocessingrules_client_example_test.go, alertrulerecommendations_client_example_test.go, prometheusrulegroups_client_example_test.go, smartgroups_client_example_test.go, tenantactivitylogalerts_client_example_test.go, and alertsmanagement_live_test.go). This will break go test compilation for the module. Regenerate/update or remove those stale tests/examples as part of this PR (or move them into the new packages if the RP has been split).
| } | |
| } | |
| // NewAlertProcessingRulesClient creates a new instance of AlertProcessingRulesClient. | |
| func (c *ClientFactory) NewAlertProcessingRulesClient() *AlertProcessingRulesClient { | |
| return &AlertProcessingRulesClient{ | |
| scope: c.scope, | |
| internal: c.internal, | |
| } | |
| } | |
| // NewAlertRuleRecommendationsClient creates a new instance of AlertRuleRecommendationsClient. | |
| func (c *ClientFactory) NewAlertRuleRecommendationsClient() *AlertRuleRecommendationsClient { | |
| return &AlertRuleRecommendationsClient{ | |
| scope: c.scope, | |
| internal: c.internal, | |
| } | |
| } | |
| // NewPrometheusRuleGroupsClient creates a new instance of PrometheusRuleGroupsClient. | |
| func (c *ClientFactory) NewPrometheusRuleGroupsClient() *PrometheusRuleGroupsClient { | |
| return &PrometheusRuleGroupsClient{ | |
| scope: c.scope, | |
| internal: c.internal, | |
| } | |
| } | |
| // NewSmartGroupsClient creates a new instance of SmartGroupsClient. | |
| func (c *ClientFactory) NewSmartGroupsClient() *SmartGroupsClient { | |
| return &SmartGroupsClient{ | |
| scope: c.scope, | |
| internal: c.internal, | |
| } | |
| } | |
| // NewTenantActivityLogAlertsClient creates a new instance of TenantActivityLogAlertsClient. | |
| func (c *ClientFactory) NewTenantActivityLogAlertsClient() *TenantActivityLogAlertsClient { | |
| return &TenantActivityLogAlertsClient{ | |
| scope: c.scope, | |
| internal: c.internal, | |
| } | |
| } |
sdk/resourcemanager/alertsmanagement/armalertsmanagement/fake/operations_server.go
Show resolved
Hide resolved
| } | ||
| func (a *AlertsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { | ||
| resultChan := make(chan result) | ||
| defer close(resultChan) |
There was a problem hiding this comment.
dispatchToMethodFake closes resultChan via defer close(resultChan) while a goroutine may still attempt to send to it. If the request context is cancelled before the send happens, this can race and panic (send on closed channel). Since the channel is function-local, it doesn't need to be closed; remove the close (or use a buffered channel and ensure the goroutine cannot outlive the receiver).
| defer close(resultChan) |
Automated regeneration of the
alertsmanagementGo SDK using the latest TypeSpec definitions.