@@ -39,18 +39,19 @@ import (
3939)
4040
4141type UCPApplicationsManagementClient struct {
42- RootScope string
43- ClientOptions * arm.ClientOptions
44- genericResourceClientFactory func (scope string , resourceType string ) (genericResourceClient , error )
45- applicationResourceClientFactory func (scope string ) (applicationResourceClient , error )
46- environmentResourceClientFactory func (scope string ) (environmentResourceClient , error )
47- recipePackResourceClientFactory func (scope string ) (recipePackResourceClient , error )
48- resourceGroupClientFactory func () (resourceGroupClient , error )
49- resourceProviderClientFactory func () (resourceProviderClient , error )
50- resourceTypeClientFactory func () (resourceTypeClient , error )
51- apiVersionClientFactory func () (apiVersionClient , error )
52- locationClientFactory func () (locationClient , error )
53- capture func (ctx context.Context , capture * * http.Response ) context.Context
42+ RootScope string
43+ ClientOptions * arm.ClientOptions
44+ genericResourceClientFactory func (scope string , resourceType string ) (genericResourceClient , error )
45+ applicationResourceClientFactory func (scope string ) (applicationResourceClient , error )
46+ environmentResourceClientFactory func (scope string ) (environmentResourceClient , error )
47+ recipePackResourceClientFactory func (scope string ) (recipePackResourceClient , error )
48+ radiusCoreEnvironmentResourceClientFactory func (scope string ) (radiusCoreEnvironmentResourceClient , error )
49+ resourceGroupClientFactory func () (resourceGroupClient , error )
50+ resourceProviderClientFactory func () (resourceProviderClient , error )
51+ resourceTypeClientFactory func () (resourceTypeClient , error )
52+ apiVersionClientFactory func () (apiVersionClient , error )
53+ locationClientFactory func () (locationClient , error )
54+ capture func (ctx context.Context , capture * * http.Response ) context.Context
5455}
5556
5657var _ ApplicationsManagementClient = (* UCPApplicationsManagementClient )(nil )
@@ -519,6 +520,46 @@ func (amc *UCPApplicationsManagementClient) ListEnvironmentsAll(ctx context.Cont
519520 return environments , nil
520521}
521522
523+ // ListRadiusCoreEnvironmentsAll queries the plane scope for all Radius.Core environment resources
524+ // across all resource groups and returns them as a slice. It mirrors ListEnvironmentsAll, but
525+ // targets Radius.Core/environments (v20250801preview) instead of Applications.Core/environments
526+ // (v20231001preview).
527+ func (amc * UCPApplicationsManagementClient ) ListRadiusCoreEnvironmentsAll (ctx context.Context ) ([]corerpv20250801.EnvironmentResource , error ) {
528+ scope , err := resources .ParseScope (amc .RootScope )
529+ if err != nil {
530+ return []corerpv20250801.EnvironmentResource {}, err
531+ }
532+
533+ // Query at plane scope, not resource group scope. We don't enforce the exact structure of the scope, so handle both cases.
534+ //
535+ // - /planes/radius/local
536+ // - /planes/radius/local/resourceGroups/my-group
537+ if scope .FindScope (resources_radius .ScopeResourceGroups ) != "" {
538+ scope = scope .Truncate ()
539+ }
540+
541+ // Generated client doesn't like the leading '/' in the scope.
542+ client , err := amc .createRadiusCoreEnvironmentClient (scope .String ())
543+ if err != nil {
544+ return []corerpv20250801.EnvironmentResource {}, err
545+ }
546+
547+ environments := []corerpv20250801.EnvironmentResource {}
548+ pager := client .NewListByScopePager (& corerpv20250801.EnvironmentsClientListByScopeOptions {})
549+ for pager .More () {
550+ page , err := pager .NextPage (ctx )
551+ if err != nil {
552+ return []corerpv20250801.EnvironmentResource {}, err
553+ }
554+
555+ for _ , environment := range page .EnvironmentResourceListResult .Value {
556+ environments = append (environments , * environment )
557+ }
558+ }
559+
560+ return environments , nil
561+ }
562+
522563// GetEnvironment retrieves an environment by its name (in the configured scope) or resource ID.
523564func (amc * UCPApplicationsManagementClient ) GetEnvironment (ctx context.Context , environmentNameOrID string ) (corerpv20231001.EnvironmentResource , error ) {
524565 scope , name , err := amc .extractScopeAndName (environmentNameOrID )
@@ -1223,6 +1264,15 @@ func (amc *UCPApplicationsManagementClient) createEnvironmentClient(scope string
12231264 return amc .environmentResourceClientFactory (scope )
12241265}
12251266
1267+ func (amc * UCPApplicationsManagementClient ) createRadiusCoreEnvironmentClient (scope string ) (radiusCoreEnvironmentResourceClient , error ) {
1268+ if amc .radiusCoreEnvironmentResourceClientFactory == nil {
1269+ // Generated client doesn't like the leading '/' in the scope.
1270+ return corerpv20250801 .NewEnvironmentsClient (strings .TrimPrefix (scope , resources .SegmentSeparator ), & aztoken.AnonymousCredential {}, amc .ClientOptions )
1271+ }
1272+
1273+ return amc .radiusCoreEnvironmentResourceClientFactory (scope )
1274+ }
1275+
12261276func (amc * UCPApplicationsManagementClient ) createGenericClient (scope string , resourceType string , apiVersion ... string ) (genericResourceClient , error ) {
12271277 if amc .genericResourceClientFactory == nil {
12281278 clientOptions := * amc .ClientOptions
0 commit comments