repo_name
stringlengths
1
52
repo_creator
stringclasses
6 values
programming_language
stringclasses
4 values
code
stringlengths
0
9.68M
num_lines
int64
1
234k
eks-anywhere
aws
Go
package diagnostics import ( _ "embed" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/executables" "github.com/aws/eks-anywhere/pkg/filewriter" "github.com/aws/eks-anywhere/pkg/providers" ) type EksaDiagnosticBundleFactoryOpts struct { AnalyzerFactory AnalyzerFactory Client ...
61
eks-anywhere
aws
Go
package diagnostics import ( "context" "time" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/executables" "github.com/aws/eks-anywhere/pkg/providers" ) type BundleClient interface { Collect(ctx context.Context, bundlePath string, since...
63
eks-anywhere
aws
Go
package diagnostics import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" type supportBundle struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` Spec supportBundleSpec `json:"spec,omitempty"` } type supportBundleSpec struct { Collectors []*Collect `json:"collectors,omitempty...
28
eks-anywhere
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: pkg/diagnostics/interfaces.go // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" time "time" v1alpha1 "github.com/aws/eks-anywhere/pkg/api/v1alpha1" cluster "github.com/aws/eks-anywhere/pkg/cluster" di...
630
eks-anywhere
aws
Go
package docker import ( "context" "fmt" "sync" ) type ConcurrentImageProcessor struct { maxRoutines int } func NewConcurrentImageProcessor(maxRoutines int) *ConcurrentImageProcessor { return &ConcurrentImageProcessor{maxRoutines: maxRoutines} } type ImageProcessor func(ctx context.Context, image string) error ...
137
eks-anywhere
aws
Go
package docker_test import ( "context" "errors" "testing" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/pkg/docker" ) func TestConcurrentImageProcessorProcessSuccess(t *testing.T) { tests := []struct { name string images []string maxRoutines int }{ { name: "more jobs t...
114
eks-anywhere
aws
Go
package docker import ( "context" "github.com/aws/eks-anywhere/pkg/logger" ) // ImageDiskSource implements the ImageSource interface, loading images and tags from // a tarbal into the local docker cache. type ImageDiskSource struct { client ImageDiskLoader file string } func NewDiskSource(client ImageDiskLoad...
48
eks-anywhere
aws
Go
package docker_test import ( "context" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/pkg/docker" "github.com/aws/eks-anywhere/pkg/docker/mocks" ) func TestNewDiskSource(t *testing.T) { g := NewWithT(t) ctrl := gomock.NewController(t) client := mocks.NewMo...
41
eks-anywhere
aws
Go
package docker import ( "context" "fmt" "sort" "github.com/aws/eks-anywhere/pkg/types" ) type ImageDiskLoader interface { LoadFromFile(ctx context.Context, filepath string) error } type ImageDiskWriter interface { SaveToFile(ctx context.Context, filepath string, images ...string) error } type ImageTaggerPush...
79
eks-anywhere
aws
Go
package docker_test import ( "context" "errors" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/pkg/docker" "github.com/aws/eks-anywhere/pkg/docker/mocks" ) type moverTest struct { *WithT ctx context.Context src *mocks.MockImageSource dst *mocks....
64
eks-anywhere
aws
Go
package docker import ( "context" "fmt" "runtime" "strings" "github.com/aws/eks-anywhere/pkg/logger" ) // These constants are temporary since currently there is a limitation on harbor // Harbor requires root level projects but curated packages private account currently // doesn't have support for root level. co...
119
eks-anywhere
aws
Go
package docker_test import ( "context" "errors" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/internal/test" "github.com/aws/eks-anywhere/pkg/docker" "github.com/aws/eks-anywhere/pkg/docker/mocks" ) func TestNewRegistryDestination(t *testing.T) { g := New...
142
eks-anywhere
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: pkg/docker/mover.go // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" gomock "github.com/golang/mock/gomock" ) // MockImageDiskLoader is a mock of ImageDiskLoader interface. type MockImageDiskLoader str...
334
eks-anywhere
aws
Go
package eksctl import ( "fmt" "os" ) const VersionEnvVar = "EKSCTL_VERSION" var enabled string func Enabled() bool { return enabled == "true" } func ValidateVersion() error { if os.Getenv(VersionEnvVar) == "" { return fmt.Errorf("unable to retrieve version. Please use the 'eksctl anywhere' command to use EKS...
22
eks-anywhere
aws
Go
package eksctl_test import ( "os" "testing" "github.com/aws/eks-anywhere/pkg/eksctl" ) func TestValidateVersionSuccess(t *testing.T) { t.Setenv(eksctl.VersionEnvVar, "dev") err := eksctl.ValidateVersion() if err != nil { t.Fatalf("ValidateVersion() error = %v, wantErr <nil>", err) } } func TestValidateVers...
30
eks-anywhere
aws
Go
package eksd import ( "context" "fmt" "time" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/constants" "github.com/aws/eks-anywhere/pkg/logger" "github.com/aws/eks-anywhere/pkg/retrier" "github.com/aws/eks-anywhere/pkg/types" ) const ( maxRetries = 5 backOffPeriod = 5 * time....
120
eks-anywhere
aws
Go
package eksd_test import ( "context" "errors" "fmt" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/internal/test" m "github.com/aws/eks-anywhere/internal/test/mocks" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/constants" "gi...
113
eks-anywhere
aws
Go
package eksd import ( "context" "fmt" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/logger" "github.com/aws/eks-anywhere/pkg/types" ) type Upgrader struct { *Installer } // UpgraderOpt allows to customize an eksd upgrader on construction. type UpgraderOpt = InstallerOpt // NewUpg...
55
eks-anywhere
aws
Go
package eksd_test import ( "context" "fmt" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/internal/test" m "github.com/aws/eks-anywhere/internal/test/mocks" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/constants" "github.com/a...
102
eks-anywhere
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: github.com/aws/eks-anywhere/pkg/eksd (interfaces: EksdInstallerClient) // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" types "github.com/aws/eks-anywhere/pkg/types" gomock "github.com/golang/mock/gomo...
51
eks-anywhere
aws
Go
package errors import "k8s.io/apimachinery/pkg/util/errors" // Aggregate represents an object that contains multiple errors, but does not necessarily have singular semantic meaning. // The aggregate can be used with `errors.Is()` to check for the occurrence of a specific error type. // Errors.As() is not supported, b...
24
eks-anywhere
aws
Go
package executables import ( "context" "fmt" ) const awsCliPath = "aws" type AwsCli struct { Executable } func NewAwsCli(executable Executable) *AwsCli { return &AwsCli{ Executable: executable, } } func (ac *AwsCli) CreateAccessKey(ctx context.Context, username string) (string, error) { stdOut, err := ac.E...
27
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" "errors" "testing" "github.com/golang/mock/gomock" "github.com/aws/eks-anywhere/pkg/executables" mockexecutables "github.com/aws/eks-anywhere/pkg/executables/mocks" ) func TestCreateAccessKeySuccess(t *testing.T) { var userName string ctx := context.Backg...
42
eks-anywhere
aws
Go
package executables import ( "context" "fmt" "os" "strings" "github.com/aws/eks-anywhere/pkg/filewriter" "github.com/aws/eks-anywhere/pkg/logger" "github.com/aws/eks-anywhere/pkg/manifests" "github.com/aws/eks-anywhere/pkg/providers/cloudstack/decoder" ) const defaultEksaImage = "public.ecr.aws/l0g8r8j6/eks-...
166
eks-anywhere
aws
Go
package executables_test import ( "context" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/internal/test" "github.com/aws/eks-anywhere/pkg/executables" "github.com/aws/eks-anywhere/pkg/executables/mocks" "github.com/aws/eks-anywhere/pkg/files" "github.com/a...
121
eks-anywhere
aws
Go
package executables import ( "context" "fmt" "strings" "github.com/aws/eks-anywhere/pkg/logger" ) const clusterAwsAdminPath = "clusterawsadm" type Clusterawsadm struct { Executable } func NewClusterawsadm(executable Executable) *Clusterawsadm { return &Clusterawsadm{Executable: executable} } func (c *Cluste...
58
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" "errors" "testing" "github.com/golang/mock/gomock" "github.com/aws/eks-anywhere/pkg/executables" mockexecutables "github.com/aws/eks-anywhere/pkg/executables/mocks" ) func TestBootstrapIamSuccess(t *testing.T) { configFile := "testfile" ctx := context.Ba...
126
eks-anywhere
aws
Go
package executables import ( "context" _ "embed" "fmt" "os" "path" "path/filepath" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/clusterapi" "github.com/aws/eks-anywhere/pkg/constants" "github.com/aws/eks-anywhere/pkg/filewriter" "github.com/aws/eks-anywhere/pkg/manifests" "gi...
429
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" _ "embed" "errors" "fmt" "os" "testing" "time" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/internal/test" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/clusterapi" "github.com/aw...
584
eks-anywhere
aws
Go
package executables import ( "bytes" "context" _ "embed" "encoding/json" "fmt" "os" "path/filepath" "strconv" "strings" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/filewriter" "github.com/aws/eks-anywhere/pkg/logger" "github.com/aws/eks-anywhere/pkg/providers/cloudstac...
522
eks-anywhere
aws
Go
package executables import ( "fmt" "strings" ) type cmkCommandArgs func(*[]string) func newCmkCommand(command string) []string { return strings.Fields(command) } func applyCmkArgs(params *[]string, args ...cmkCommandArgs) { for _, arg := range args { arg(params) } } func appendArgs(new ...string) cmkCommand...
49
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" _ "embed" "errors" "fmt" "path/filepath" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/internal/test" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/executables" mocke...
1,047
eks-anywhere
aws
Go
package executables import ( "bytes" "context" ) type commandRunner interface { Run(cmd *Command) (stdout bytes.Buffer, err error) } type Command struct { commandRunner commandRunner ctx context.Context args []string stdIn []byte envVars map[string]string } func NewCommand(c...
41
eks-anywhere
aws
Go
package executables const ( generatedDir = "generated" overridesDir = "overrides" )
7
eks-anywhere
aws
Go
package executables import ( "context" "fmt" "strconv" "strings" "github.com/aws/eks-anywhere/pkg/logger" ) // Temporary: Curated packages dev and prod accounts are currently hard coded // This is because there is no mechanism to extract these values as of now. const ( dockerPath = "docker" defaultRegi...
154
eks-anywhere
aws
Go
package executables import "context" type DockerContainer interface { Init(ctx context.Context) error Close(ctx context.Context) error ContainerName() string } func NewDockerExecutableBuilder(dockerContainer DockerContainer) *dockerExecutableBuilder { return &dockerExecutableBuilder{ container: dockerContainer...
28
eks-anywhere
aws
Go
package executables import ( "bytes" "context" "fmt" "path/filepath" "strconv" "sync" "time" "github.com/aws/eks-anywhere/pkg/logger" "github.com/aws/eks-anywhere/pkg/retrier" ) type DockerClient interface { Login(ctx context.Context, endpoint, username, password string) error PullImage(ctx context.Contex...
104
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" "errors" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/pkg/executables" "github.com/aws/eks-anywhere/pkg/executables/mocks" "github.com/aws/eks-anywhere/pkg/retrier" ) type dockerContainerTest struct { ...
48
eks-anywhere
aws
Go
package executables import ( "bytes" "context" "fmt" ) const containerNamePrefix = "eksa_" type linuxDockerExecutable struct { cli string containerName string } // This currently returns a linuxDockerExecutable, but if we support other types of docker executables we can change // the name of this con...
59
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" "errors" "fmt" "reflect" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/stretchr/testify/assert" "github.com/aws/eks-anywhere/pkg/executables" mockexecutables "github.com/aws/eks-anywhere/pkg/executables/mocks" ) func T...
284
eks-anywhere
aws
Go
package executables import ( "bytes" "context" "errors" "fmt" "os" "os/exec" "strings" "github.com/aws/eks-anywhere/pkg/config" "github.com/aws/eks-anywhere/pkg/constants" "github.com/aws/eks-anywhere/pkg/logger" "github.com/aws/eks-anywhere/pkg/providers/cloudstack/decoder" ) const ( redactMask = "*****...
135
eks-anywhere
aws
Go
package executables_test import ( "os" "testing" "github.com/aws/eks-anywhere/pkg/constants" "github.com/aws/eks-anywhere/pkg/executables" ) func TestRedactCreds(t *testing.T) { str := "My username is username123. My password is password456" t.Setenv(constants.VSphereUsernameKey, "username123") os.Unsetenv(co...
25
eks-anywhere
aws
Go
package executables import ( "context" "time" ) func KubectlWaitRetryPolicy(k *Kubectl, totalRetries int, err error) (retry bool, wait time.Duration) { return k.kubectlWaitRetryPolicy(totalRetries, err) } func CallKubectlPrivateWait(k *Kubectl, ctx context.Context, kubeconfig string, timeoutTime time.Time, forCon...
15
eks-anywhere
aws
Go
package executables import ( "context" "fmt" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/config" "github.com/aws/eks-anywhere/pkg/git/providers/github" "github.com/aws/eks-anywhere/pkg/types" ) const ( fluxPath = "flux" eksaGithubTokenEnv = "EKSA_...
193
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" "os" "testing" "github.com/golang/mock/gomock" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/config" "github.com/aws/eks-anywhere/pkg/executables" mockexecutables "github.com/aws/eks-anywhere/pkg/executables/mocks" "githu...
560
eks-anywhere
aws
Go
package executables import ( "bufio" "bytes" "context" "crypto/tls" _ "embed" "encoding/json" "fmt" "net/http" "os" "path/filepath" "strconv" "strings" "time" "sigs.k8s.io/yaml" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/config" "github.com/aws/eks-anywhere/pkg/f...
1,146
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" "encoding/json" "errors" "fmt" "net/http" "net/http/httptest" "os" "path/filepath" "reflect" "strconv" "strings" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/internal/test" "github.com/aws/eks-an...
1,646
eks-anywhere
aws
Go
package executables import ( "context" "fmt" "strings" "sigs.k8s.io/yaml" "github.com/aws/eks-anywhere/pkg/logger" "github.com/aws/eks-anywhere/pkg/registrymirror" ) const ( helmPath = "helm" insecureSkipVerifyFlag = "--insecure-skip-tls-verify" ) type Helm struct { executable Executable...
235
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" "errors" "fmt" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/pkg/constants" "github.com/aws/eks-anywhere/pkg/executables" "github.com/aws/eks-anywhere/pkg/executables/mocks" "github.com/aws/eks-anywhere...
332
eks-anywhere
aws
Go
package executables_test import ( "context" "github.com/golang/mock/gomock" "github.com/aws/eks-anywhere/pkg/executables" "github.com/aws/eks-anywhere/pkg/executables/mocks" ) type commandExpect struct { command *executables.Command e *mocks.MockExecutable } func expectCommand(e *mocks.MockExecutable, ...
59
eks-anywhere
aws
Go
package executables import ( "bufio" "context" _ "embed" "errors" "fmt" "os" "path/filepath" "github.com/aws/eks-anywhere/pkg/bootstrapper" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/config" "github.com/aws/eks-anywhere/pkg/filewriter" "github.com/aws/eks-anywhere/pkg/logge...
269
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" "errors" "fmt" "net" "os" "strings" "testing" "github.com/golang/mock/gomock" "github.com/aws/eks-anywhere/internal/test" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/bootstrapper" "github.com/aws/eks-anywhere/pkg/clu...
430
eks-anywhere
aws
Go
package executables import ( "bufio" "bytes" "context" "encoding/json" "fmt" "math" "regexp" "sort" "strconv" "strings" "time" eksdv1alpha1 "github.com/aws/eks-distro-build-tooling/release/api/v1alpha1" etcdv1 "github.com/aws/etcdadm-controller/api/v1beta1" "github.com/pkg/errors" rufiov1alpha1 "github...
2,504
eks-anywhere
aws
Go
package executables_test import ( "bytes" "errors" "testing" . "github.com/onsi/gomega" "sigs.k8s.io/controller-runtime/pkg/client" "github.com/aws/eks-anywhere/internal/test" ) type ( getter func(*kubectlGetterTest) (client.Object, error) kubectlGetterTest struct { *kubectlTest resourceType,...
96
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" _ "embed" "encoding/json" "errors" "fmt" "reflect" "strings" "testing" "time" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" tinkv1alpha1 "github.com/tinkerbell/tink/pkg/apis/core/v1alpha1" appsv1 "k8s.io/api/apps/v1" corev1 "k8s.io/api/co...
3,869
eks-anywhere
aws
Go
package executables import "context" type localExecutableBuilder struct{} func newLocalExecutableBuilder() localExecutableBuilder { return localExecutableBuilder{} } func (b localExecutableBuilder) Build(binaryPath string) Executable { return NewExecutable(binaryPath) } func (b localExecutableBuilder) Init(_ con...
22
eks-anywhere
aws
Go
package executables import ( "bytes" "context" "fmt" "strings" "github.com/aws/eks-anywhere/pkg/logger" ) const sonobuoyPath = "./sonobuoy" type Sonobuoy struct { Executable } func NewSonobuoy(executable Executable) *Sonobuoy { return &Sonobuoy{ Executable: executable, } } func (k *Sonobuoy) Run(ctx con...
68
eks-anywhere
aws
Go
package executables import ( "context" "fmt" ) // SSH is an executable for running SSH commands. type SSH struct { Executable } const ( sshPath = "ssh" strictHostCheckFlag = "StrictHostKeyChecking=no" ) // NewSSH returns a new instance of SSH client. func NewSSH(executable Executable) *SSH { retur...
41
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" "errors" "fmt" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/pkg/executables" mockexecutables "github.com/aws/eks-anywhere/pkg/executables/mocks" ) var ( privateKeyPath = "id_rsa" username = "eks...
50
eks-anywhere
aws
Go
package executables import "sync" type syncSlice struct { internal []string sync.RWMutex } func newSyncSlice() *syncSlice { return &syncSlice{ internal: []string{}, } } func (s *syncSlice) append(v ...string) { s.Lock() defer s.Unlock() s.internal = append(s.internal, v...) } func (s *syncSlice) iterate()...
36
eks-anywhere
aws
Go
package executables import ( "context" "encoding/json" "fmt" "regexp" "time" ) const ( troubleshootPath = "support-bundle" supportBundleArchiveRegex = `support-bundle-([0-9]+(-[0-9]+)+)T([0-9]+(_[0-9]+)+)\.tar\.gz` ) type Troubleshoot struct { Executable } func NewTroubleshoot(executable Executable...
78
eks-anywhere
aws
Go
package executables_test import ( "bytes" "context" "encoding/json" "testing" "time" "github.com/golang/mock/gomock" "github.com/aws/eks-anywhere/pkg/executables" mockexecutables "github.com/aws/eks-anywhere/pkg/executables/mocks" "github.com/aws/eks-anywhere/pkg/types" ) const ( archivePath = "suppor...
69
eks-anywhere
aws
Go
package cmk import ( "github.com/aws/eks-anywhere/pkg/executables" "github.com/aws/eks-anywhere/pkg/filewriter" "github.com/aws/eks-anywhere/pkg/providers/cloudstack" "github.com/aws/eks-anywhere/pkg/providers/cloudstack/decoder" ) // Builder serves as an interface wrapper to wrap the executablesBuilder without c...
24
eks-anywhere
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: github.com/aws/eks-anywhere/pkg/executables (interfaces: Executable,DockerClient,DockerContainer) // Package mocks is a generated GoMock package. package mocks import ( bytes "bytes" context "context" reflect "reflect" executables "github.com/aws/eks-anywhere...
268
eks-anywhere
aws
Go
package features // These are environment variables used as flags to enable/disable features. const ( CloudStackKubeVipDisabledEnvVar = "CLOUDSTACK_KUBE_VIP_DISABLED" FullLifecycleAPIEnvVar = "FULL_LIFECYCLE_API" FullLifecycleGate = "FullLifecycleAPI" CheckpointEnabledEnvVar = "CHECK...
71
eks-anywhere
aws
Go
package features import ( "fmt" "os" "sync" "testing" . "github.com/onsi/gomega" ) const ( fakeFeatureEnvVar = "fakeFeatureEnvVar" fakeFeatureGate = "fakeFeatureGate" ) func fakeFeature() Feature { return Feature{ Name: "Core components upgrade", IsActive: globalFeatures.isActiveForEnvVar(fakeFeat...
72
eks-anywhere
aws
Go
package features import ( "os" "strings" "sync" ) var globalFeatures = newFeatures() type features struct { cache *mutexMap gates map[string]string initGates sync.Once } func newFeatures() *features { return &features{ cache: newMutexMap(), gates: map[string]string{}, } } func (f *features) fee...
69
eks-anywhere
aws
Go
package features import "sync" func newMutexMap() *mutexMap { return &mutexMap{ internal: make(map[string]bool), } } type mutexMap struct { internal map[string]bool sync.RWMutex } func (m *mutexMap) load(key string) (value bool, ok bool) { m.RLock() result, ok := m.internal[key] m.RUnlock() return result,...
34
eks-anywhere
aws
Go
package features import ( "testing" . "github.com/onsi/gomega" ) func TestMutexMapLoadAndStore(t *testing.T) { g := NewWithT(t) m := newMutexMap() key := "key" value := true v, ok := m.load(key) g.Expect(ok).To(BeFalse()) g.Expect(v).To(BeFalse()) m.store(key, value) v, ok = m.load(key) g.Expect(ok).To...
41
eks-anywhere
aws
Go
//go:build files_embed_fs // +build files_embed_fs package files import "embed" // embedFS is used to conditionally embed files in the binary. Only one // of embed_config.go and empty_embed.go will be used, following // `files_embed_fs` build tag. // //go:embed config var embedFS embed.FS
14
eks-anywhere
aws
Go
//go:build !files_embed_fs // +build !files_embed_fs package files import "embed" // embedFS is used to conditionally embed files in the binary. Only one // of embed_config.go and empty_embed.go will be used, following // `files_embed_fs` build tag. var embedFS embed.FS
12
eks-anywhere
aws
Go
package files import ( "crypto/tls" "crypto/x509" "embed" "fmt" "io" "net/http" "net/url" "os" "strings" "time" "golang.org/x/net/http/httpproxy" ) const ( httpsScheme = "https" embedScheme = "embed" ) type Reader struct { embedFS embed.FS httpClient *http.Client userAgent string } type ReaderO...
169
eks-anywhere
aws
Go
package files_test import ( "crypto/x509" "embed" "io" "net" "net/http" "net/http/httptest" "net/url" "sync" "testing" "time" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/internal/test" "github.com/aws/eks-anywhere/pkg/files" ) //go:embed testdata var testdataFS embed.FS func TestReaderRead...
260
eks-anywhere
aws
Go
package files import ( "testing" . "github.com/onsi/gomega" ) func TestWithEKSAUserAgent(t *testing.T) { g := NewWithT(t) r := NewReader(WithEKSAUserAgent("cli", "v0.10.0")) g.Expect(r.userAgent).To(Equal("eks-a-cli/v0.10.0")) }
14
eks-anywhere
aws
Go
package filewriter import ( "io" "os" ) type FileWriter interface { Write(fileName string, content []byte, f ...FileOptionsFunc) (path string, err error) WithDir(dir string) (FileWriter, error) CleanUp() CleanUpTemp() Dir() string TempDir() string Create(name string, f ...FileOptionsFunc) (_ io.WriteCloser, ...
24
eks-anywhere
aws
Go
package filewriter import ( "os" ) const DefaultTmpFolder = "generated" func defaultFileOptions() *FileOptions { return &FileOptions{true, os.ModePerm} } func Permission0600(op *FileOptions) { op.Permissions = 0o600 } func PersistentFile(op *FileOptions) { op.IsTemp = false }
20
eks-anywhere
aws
Go
package filewriter_test import ( "os" "path" "path/filepath" "strings" "testing" "github.com/google/go-cmp/cmp" "github.com/aws/eks-anywhere/pkg/filewriter" ) func TestTmpWriterWriteValid(t *testing.T) { folder := "tmp_folder" folder2 := "tmp_folder_2" err := os.MkdirAll(folder2, os.ModePerm) if err != n...
159
eks-anywhere
aws
Go
package filewriter import ( "errors" "fmt" "io" "io/fs" "os" "path/filepath" ) type writer struct { dir string tempDir string } func NewWriter(dir string) (FileWriter, error) { newFolder := filepath.Join(dir, DefaultTmpFolder) if _, err := os.Stat(newFolder); errors.Is(err, os.ErrNotExist) { err := o...
99
eks-anywhere
aws
Go
package filewriter_test import ( "fmt" "os" "path/filepath" "strings" "testing" "github.com/aws/eks-anywhere/internal/test" "github.com/aws/eks-anywhere/pkg/filewriter" ) func TestWriterWriteValid(t *testing.T) { folder := "tmp_folder" folder2 := "tmp_folder_2" err := os.MkdirAll(folder2, os.ModePerm) if ...
204
eks-anywhere
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: github.com/aws/eks-anywhere/pkg/filewriter (interfaces: FileWriter) // Package mocks is a generated GoMock package. package mocks import ( io "io" reflect "reflect" filewriter "github.com/aws/eks-anywhere/pkg/filewriter" gomock "github.com/golang/mock/gomock"...
145
eks-anywhere
aws
Go
package git import ( "context" "fmt" ) type Client interface { Add(filename string) error Remove(filename string) error Clone(ctx context.Context) error Commit(message string) error Push(ctx context.Context) error Pull(ctx context.Context, branch string) error Init() error Branch(name string) error Validat...
100
eks-anywhere
aws
Go
package gitfactory import ( "context" "fmt" "os" "path" "path/filepath" "strings" "github.com/go-git/go-git/v5/plumbing/transport" "github.com/go-git/go-git/v5/plumbing/transport/http" gogitssh "github.com/go-git/go-git/v5/plumbing/transport/ssh" "golang.org/x/crypto/ssh" "github.com/aws/eks-anywhere/pkg/...
159
eks-anywhere
aws
Go
package gitfactory_test import ( "context" "testing" v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/aws/eks-anywhere/internal/test" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" gitFactory "github.com/aws/eks-anywhere/pkg/git/factory" "github.com/aws/eks-anywhere/pkg/git/providers/github" ) const ( ...
72
eks-anywhere
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: pkg/git/factory/gitfactory.go // Package mocks is a generated GoMock package. package mocks
6
eks-anywhere
aws
Go
package gitclient import ( "context" "errors" "fmt" "os" "strings" "time" gogit "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" "github.com/go-git/go-git/v5/plumbing/transport" "github.com/go-git/go-git...
447
eks-anywhere
aws
Go
package gitclient_test import ( "context" "fmt" "reflect" "testing" goGit "github.com/go-git/go-git/v5" "github.com/go-git/go-git/v5/config" "github.com/go-git/go-git/v5/plumbing" "github.com/go-git/go-git/v5/plumbing/object" "github.com/go-git/go-git/v5/plumbing/transport" "github.com/go-git/go-git/v5/plum...
349
eks-anywhere
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: github.com/aws/eks-anywhere/pkg/git/gitclient (interfaces: GoGit) // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" git "github.com/go-git/go-git/v5" config "github.com/go-git/go-git/v5/config" plumbin...
304
eks-anywhere
aws
Go
package gogithub import ( "context" "errors" "fmt" "net/http" "strings" "time" goGithub "github.com/google/go-github/v35/github" "golang.org/x/oauth2" "github.com/aws/eks-anywhere/pkg/git" "github.com/aws/eks-anywhere/pkg/logger" "github.com/aws/eks-anywhere/pkg/retrier" ) type GoGithub struct { Opts ...
250
eks-anywhere
aws
Go
package gogithub_test import ( "context" "errors" "fmt" "net/http" "net/url" "reflect" "testing" "github.com/golang/mock/gomock" "github.com/google/go-github/v35/github" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/pkg/git" "github.com/aws/eks-anywhere/pkg/git/gogithub" mockGoGithub "github.c...
503
eks-anywhere
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: github.com/aws/eks-anywhere/pkg/git/gogithub (interfaces: Client) // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" gomock "github.com/golang/mock/gomock" github "github.com/google/go-github/v35/github"...
147
eks-anywhere
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: github.com/aws/eks-anywhere/pkg/git (interfaces: Client,ProviderClient) // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" git "github.com/aws/eks-anywhere/pkg/git" gomock "github.com/golang/mock/gomock"...
273
eks-anywhere
aws
Go
package github import ( "context" "errors" "fmt" "os" "regexp" "strings" goGithub "github.com/google/go-github/v35/github" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/git" "github.com/aws/eks-anywhere/pkg/logger" ) const ( GitProviderName = "github" EksaGithubToken...
168
eks-anywhere
aws
Go
package github_test import ( "context" "fmt" "math/rand" "reflect" "testing" "github.com/golang/mock/gomock" goGithub "github.com/google/go-github/v35/github" "github.com/stretchr/testify/assert" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/git" "github.com/aws/eks-anywh...
243
eks-anywhere
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: github.com/aws/eks-anywhere/pkg/git/providers/github (interfaces: GithubClient) // Package mocks is a generated GoMock package. package mocks import ( context "context" reflect "reflect" git "github.com/aws/eks-anywhere/pkg/git" gomock "github.com/golang/mock...
170
eks-anywhere
aws
Go
package flux import ( "context" "strconv" "time" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/config" "github.com/aws/eks-anywhere/pkg/executables" "github.com/aws/eks-anywhere/pkg/retrier" "github.com/aws/eks-anywhere/pkg/types" ) ...
133
eks-anywhere
aws
Go
package flux import ( "context" "errors" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/internal/test" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/gitops/flux/mocks" "github.com/aws/eks-anywhere/pkg/retrier" "github.com/...
198
eks-anywhere
aws
Go
package flux import ( "context" "errors" "fmt" "path" "path/filepath" "strings" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/git" "github.com/aws/eks-anywhere/pkg/logger" "github.com/aws/eks-anywhere/pkg/providers" "github.com/aws/eks-anywhere/pkg/validations" ) // fluxForClu...
263
eks-anywhere
aws
Go
package flux import ( _ "embed" "fmt" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/clustermarshaller" "github.com/aws/eks-anywhere/pkg/filewriter" "github.com/aws/eks-anywhere/pkg/providers" "github.com/aws/eks-anywhere/pkg/templater" ) const ( eksaSystemDirName = "eksa-syst...
165
eks-anywhere
aws
Go
package flux_test import ( "context" "errors" "testing" "github.com/golang/mock/gomock" . "github.com/onsi/gomega" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/cluster" writerMocks "github.com/aws/eks-anywhere/pkg/filewriter/mocks" "github.com/aws/eks-anywhere/pkg/gitops/f...
276
eks-anywhere
aws
Go
package flux import ( "context" "fmt" "path" "github.com/aws/eks-anywhere/pkg/api/v1alpha1" "github.com/aws/eks-anywhere/pkg/cluster" "github.com/aws/eks-anywhere/pkg/config" "github.com/aws/eks-anywhere/pkg/filewriter" "github.com/aws/eks-anywhere/pkg/git" gitFactory "github.com/aws/eks-anywhere/pkg/git/fac...
317