Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
extend other clients with debug middleware
  • Loading branch information
DiogoFerrao committed May 3, 2024
commit d6715dd1a68f1fdb6b7802611b0e4c70cff9bd54
6 changes: 6 additions & 0 deletions internal/pkg/services/authorization/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*authorization.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = authorization.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/dns/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*dns.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = dns.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/logme/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*logme.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = logme.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/mariadb/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*mariadb.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = mariadb.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/mongodbflex/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*mongodbflex.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = mongodbflex.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/object-storage/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*objectstorage.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = objectstorage.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/opensearch/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*opensearch.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = opensearch.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/postgresflex/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*postgresflex.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = postgresflex.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/rabbitmq/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*rabbitmq.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = rabbitmq.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/redis/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*redis.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = redis.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/resourcemanager/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*resourcemanager.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = resourcemanager.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/secrets-manager/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*secretsmanager.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = secretsmanager.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/service-account/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ func ConfigureClient(p *print.Printer) (*serviceaccount.APIClient, error) {
cfgOptions = append(cfgOptions, sdkConfig.WithEndpoint(customEndpoint))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = serviceaccount.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down
6 changes: 6 additions & 0 deletions internal/pkg/services/ske/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ func ConfigureClient(p *print.Printer) (*ske.APIClient, error) {
cfgOptions = append(cfgOptions, authCfgOption, sdkConfig.WithRegion("eu01"))
}

if p.IsVerbosityDebug() {
cfgOptions = append(cfgOptions,
sdkConfig.WithMiddleware(print.RequestResponseCapturer(p, nil)),
)
}

apiClient, err = ske.NewAPIClient(cfgOptions...)
if err != nil {
p.Debug(print.ErrorLevel, "create new API client: %v", err)
Expand Down