diff --git a/source/falcon_data_replicator/client.go b/source/falcon_data_replicator/client.go index 93a1b31..89003d0 100644 --- a/source/falcon_data_replicator/client.go +++ b/source/falcon_data_replicator/client.go @@ -50,8 +50,8 @@ type awsConfig struct { type client struct { AWS awsConfig - NewSQS func(cfg aws.Config, optFns ...func(*sqs.Options)) interfaces.SQS `json:"-"` - NewS3 func(cfg aws.Config, optFns ...func(*s3.Options)) interfaces.S3 `json:"-"` + newSQS func(cfg aws.Config, optFns ...func(*sqs.Options)) interfaces.SQS + newS3 func(cfg aws.Config, optFns ...func(*s3.Options)) interfaces.S3 MaxPull int } @@ -78,10 +78,10 @@ func New(awsRegion, awsAccessKeyId string, awsSecretAccessKey secret.String, sqs cred: credentials.NewStaticCredentialsProvider(awsAccessKeyId, awsSecretAccessKey.Unsafe(), ""), }, - NewSQS: func(cfg aws.Config, optFns ...func(*sqs.Options)) interfaces.SQS { + newSQS: func(cfg aws.Config, optFns ...func(*sqs.Options)) interfaces.SQS { return sqs.NewFromConfig(cfg, optFns...) }, - NewS3: func(cfg aws.Config, optFns ...func(*s3.Options)) interfaces.S3 { + newS3: func(cfg aws.Config, optFns ...func(*s3.Options)) interfaces.S3 { return s3.NewFromConfig(cfg, optFns...) }, @@ -112,8 +112,8 @@ func New(awsRegion, awsAccessKeyId string, awsSecretAccessKey secret.String, sqs } // Create AWS service clients - s3Client := x.NewS3(cfg) - sqsClient := x.NewSQS(cfg) + s3Client := x.newS3(cfg) + sqsClient := x.newSQS(cfg) // Receive messages from SQS queue input := &sqs.ReceiveMessageInput{ diff --git a/source/one_password/one_password.go b/source/one_password/one_password.go index 2c92134..6d7653a 100644 --- a/source/one_password/one_password.go +++ b/source/one_password/one_password.go @@ -33,7 +33,7 @@ type config struct { MaxPages int Limit int Duration time.Duration - HTTPClient interfaces.HTTPClient + httpClient interfaces.HTTPClient } type Option func(*config) @@ -62,7 +62,7 @@ func WithDuration(d time.Duration) Option { // WithHTTPClient sets the HTTP client to send requests. Default is http.DefaultClient. This option is mainly for testing. func WithHTTPClient(httpClient interfaces.HTTPClient) Option { return func(x *config) { - x.HTTPClient = httpClient + x.httpClient = httpClient } } @@ -73,7 +73,7 @@ func New(apiToken secret.String, opts ...Option) hatchery.Source { MaxPages: 0, Limit: 100, Duration: time.Minute * 10, - HTTPClient: http.DefaultClient, + httpClient: http.DefaultClient, } for _, opt := range opts { @@ -133,7 +133,7 @@ func (x *config) crawl(ctx context.Context, p *hatchery.Pipe, end time.Time, seq httpReq.Header.Set("Content-Type", "application/json") httpReq.Header.Set("Authorization", "Bearer "+x.APIToken.Unsafe()) - httpResp, err := x.HTTPClient.Do(httpReq) + httpResp, err := x.httpClient.Do(httpReq) if err != nil { return nil, goerr.Wrap(err, "failed to send HTTP request") } diff --git a/source/slack/slack.go b/source/slack/slack.go index 35550de..50e39bc 100644 --- a/source/slack/slack.go +++ b/source/slack/slack.go @@ -35,13 +35,13 @@ type config struct { Duration time.Duration // httpClient is a HTTP client to send requests to Slack API. - HTTPClient interfaces.HTTPClient + httpClient interfaces.HTTPClient } func New(accessToken secret.String, options ...Option) hatchery.Source { c := &config{ AccessToken: accessToken, - HTTPClient: http.DefaultClient, + httpClient: http.DefaultClient, Duration: 10 * time.Minute, Limit: 100, MaxPages: 0, @@ -100,7 +100,7 @@ func WithDuration(duration time.Duration) Option { // WithHTTPClient sets a HTTP client to send requests to Slack API. func WithHTTPClient(httpClient interfaces.HTTPClient) Option { return func(c *config) { - c.HTTPClient = httpClient + c.httpClient = httpClient } } @@ -136,7 +136,7 @@ func (x *config) crawl(ctx context.Context, end time.Time, seq int, cursor strin httpReq.Header.Set("Content-Type", "application/json") httpReq.Header.Set("Authorization", "Bearer "+x.AccessToken.Unsafe()) - httpResp, err := x.HTTPClient.Do(httpReq) + httpResp, err := x.httpClient.Do(httpReq) if err != nil { return nil, goerr.Wrap(err, "failed to send HTTP request") }