/
aws.go
51 lines (42 loc) · 1.31 KB
/
aws.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
package aws
import (
"github.com/spf13/cobra"
awssdk "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/openshift/cloud-credential-operator/pkg/cmd/provisioning"
)
type options struct {
TargetDir string
PublicKeyPath string
Region string
Name string
CredRequestDir string
IdentityProviderARN string
PermissionsBoundaryARN string
DryRun bool
EnableTechPreview bool
CreatePrivateS3Bucket bool
}
// NewAWSCmd implements the "aws" subcommand for the credentials provisioning
func NewAWSCmd() *cobra.Command {
createCmd := &cobra.Command{
Use: "aws",
Short: "Manage credentials objects for AWS cloud",
Long: "Creating/updating/deleting cloud credentials objects for AWS cloud",
}
createCmd.AddCommand(provisioning.NewCreateKeyPairCmd())
createCmd.AddCommand(NewCreateIdentityProviderCmd())
createCmd.AddCommand(NewCreateIAMRolesCmd())
createCmd.AddCommand(NewCreateAllCmd())
createCmd.AddCommand(NewDeleteCmd())
return createCmd
}
func awsSession(region string) (*session.Session, error) {
cfg := awssdk.Config{
Region: awssdk.String(region),
}
return session.NewSessionWithOptions(session.Options{
Config: cfg,
SharedConfigState: session.SharedConfigEnable,
})
}