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
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package diff import ( "os" "testing" "github.com/stretchr/testify/require" "gopkg.in/yaml.v3" ) func TestIntrinsicFuncConverters(t *testing.T) { testCases := map[string]struct { curr string old ...
563
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package diff import ( "fmt" "io" "github.com/aws/copilot-cli/internal/pkg/term/color" "github.com/dustin/go-humanize/english" ) const ( prefixAdd = "+" prefixDel = "-" prefixMod = "~" ) const indentI...
147
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package diff import ( "strings" "testing" "github.com/stretchr/testify/require" ) func Test_Integration_Parse_Write(t *testing.T) { testCases := map[string]struct { curr string old string want...
407
copilot-cli
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: ./internal/pkg/template/template.go // Package mocks is a generated GoMock package. package mocks import ( fs "io/fs" reflect "reflect" template "github.com/aws/copilot-cli/internal/pkg/template" gomock "github.com/golang/mock/gomock" ) // MockReader is a mo...
221
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package override provides functionality to replace content from vended templates. package override import ( "bytes" "fmt" "gopkg.in/yaml.v3" ) // CloudFormationTemplate overrides the given CloudFormati...
107
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package override import ( "fmt" "os" "path/filepath" "testing" "github.com/stretchr/testify/require" "gopkg.in/yaml.v3" ) func newTaskDefPropertyRule(rule Rule) Rule { return Rule{ Path: fmt.Sprint...
218
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package override import ( "fmt" "regexp" "strconv" "strings" "gopkg.in/yaml.v3" ) const ( // PathSegmentSeparator is the separator for path segments. PathSegmentSeparator = "." // seqAppendToLastSymb...
303
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package override import ( "fmt" "testing" "gopkg.in/yaml.v3" "github.com/stretchr/testify/require" ) func Test_parseRules(t *testing.T) { testCases := map[string]struct { inRules []Rule wantedNode...
99
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package templatetest provides test doubles for embedded templates. package templatetest import ( "bytes" "github.com/aws/copilot-cli/internal/pkg/template" ) // Stub stubs template.New and simulates suc...
85
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package color provides functionality to displayed colored text on the terminal. package color import ( "os" "strings" "github.com/AlecAivazis/survey/v2/core" "github.com/fatih/color" ) // Predefined c...
99
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package color import ( "testing" "github.com/AlecAivazis/survey/v2/core" "github.com/fatih/color" "github.com/stretchr/testify/require" ) type envVar struct { env map[string]string } func (e *envVar) l...
57
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package cursor provides functionality to interact with the terminal cursor. package cursor import ( "io" "os" "github.com/AlecAivazis/survey/v2/terminal" ) type cursor interface { Up(n int) Down(n in...
100
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package cursor import ( "io" "strings" "testing" "github.com/AlecAivazis/survey/v2/terminal" "github.com/stretchr/testify/require" ) // TestEraseLine is POSIX-only since the implementation in the underl...
43
copilot-cli
aws
Go
//go:build !windows // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package cursor // Up moves the cursor n lines. func (c *Cursor) Up(n int) { c.c.Up(n) } // Down moves the cursor n lines. func (c *Cursor) Down(n int) { c.c.Down(n) }
17
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package cursor // Up moves the cursor n lines. func (c *Cursor) Up(n int) { c.c.Down(n) } // Down moves the cursor n lines. func (c *Cursor) Down(n int) { c.c.Up(n) }
15
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package log is a wrapper around the fmt package to print messages to the terminal. package log import ( "fmt" "io" "github.com/fatih/color" ) // Decorated io.Writers around standard error and standard ...
210
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package log import ( "io" ) // Logger represents a logging object that writes to an io.Writer lines of outputs. type Logger struct { w io.Writer } // New creates a new Logger. func New(w io.Writer) *Logger...
96
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package log import ( "fmt" "strings" "testing" "github.com/stretchr/testify/require" ) func TestLogger_Success(t *testing.T) { // GIVEN b := &strings.Builder{} logger := New(b) // WHEN logger.Succe...
196
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package log import ( "fmt" "strings" "testing" "github.com/stretchr/testify/require" ) func TestSuccess(t *testing.T) { // GIVEN b := &strings.Builder{} DiagnosticWriter = b // WHEN Success("hello"...
233
copilot-cli
aws
Go
//go:build !windows // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package log // Log message prefixes. const ( successPrefix = "✔" errorPrefix = "✘" )
13
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package log const ( successPrefix = "√" errorPrefix = "X" )
10
copilot-cli
aws
Go
//go:build !windows // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( spin "github.com/briandowns/spinner" ) var charset = spin.CharSets[14]
13
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress var charset = []string{"/", "-", "\\"}
7
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "bytes" "context" "fmt" "io" "strings" "sync" "time" "github.com/aws/copilot-cli/internal/pkg/aws/cloudformation" "github.com/aws/copilot-cli/internal/pkg/stream" "golang.o...
470
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "context" "strings" "testing" "time" "github.com/aws/copilot-cli/internal/pkg/aws/cloudformation/stackset" "github.com/aws/copilot-cli/internal/pkg/aws/cloudformation" "gith...
623
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "bytes" "fmt" "io" "strings" "text/tabwriter" ) const ( nestedComponentPadding = 2 // Leading space characters for rendering a nested component. ) // noopComponent satisfies t...
169
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "strings" "testing" "github.com/stretchr/testify/require" ) func TestNoopComponent_Render(t *testing.T) { // GIVEN buf := new(strings.Builder) c := &noopComponent{} // WHEN ...
222
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "bytes" "fmt" "github.com/aws/copilot-cli/internal/pkg/aws/cloudwatch" "io" "strconv" "sync" "github.com/aws/copilot-cli/internal/pkg/aws/ecs" "github.com/aws/copilot-cli/int...
201
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "github.com/aws/copilot-cli/internal/pkg/aws/cloudwatch" "github.com/aws/copilot-cli/internal/pkg/stream" "github.com/stretchr/testify/require" "strings" "testing" ) func TestRo...
178
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "context" "io" ) // EnvControllerConfig holds the required parameters to create an environment controller component. type EnvControllerConfig struct { // Common configuration. De...
94
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "strings" "testing" "time" "github.com/aws/copilot-cli/internal/pkg/aws/cloudformation" "github.com/stretchr/testify/require" ) func TestEnvControllerComponent_Render(t *testi...
153
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "context" "io" "time" "github.com/aws/copilot-cli/internal/pkg/term/cursor" ) // Renderer is the interface to print a component to a writer. // It returns the number of lines pr...
122
copilot-cli
aws
Go
//go:build !windows // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "os" "time" ) var ( renderInterval = 100 * time.Millisecond // How frequently Render should be invoked. ) func init() { // The CI environment variable is se...
23
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "os" "time" ) var ( // Windows flickers too frequently if the interval is too short. renderInterval = 500 * time.Millisecond // How frequently Render should be invoked. ) func i...
21
copilot-cli
aws
Go
//go:build !windows // This test is not compatible with Windows because it makes POSIX-centric assumptions about terminal output. // // On Windows, these terminal features involve system calls instead of writing escape sequences, which means // that this test case doesn't actually test what it's trying to do on Window...
270
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "fmt" "io" "os" "time" "github.com/briandowns/spinner" ) // Events display settings. const ( minCellWidth = 20 // minimum number of characters in a table's cell. t...
91
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "os" "strings" "testing" "time" "github.com/aws/copilot-cli/internal/pkg/term/progress/mocks" spin "github.com/briandowns/spinner" "github.com/golang/mock/gomock" "github.com...
61
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "fmt" "strings" "github.com/aws/copilot-cli/internal/pkg/term/color" ) var ( notStartedStackStatus = cfnStatus{ value: notStartedResult{}, } alarmOKState = "OK" inAlarmStat...
143
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import "time" type clock interface { now() time.Time } type realClock struct{} func (c realClock) now() time.Time { return time.Now() } type stopWatch struct { startTime time.Time stop...
76
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "io" "text/tabwriter" ) // FileWriter is the interface grouping an io.Writer with the file descriptor method Fd. // Files in the OS, like os.Stderr, implement the FileWriter interf...
72
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package progress import ( "strings" "testing" "github.com/stretchr/testify/require" ) func TestSuffixWriter_Write(t *testing.T) { testCases := map[string]struct { inText string suffix []byte wante...
51
copilot-cli
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: ./internal/pkg/term/progress/render.go // Package mocks is a generated GoMock package. package mocks import ( io "io" reflect "reflect" gomock "github.com/golang/mock/gomock" ) // MockRenderer is a mock of Renderer interface. type MockRenderer struct { ctrl ...
103
copilot-cli
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: ./internal/pkg/term/progress/spinner.go // Package mocks is a generated GoMock package. package mocks import ( reflect "reflect" gomock "github.com/golang/mock/gomock" ) // MockstartStopper is a mock of startStopper interface. type MockstartStopper struct { c...
59
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package summarybar provides renderers for summary bar. package summarybar import ( "bytes" "errors" "fmt" "io" "math" "sort" "strings" "github.com/aws/copilot-cli/internal/pkg/term/progress" ) var...
171
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package summarybar import ( "errors" "strings" "testing" "github.com/stretchr/testify/require" ) func Test_New(t *testing.T) { testCases := map[string]struct { inData []Datum inWidth int in...
317
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package prompt provides functionality to retrieve free-form text, selection, // and confirmation input from the user via a terminal. package prompt import ( "errors" "os" "strings" "github.com/AlecAiva...
325
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package prompt import ( "fmt" "testing" "github.com/AlecAivazis/survey/v2" "github.com/stretchr/testify/require" ) func TestPrompt_Get(t *testing.T) { mockError := fmt.Errorf("error") mockInput := "yes...
183
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package prompt import ( "fmt" "regexp" "strings" "text/tabwriter" "github.com/AlecAivazis/survey/v2" "github.com/aws/copilot-cli/internal/pkg/term/color" ) // Configuration while spacing text with a ta...
202
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package prompt import ( "fmt" "testing" "github.com/AlecAivazis/survey/v2" "github.com/stretchr/testify/require" ) func TestOption_String(t *testing.T) { testCases := map[string]struct { input Option...
349
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package selector import ( "fmt" "sort" "strings" "github.com/aws/copilot-cli/internal/pkg/template" "github.com/aws/copilot-cli/internal/pkg/term/prompt" "gopkg.in/yaml.v3" ) // CFNSelector represents ...
72
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package selector import ( "errors" "testing" "github.com/aws/copilot-cli/internal/pkg/template" "github.com/aws/copilot-cli/internal/pkg/term/prompt" "github.com/aws/copilot-cli/internal/pkg/term/select...
113
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package selector import ( "fmt" "strings" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/copilot-cli/internal/pkg/aws/sessions" "github.com/aws/copilot-cli/internal/pkg/term/prompt" ) const ( ...
135
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package selector import ( "testing" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/copilot-cli/internal/pkg/term/selec...
122
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package selector provides functionality for users to select an application, environment, or service name. package selector import ( "fmt" "github.com/aws/copilot-cli/internal/pkg/term/prompt" "github.c...
115
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package selector import ( "errors" "fmt" "testing" "github.com/aws/copilot-cli/internal/pkg/aws/ec2" "github.com/aws/copilot-cli/internal/pkg/term/selector/mocks" "github.com/golang/mock/gomock" "githu...
222
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package selector import ( "errors" "fmt" "github.com/aws/copilot-cli/internal/pkg/term/color" ) var ( // ErrLocalEnvsNotFound is returned when there are no environment manifests in the workspace. ErrLoc...
69
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package selector import ( "testing" "github.com/stretchr/testify/require" ) func TestErrNoWorkloadInApp_Error(t *testing.T) { err := &errNoWorkloadInApp{ appName: "mockApp", } require.Equal(t, "no wor...
53
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package selector import ( "fmt" "github.com/aws/copilot-cli/internal/pkg/workspace" "os" "path/filepath" "sort" "strings" "github.com/aws/copilot-cli/internal/pkg/term/log" "github.com/aws/copilot-cli...
354
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package selector import ( "errors" "fmt" "github.com/aws/copilot-cli/internal/pkg/workspace" "os" "testing" "github.com/aws/copilot-cli/internal/pkg/term/prompt" "github.com/aws/copilot-cli/internal/pk...
577
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package selector provides functionality for users to select an application, environment, or service name. package selector import ( "errors" "fmt" "sort" "strings" awsecs "github.com/aws/copilot-cli/i...
1,254
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package selector import ( "errors" "fmt" "testing" "github.com/aws/aws-sdk-go/aws" awsecs "github.com/aws/copilot-cli/internal/pkg/aws/ecs" "github.com/aws/copilot-cli/internal/pkg/config" "github.com/...
2,980
copilot-cli
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: ./internal/pkg/term/selector/creds.go // Package mocks is a generated GoMock package. package mocks import ( reflect "reflect" session "github.com/aws/aws-sdk-go/aws/session" gomock "github.com/golang/mock/gomock" ) // MockNames is a mock of Names interface. ...
118
copilot-cli
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: ./internal/pkg/term/selector/ec2.go // Package mocks is a generated GoMock package. package mocks import ( reflect "reflect" ec2 "github.com/aws/copilot-cli/internal/pkg/aws/ec2" gomock "github.com/golang/mock/gomock" ) // MockVPCSubnetLister is a mock of VPC...
66
copilot-cli
aws
Go
// Code generated by MockGen. DO NOT EDIT. // Source: ./internal/pkg/term/selector/selector.go // Package mocks is a generated GoMock package. package mocks import ( reflect "reflect" ecs "github.com/aws/copilot-cli/internal/pkg/aws/ecs" config "github.com/aws/copilot-cli/internal/pkg/config" deploy "github.com/...
864
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package syncbuffer provides a goroutine safe bytes.Buffer as well printing functionality to the terminal. package syncbuffer import ( "bytes" "errors" "io" "strings" "sync" ) // SyncBuffer is a synchr...
96
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package syncbuffer import ( "errors" "fmt" "io" "testing" "github.com/stretchr/testify/require" ) func TestSyncBuffer_Write(t *testing.T) { testCases := map[string]struct { input []byte want...
147
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package syncbuffer provides a goroutine safe bytes.Buffer as well printing functionality to the terminal. package syncbuffer import ( "fmt" "io" "math" "strings" "github.com/aws/copilot-cli/internal/p...
167
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package syncbuffer import ( "bytes" "io" "testing" "github.com/stretchr/testify/require" ) type mockFileWriter struct { io.Writer } func (m mockFileWriter) Fd() uintptr { return 0 } func TestLabeledT...
138
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package version holds variables for generating version information package version const ( // LegacyAppTemplate is the version associated with the application template before we started versioning. Legacy...
27
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package workspace import ( "errors" "fmt" "path/filepath" "github.com/aws/copilot-cli/internal/pkg/term/color" ) // ErrNoPipelineInWorkspace means there was no pipeline manifest in the workspace dir. var...
95
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package workspace import ( "errors" "fmt" "testing" "github.com/stretchr/testify/require" ) func TestIsEmptyErr(t *testing.T) { testCases := map[string]struct { err error wanted bool }{ "shoul...
42
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 // Package workspace contains functionality to manage a user's local workspace. This includes // creating an application directory, reading and writing a summary file to associate the workspace with the applica...
719
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package workspace import ( "errors" "fmt" "os" "path/filepath" "testing" "github.com/spf13/afero" "github.com/stretchr/testify/require" ) // mockBinaryMarshaler implements the encoding.BinaryMarshaler...
1,689
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package client import ( "fmt" "os" "os/exec" "path/filepath" "github.com/onsi/ginkgo/v2" "github.com/onsi/gomega/gexec" ) // NewCLI returns a wrapper around CLI. func NewCLI(path string) (*CLI, error) ...
62
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package client import ( "encoding/json" ) type wkldDescription struct { Name string `json:"name"` Type string `json:"type"` AppName string `json:"app"` } // SvcListOutput contains summaries of serv...
84
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package multi_svc_app_test import ( "fmt" "os" "testing" "time" "github.com/aws/copilot-cli/regression/client" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) var ( toCLI *client.CLI fr...
46
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package multi_svc_app_test import ( "fmt" "net/http" "os" "io" "path/filepath" "github.com/aws/copilot-cli/regression/client" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" ) var _ = Descri...
276
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package main import ( "log" "net/http" "github.com/julienschmidt/httprouter" ) // HealthCheck just returns true if the service is up. func HealthCheck(w http.ResponseWriter, req *http.Request, ps httprout...
43
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package main import ( "log" "net/http" "github.com/julienschmidt/httprouter" ) // HealthCheck just returns true if the service is up. func HealthCheck(w http.ResponseWriter, req *http.Request, ps httprout...
43
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package main import ( "fmt" "io/ioutil" "log" "net/http" "os" "github.com/julienschmidt/httprouter" ) // SimpleGet just returns true no matter what. func SimpleGet(w http.ResponseWriter, req *http.Requ...
71
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package main import ( "fmt" "io/ioutil" "log" "net/http" "os" "github.com/julienschmidt/httprouter" ) // SimpleGet just returns true no matter what. func SimpleGet(w http.ResponseWriter, req *http.Requ...
71
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package main import ( "log" "net/http" "github.com/julienschmidt/httprouter" ) // SimpleGet just returns true no matter what. func SimpleGet(w http.ResponseWriter, req *http.Request, ps httprouter.Params)...
32
copilot-cli
aws
Go
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 package main import ( "log" "net/http" "github.com/julienschmidt/httprouter" ) // SimpleGet just returns true no matter what. func SimpleGet(w http.ResponseWriter, req *http.Request, ps httprouter.Params)...
32
ec2-macos-init
aws
Go
package main import ( "flag" "os" "path/filepath" "github.com/aws/ec2-macos-init/internal/paths" "github.com/aws/ec2-macos-init/lib/ec2macosinit" ) // clean removes old instance history. It has two options: // current - This is the option when -all isn't provided. It only removes the current instance's history....
59
ec2-macos-init
aws
Go
package main import ( "fmt" "log" "os" "path/filepath" "runtime" "github.com/aws/ec2-macos-init/internal/paths" "github.com/aws/ec2-macos-init/lib/ec2macosinit" ) const ( loggingTag = "ec2-macOS-init" ) func main() { const baseDir = paths.DefaultBaseDirectory // Set up logging logger, err := ec2macosini...
83
ec2-macos-init
aws
Go
package main import ( "errors" "fmt" "path/filepath" "sync" "time" "github.com/aws/ec2-macos-init/internal/paths" "github.com/aws/ec2-macos-init/lib/ec2macosinit" ) // run is the main runner for ec2-macOS-init. It handles orchestration of the following major pieces: // 1. Setup instance ID - IMDS must be up...
199
ec2-macos-init
aws
Go
package main import ( "fmt" "math" "time" "github.com/aws/ec2-macos-init/lib/ec2macosinit" ) const ( attemptInterval = 1 // every 1s logInterval = 10.0 // every 10s setupMaxAttempts = 600 // fail after 10m ) // SetupInstanceID is used to setup the instance ID (and IMDSv2 token) the first time. It ...
46
ec2-macos-init
aws
Go
package main import "fmt" var ( // CommitDate is the date of the commit used at build time. CommitDate string // Version is the ec2-macos-init release version for this build. Version string = "0.0.0-dev" ) // printVersion prints the output for the version command. func printVersion() { const gitHubLink = "https...
23
ec2-macos-init
aws
Go
package paths import "path/filepath" const ( // DefaultBaseDirectory is the root directory in which other paths are based upon. DefaultBaseDirectory = "/usr/local/aws/ec2-macos-init" ) const ( // InitTOML is the filename of the configuration for ec2-macos-init. InitTOML = "init.toml" // HistoryJSON is the filen...
35
ec2-macos-init
aws
Go
package ec2macosinit import ( "fmt" "strings" ) // CommandModule contains contains all necessary configuration fields for running a Command module. type CommandModule struct { Cmd []string `toml:"Cmd"` RunAsUser string `toml:"RunAsUser"` EnvironmentVars []string `toml:"EnvironmentVars"` } //...
25
ec2-macos-init
aws
Go
package ec2macosinit import ( "fmt" "os" "github.com/BurntSushi/toml" ) // InitConfig contains all fields expected from an init.toml file as well as things shared by all parts // of the application. type InitConfig struct { HistoryFilename string HistoryPath string IMDS IMDSConfig Instanc...
106
ec2-macos-init
aws
Go
package ec2macosinit import ( "encoding/json" "fmt" "os" ) // FatalCount contains a Count for tracking the number of Fatal exits for this boot type FatalCount struct { Count int `json:"count"` } // fatalCountFile is the file that contains the fatal counter, this is cleared on reboot const fatalCountFile = "/tmp/...
75
ec2-macos-init
aws
Go
package ec2macosinit import ( "fmt" "net/http" "strconv" ) const ( imdsBase = "http://169.254.169.254/latest/" imdsTokenTTL = 21600 tokenEndpoint = "api/token" tokenRequestTTLHeader = "X-aws-ec2-metadata-token-ttl-seconds" tokenHeader = "X-aws-ec2-metadata-token" ) // ...
111
ec2-macos-init
aws
Go
package ec2macosinit import ( "encoding/json" "fmt" "os" "path/filepath" "time" ) // This is unused for now but will allow us to modify the version of this history in the future. const historyVersion = 1 // History contains an instance ID, run time and a slice of individual module histories. type History struct...
172
ec2-macos-init
aws
Go
package ec2macosinit import ( "fmt" "log" "log/syslog" "os" ) // Logger contains booleans for where to log, a tag used in syslog and the syslog Writer itself. type Logger struct { LogToStdout bool LogToSystemLog bool Tag string SystemLog *syslog.Writer } // NewLogger creates a new logger. ...
107
ec2-macos-init
aws
Go
package ec2macosinit import ( "fmt" "strconv" "strings" "github.com/aws/ec2-macos-init/internal/paths" "github.com/google/go-cmp/cmp" ) // Module contains a few fields common to all Module types and containers for the configuration of any // potential module type. type Module struct { Type stri...
188
ec2-macos-init
aws
Go
package ec2macosinit import ( "fmt" "testing" "time" ) func TestModule_validateModule(t *testing.T) { tests := []struct { name string fields Module wantErr bool }{ { name: "Bad case: 0 Run Types set", fields: Module{}, wantErr: true, }, { name: "Bad case: 3 Run Types set", fiel...
309
ec2-macos-init
aws
Go
package ec2macosinit import ( "fmt" "os" "regexp" "strings" ) const ( motdFile = "/etc/motd" ) // MOTDModule contains all necessary configuration fields for running a MOTD module. type MOTDModule struct { UpdateName bool `toml:"UpdateName"` // UpdateName specifies if the MOTDModule should run or not } // Do f...
89
ec2-macos-init
aws
Go
package ec2macosinit import ( "fmt" "net" "strings" "time" "github.com/digineo/go-ping" ) const ( pingCountDefault = 3 pingPayloadSize = 56 ) // NetworkCheckModule contains contains all necessary configuration fields for running a NetworkCheck module. type NetworkCheckModule struct { PingCount int `toml:"P...
58
ec2-macos-init
aws
Go
package ec2macosinit import ( "bufio" "fmt" "os" "path/filepath" "strings" ) // SSHKeysModule contains all necessary configuration fields for running an SSH Keys module. type SSHKeysModule struct { DedupKeys bool `toml:"DedupKeys"` GetIMDSOpenSSHKey bool `toml:"GetIMDSOpenSSHKey"` ...
146