Skip to content

Commit

Permalink
Set saas endpoint as global to skip region checks (#483)
Browse files Browse the repository at this point in the history
* Set saas APIs as global

* Add unit test
  • Loading branch information
claudia-correia authored Sep 11, 2024
1 parent ebe4456 commit 0925099
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions pkg/api/client_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ var globalPath = map[string]bool{
"users": true,
"billing": true,
"organizations": true,
"saas": true,
}

type newRuntimeFunc func(region string) *runtimeclient.Runtime
Expand Down
11 changes: 11 additions & 0 deletions pkg/api/client_runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,17 @@ func TestCloudClientRuntime_getRuntime(t *testing.T) {
}},
want: &runtimeclient.Runtime{BasePath: "/api/v1"},
},
{
name: "/saas operation uses the regionless path",
fields: fields{
newRegionRuntime: mocknewRuntimeFunc,
runtime: regionless,
},
args: args{op: &runtime.ClientOperation{
PathPattern: "/saas/billing/prices",
}},
want: &runtimeclient.Runtime{BasePath: "/api/v1"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit 0925099

Please sign in to comment.