• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

snowplow / sql-runner / 15063404311

16 May 2025 07:46AM UTC coverage: 27.73% (+1.0%) from 26.721%
15063404311

push

github

jbeemster
Prepared for release

353 of 1273 relevant lines covered (27.73%)

2.04 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.19
/sql_runner/aws_utils.go
1
// Copyright (c) 2015-2025 Snowplow Analytics Ltd. All rights reserved.
2
//
3
// This program is licensed to you under the Apache License Version 2.0,
4
// and you may not use this file except in compliance with the Apache License Version 2.0.
5
// You may obtain a copy of the Apache License Version 2.0 at http://www.apache.org/licenses/LICENSE-2.0.
6
//
7
// Unless required by applicable law or agreed to in writing,
8
// software distributed under the Apache License Version 2.0 is distributed on an
9
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
// See the Apache License Version 2.0 for the specific language governing permissions and limitations there under.
11
package main
12

13
import (
14
        "fmt"
15

16
        "github.com/aws/aws-sdk-go/aws/credentials"
17
        "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
18
)
19

20
func awsCredentials(creds *credentials.Credentials) (string, error) {
5✔
21
        value, err := creds.Get()
5✔
22
        accessKeyID := value.AccessKeyID
5✔
23
        secretAccessKey := value.SecretAccessKey
5✔
24
        return fmt.Sprintf("CREDENTIALS 'aws_access_key_id=%s;aws_secret_access_key=%s'", accessKeyID, secretAccessKey), err
5✔
25
}
5✔
26

27
func awsEnvCredentials() (string, error) {
2✔
28
        creds := credentials.NewEnvCredentials()
2✔
29
        return awsCredentials(creds)
2✔
30
}
2✔
31

32
func awsProfileCredentials(profile string) (string, error) {
1✔
33
        creds := credentials.NewSharedCredentials("", profile)
1✔
34
        return awsCredentials(creds)
1✔
35
}
1✔
36

37
func awsEC2RoleCredentials() (string, error) {
×
38
        creds := credentials.NewCredentials(&ec2rolecreds.EC2RoleProvider{})
×
39
        return awsCredentials(creds)
×
40
}
×
41

42
func awsChainCredentials(profile string) (string, error) {
2✔
43
        creds := credentials.NewChainCredentials(
2✔
44
                []credentials.Provider{
2✔
45
                        &credentials.EnvProvider{},
2✔
46
                        &credentials.SharedCredentialsProvider{Filename: "", Profile: profile},
2✔
47
                        &ec2rolecreds.EC2RoleProvider{},
2✔
48
                })
2✔
49
        return awsCredentials(creds)
2✔
50
}
2✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc