Skip to content

Commit

Permalink
Set organizations as global to skip region checks
Browse files Browse the repository at this point in the history
Updates the list of global APIs to include the /organizations endpoint.

Signed-off-by: Marc Lopez Rubio <[email protected]>
  • Loading branch information
marclop committed Jun 21, 2024
1 parent b52676d commit b58409e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
19 changes: 10 additions & 9 deletions pkg/api/client_runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,16 @@ var DefaultBasePath = client.DefaultBasePath
// Strictly, there's no need for a `"key":false` to be present in the map, but
// it does make it explicit and nicer to maintain.
var globalPath = map[string]bool{
"clusters": false,
"comments": false,
"deployments": true,
"phone-home": true,
"platform": false,
"stack": false,
"user": true,
"users": true,
"billing": true,
"clusters": false,
"comments": false,
"deployments": true,
"phone-home": true,
"platform": false,
"stack": false,
"user": true,
"users": true,
"billing": true,
"organizations": 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 @@ -235,6 +235,17 @@ func TestCloudClientRuntime_getRuntime(t *testing.T) {
}},
want: &runtimeclient.Runtime{BasePath: "/api/v1"},
},
{
name: "/billing operation uses the regionless path",
fields: fields{
newRegionRuntime: mocknewRuntimeFunc,
runtime: regionless,
},
args: args{op: &runtime.ClientOperation{
PathPattern: "/organizations/1234123",
}},
want: &runtimeclient.Runtime{BasePath: "/api/v1"},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Expand Down

0 comments on commit b58409e

Please sign in to comment.