Skip to content

Commit

Permalink
Comply with CheckApi
Browse files Browse the repository at this point in the history
  • Loading branch information
jefchien committed Oct 20, 2023
1 parent 89f769f commit cc3a946
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ exporter/tencentcloudlogserviceexporter/ @open-telemetry/collect
exporter/zipkinexporter/ @open-telemetry/collector-contrib-approvers @MovieStoreGuy @astencel-sumo @crobert-1

extension/asapauthextension/ @open-telemetry/collector-contrib-approvers @jamesmoessis @MovieStoreGuy
extension/awsmiddleware @open-telemetry/collector-contrib-approvers @jefchien
extension/awsmiddleware/ @open-telemetry/collector-contrib-approvers @jefchien
extension/awsproxy/ @open-telemetry/collector-contrib-approvers @Aneurysm9 @mxiamxia
extension/basicauthextension/ @open-telemetry/collector-contrib-approvers @jpkrohling @svrakitin @frzifus
extension/bearertokenauthextension/ @open-telemetry/collector-contrib-approvers @jpkrohling @pavankrish123 @frzifus
Expand Down
2 changes: 1 addition & 1 deletion extension/awsmiddleware/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ func GetConfigurer(extensions map[component.ID]component.Component, middlewareID
if err != nil {
return nil, err
}
return NewConfigurer(middleware.Handlers()), nil
return newConfigurer(middleware.Handlers()), nil
}
8 changes: 4 additions & 4 deletions extension/awsmiddleware/middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,16 @@ type Configurer struct {
responseHandlers []ResponseHandler
}

// NewConfigurer sets the request/response handlers.
func NewConfigurer(requestHandlers []RequestHandler, responseHandlers []ResponseHandler) *Configurer {
// newConfigurer sets the request/response handlers.
func newConfigurer(requestHandlers []RequestHandler, responseHandlers []ResponseHandler) *Configurer {
return &Configurer{requestHandlers: requestHandlers, responseHandlers: responseHandlers}
}

// ConfigureSDKv1 adds middleware to the AWS SDK v1. Request handlers are added to the
// Build handler list and response handlers are added to the ValidateResponse handler list.
// Build will only be run once per request, but if there are errors, ValidateResponse will
// be run again for each configured retry.
func (c *Configurer) ConfigureSDKv1(handlers *request.Handlers) error {
func (c Configurer) ConfigureSDKv1(handlers *request.Handlers) error {
var errs error
for _, handler := range c.requestHandlers {
if err := appendHandler(&handlers.Build, namedRequestHandler(handler), handler.Position()); err != nil {
Expand All @@ -139,7 +139,7 @@ func (c *Configurer) ConfigureSDKv1(handlers *request.Handlers) error {

// ConfigureSDKv2 adds middleware to the AWS SDK v2. Request handlers are added to the
// Build step and response handlers are added to the Deserialize step.
func (c *Configurer) ConfigureSDKv2(config *aws.Config) error {
func (c Configurer) ConfigureSDKv2(config *aws.Config) error {
var errs error
for _, handler := range c.requestHandlers {
relativePosition, err := toRelativePosition(handler.Position())
Expand Down
8 changes: 4 additions & 4 deletions extension/awsmiddleware/middleware_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestInvalidHandlers(t *testing.T) {
handler.On("Position").Return(HandlerPosition(-1))
middleware := new(MockMiddlewareExtension)
middleware.On("Handlers").Return([]RequestHandler{handler}, []ResponseHandler{handler})
c := NewConfigurer(middleware.Handlers())
c := newConfigurer(middleware.Handlers())
// v1
client := awstesting.NewClient()
err := c.ConfigureSDKv1(&client.Handlers)
Expand Down Expand Up @@ -186,7 +186,7 @@ func TestAppendOrder(t *testing.T) {
requestHandlers,
[]ResponseHandler{handler},
)
c := NewConfigurer(middleware.Handlers())
c := newConfigurer(middleware.Handlers())
// v1
client := awstesting.NewClient(&awsv1.Config{
Region: awsv1.String("mock-region"),
Expand Down Expand Up @@ -223,7 +223,7 @@ func TestConfigureSDKv1(t *testing.T) {
})
require.Equal(t, 3, client.Handlers.Build.Len())
require.Equal(t, 1, client.Handlers.ValidateResponse.Len())
assert.NoError(t, NewConfigurer(middleware.Handlers()).ConfigureSDKv1(&client.Handlers))
assert.NoError(t, newConfigurer(middleware.Handlers()).ConfigureSDKv1(&client.Handlers))
assert.Equal(t, 5, client.Handlers.Build.Len())
assert.Equal(t, 2, client.Handlers.ValidateResponse.Len())
s3Client := &s3v1.S3{Client: client}
Expand All @@ -238,7 +238,7 @@ func TestConfigureSDKv2(t *testing.T) {
middleware, recorder, server := setup(t)
defer server.Close()
cfg := awsv2.Config{Region: "us-east-1", RetryMaxAttempts: 0}
assert.NoError(t, NewConfigurer(middleware.Handlers()).ConfigureSDKv2(&cfg))
assert.NoError(t, newConfigurer(middleware.Handlers()).ConfigureSDKv2(&cfg))
s3Client := s3v2.NewFromConfig(cfg, func(options *s3v2.Options) {
options.BaseEndpoint = awsv2.String(server.URL)
})
Expand Down

0 comments on commit cc3a946

Please sign in to comment.