Skip to content

Commit

Permalink
feat: add global region (#1270)
Browse files Browse the repository at this point in the history
* feat: add global region
  • Loading branch information
geffersonFerraz authored Dec 10, 2024
1 parent a2dcfb6 commit 81294d3
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mgc/cli/docs/audit/event-types/list/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Usage:
- --no-confirm Bypasses confirmation step for commands that ask a confirmation from the user
- -o, --output string Change the output format. Use '--output=help' to know more details.
- -r, --raw Output raw data, without any formatting or coloring
- --region enum Region to reach the service (one of "br-mgl1", "br-ne1" or "br-se1") (default "br-se1")
- --region enum Region to reach the service (one of "br-mgl1", "br-ne1", "br-se1" or "global") (default "br-se1")
- --server-url uri Manually specify the server to use

## Flags:
Expand Down
2 changes: 1 addition & 1 deletion mgc/cli/docs/audit/events/list/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Global Flags:
--no-confirm Bypasses confirmation step for commands that ask a confirmation from the user
-o, --output string Change the output format. Use '--output=help' to know more details.
-r, --raw Output raw data, without any formatting or coloring
--region enum Region to reach the service (one of "br-mgl1", "br-ne1" or "br-se1") (default "br-se1")
--region enum Region to reach the service (one of "br-mgl1", "br-ne1", "br-se1" or "global") (default "br-se1")
--server-url uri Manually specify the server to use
```
3 changes: 3 additions & 0 deletions mgc/cli/openapis/audit.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ servers:
- br-ne-1
- br-se1
- br-mgl1
- global
x-mgc-transforms:
- type: translate
allowMissing: true
Expand All @@ -22,6 +23,8 @@ servers:
to: br-ne-1
- from: br-mgl1
to: br-se-1
- from: global
to: global
env:
description: Environment to use
default: api.magalu.cloud
Expand Down
2 changes: 1 addition & 1 deletion mgc/sdk/openapi/embed_loader.go

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions mgc/sdk/static/config/common/list_schemas.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ func ListAllConfigSchemas(ctx context.Context) (map[string]*core.Schema, error)
for name, ref := range executor.ConfigsSchema().Properties {
current := (*core.Schema)(ref.Value)

if name == "region" {
var copyOfCurrent []interface{}
for _, enum := range current.Enum {
if enum != "global" {
copyOfCurrent = append(copyOfCurrent, enum)
}
}
current.Enum = copyOfCurrent
}

if existing, ok := configMap[name]; ok {
if err := mgcSchemaPkg.CompareJsonSchemas(existing, current); err != nil {
listAllSchemasLogger().Warnw("unhandled diverging config", "config", name, "path", path, "current", current, "existing", existing, "error", err)
Expand Down
3 changes: 3 additions & 0 deletions openapi-customizations/audit.openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ servers:
- br-ne-1
- br-se1
- br-mgl1
- global
x-mgc-transforms:
- type: translate
allowMissing: true
Expand All @@ -22,6 +23,8 @@ servers:
to: br-ne-1
- from: br-mgl1
to: br-se-1
- from: global
to: global
env:
description: Environment to use
default: api.magalu.cloud
Expand Down

0 comments on commit 81294d3

Please sign in to comment.