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
session-manager-plugin
aws
Go
// Package ini is an LL(1) parser for configuration files. // // Example: // sections, err := ini.OpenFile("/path/to/file") // if err != nil { // panic(err) // } // // profile := "foo" // section, ok := sections.GetSection(profile) // if !ok { // fmt.Printf("section %q could not be found", profile) // } // // Below i...
43
session-manager-plugin
aws
Go
package ini // emptyToken is used to satisfy the Token interface var emptyToken = newToken(TokenNone, []rune{}, NoneType)
5
session-manager-plugin
aws
Go
package ini // newExpression will return an expression AST. // Expr represents an expression // // grammar: // expr -> string | number func newExpression(tok Token) AST { return newASTWithRootToken(ASTKindExpr, tok) } func newEqualExpr(left AST, tok Token) AST { return newASTWithRootToken(ASTKindEqualExpr, tok, lef...
25
session-manager-plugin
aws
Go
// +build gofuzz package ini import ( "bytes" ) func Fuzz(data []byte) int { b := bytes.NewReader(data) if _, err := Parse(b); err != nil { return 0 } return 1 }
18
session-manager-plugin
aws
Go
// +build fuzz // fuzz test data is stored in Amazon S3. package ini_test import ( "path/filepath" "testing" "github.com/aws/aws-sdk-go/internal/ini" ) // TestFuzz is used to test for crashes and not validity of the input func TestFuzz(t *testing.T) { paths, err := filepath.Glob("testdata/fuzz/*") if err != ni...
30
session-manager-plugin
aws
Go
package ini import ( "io" "os" "github.com/aws/aws-sdk-go/aws/awserr" ) // OpenFile takes a path to a given file, and will open and parse // that file. func OpenFile(path string) (Sections, error) { f, err := os.Open(path) if err != nil { return Sections{}, awserr.New(ErrCodeUnableToReadFile, "unable to open...
52
session-manager-plugin
aws
Go
package ini import ( "bytes" "io" "io/ioutil" "github.com/aws/aws-sdk-go/aws/awserr" ) const ( // ErrCodeUnableToReadFile is used when a file is failed to be // opened or read from. ErrCodeUnableToReadFile = "FailedRead" ) // TokenType represents the various different tokens types type TokenType int func (t...
166
session-manager-plugin
aws
Go
// +build go1.7 package ini import ( "bytes" "io" "reflect" "testing" ) func TestTokenize(t *testing.T) { numberToken := newToken(TokenLit, []rune("123"), IntegerType) numberToken.base = 10 cases := []struct { r io.Reader expectedTokens []Token expectedError bool }{ { r: bytes.NewBuf...
55
session-manager-plugin
aws
Go
package ini import ( "fmt" "io" ) // ParseState represents the current state of the parser. type ParseState uint // State enums for the parse table const ( InvalidState ParseState = iota // stmt -> value stmt' StatementState // stmt' -> MarkComplete | op stmt StatementPrimeState // value -> number | string |...
351
session-manager-plugin
aws
Go
// +build go1.7 package ini import ( "bytes" "fmt" "io" "reflect" "testing" ) func TestParser(t *testing.T) { xID, _, _ := newLitToken([]rune("x = 1234")) s3ID, _, _ := newLitToken([]rune("s3 = 1234")) fooSlashes, _, _ := newLitToken([]rune("//foo")) regionID, _, _ := newLitToken([]rune("region")) regionL...
385
session-manager-plugin
aws
Go
package ini import ( "fmt" "strconv" "strings" ) var ( runesTrue = []rune("true") runesFalse = []rune("false") ) var literalValues = [][]rune{ runesTrue, runesFalse, } func isBoolValue(b []rune) bool { for _, lv := range literalValues { if isLitValue(lv, b) { return true } } return false } func i...
325
session-manager-plugin
aws
Go
// +build go1.7 package ini import ( "reflect" "testing" ) func TestIsNumberValue(t *testing.T) { cases := []struct { name string b []rune expected bool }{ { "integer", []rune("123"), true, }, { "negative integer", []rune("-123"), true, }, { "decimal", []rune("1...
201
session-manager-plugin
aws
Go
package ini func isNewline(b []rune) bool { if len(b) == 0 { return false } if b[0] == '\n' { return true } if len(b) < 2 { return false } return b[0] == '\r' && b[1] == '\n' } func newNewlineToken(b []rune) (Token, int, error) { i := 1 if b[0] == '\r' && isNewline(b[1:]) { i++ } if !isNewline(...
31
session-manager-plugin
aws
Go
package ini import ( "bytes" "fmt" "strconv" ) const ( none = numberFormat(iota) binary octal decimal hex exponent ) type numberFormat int // numberHelper is used to dictate what format a number is in // and what to do for negative values. Since -1e-4 is a valid // number, we cannot just simply check for d...
153
session-manager-plugin
aws
Go
// +build go1.7 package ini import ( "testing" ) func TestNumberHelper(t *testing.T) { cases := []struct { b []rune determineIndex int expectedExists []bool expectedErrors []bool expectedCorrects []bool expectedNegative bool expectedBase int }{ { b: []rune("-1...
197
session-manager-plugin
aws
Go
package ini import ( "fmt" ) var ( equalOp = []rune("=") equalColonOp = []rune(":") ) func isOp(b []rune) bool { if len(b) == 0 { return false } switch b[0] { case '=': return true case ':': return true default: return false } } func newOpToken(b []rune) (Token, int, error) { tok := Token{}...
40
session-manager-plugin
aws
Go
// +build go1.7 package ini import ( "reflect" "testing" ) func TestIsOp(t *testing.T) { cases := []struct { b []rune expected bool }{ { b: []rune(``), }, { b: []rune("123"), }, { b: []rune(`"wee"`), }, { b: []rune("="), expected: true, }, { b: []rune(...
76
session-manager-plugin
aws
Go
package ini import "fmt" const ( // ErrCodeParseError is returned when a parsing error // has occurred. ErrCodeParseError = "INIParseError" ) // ParseError is an error which is returned during any part of // the parsing process. type ParseError struct { msg string } // NewParseError will return a new ParseError...
44
session-manager-plugin
aws
Go
package ini import ( "bytes" "fmt" ) // ParseStack is a stack that contains a container, the stack portion, // and the list which is the list of ASTs that have been successfully // parsed. type ParseStack struct { top int container []AST list []AST index int } func newParseStack(sizeContainer, s...
61
session-manager-plugin
aws
Go
// +build go1.7 package ini import ( "reflect" "testing" ) func newMockAST(v []rune) AST { return newASTWithRootToken(ASTKindNone, Token{raw: v}) } func TestStack(t *testing.T) { cases := []struct { asts []AST expected []AST }{ { asts: []AST{ newMockAST([]rune("0")), newMockAST([]rune("1")...
62
session-manager-plugin
aws
Go
package ini import ( "fmt" ) var ( emptyRunes = []rune{} ) func isSep(b []rune) bool { if len(b) == 0 { return false } switch b[0] { case '[', ']': return true default: return false } } var ( openBrace = []rune("[") closeBrace = []rune("]") ) func newSepToken(b []rune) (Token, int, error) { tok ...
42
session-manager-plugin
aws
Go
// +build go1.7 package ini import ( "reflect" "testing" ) func TestIsSep(t *testing.T) { cases := []struct { b []rune expected bool }{ { b: []rune(``), }, { b: []rune(`"wee"`), }, { b: []rune("["), expected: true, }, { b: []rune("]"), expected: true, },...
73
session-manager-plugin
aws
Go
package ini // skipper is used to skip certain blocks of an ini file. // Currently skipper is used to skip nested blocks of ini // files. See example below // // [ foo ] // nested = ; this section will be skipped // a=b // c=d // bar=baz ; this will be included type skipper struct { shouldSkip bool TokenSet bool...
46
session-manager-plugin
aws
Go
// +build go1.7 package ini import ( "reflect" "testing" ) func TestSkipper(t *testing.T) { idTok, _, _ := newLitToken([]rune("id")) nlTok := newToken(TokenNL, []rune("\n"), NoneType) cases := []struct { name string Fn func(s *skipper) param Token expected ...
88
session-manager-plugin
aws
Go
package ini // Statement is an empty AST mostly used for transitioning states. func newStatement() AST { return newAST(ASTKindStatement, AST{}) } // SectionStatement represents a section AST func newSectionStatement(tok Token) AST { return newASTWithRootToken(ASTKindSectionStatement, tok) } // ExprStatement repres...
36
session-manager-plugin
aws
Go
package ini import ( "reflect" "testing" ) func TestTrimSpaces(t *testing.T) { cases := []struct { name string node AST expectedNode AST }{ { name: "simple case", node: AST{ Root: Token{ raw: []rune("foo"), }, }, expectedNode: AST{ Root: Token{ raw: []rune...
76
session-manager-plugin
aws
Go
package ini import ( "fmt" ) // getStringValue will return a quoted string and the amount // of bytes read // // an error will be returned if the string is not properly formatted func getStringValue(b []rune) (int, error) { if b[0] != '"' { return 0, NewParseError("strings must start with '\"'") } endQuote := ...
285
session-manager-plugin
aws
Go
// +build go1.7 package ini import ( "testing" ) func TestStringValue(t *testing.T) { cases := []struct { b []rune expectedRead int expectedError bool expectedValue string }{ { b: []rune(`"foo"`), expectedRead: 5, expectedValue: `"foo"`, }, { b: []ru...
165
session-manager-plugin
aws
Go
package ini import ( "fmt" "sort" ) // Visitor is an interface used by walkers that will // traverse an array of ASTs. type Visitor interface { VisitExpr(AST) error VisitStatement(AST) error } // DefaultVisitor is used to visit statements and expressions // and ensure that they are both of the correct format. //...
170
session-manager-plugin
aws
Go
package ini // Walk will traverse the AST using the v, the Visitor. func Walk(tree []AST, v Visitor) error { for _, node := range tree { switch node.Kind { case ASTKindExpr, ASTKindExprStatement: if err := v.VisitExpr(node); err != nil { return err } case ASTKindStatement, ASTKindCompletedSecti...
26
session-manager-plugin
aws
Go
// +build go1.7 package ini import ( "encoding/json" "io/ioutil" "os" "path/filepath" "strings" "testing" ) func TestValidDataFiles(t *testing.T) { const expectedFileSuffix = "_expected" filepath.Walk("./testdata/valid", func(path string, info os.FileInfo, err error) error { if strings.HasSuffix(path, expe...
157
session-manager-plugin
aws
Go
package ini import ( "unicode" ) // isWhitespace will return whether or not the character is // a whitespace character. // // Whitespace is defined as a space or tab. func isWhitespace(c rune) bool { return unicode.IsSpace(c) && c != '\n' && c != '\r' } func newWSToken(b []rune) (Token, int, error) { i := 0 for ...
25
session-manager-plugin
aws
Go
package s3err import ( "fmt" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" ) // RequestFailure provides additional S3 specific metadata for the request // failure. type RequestFailure struct { awserr.RequestFailure hostID string } // NewRequestFailure returns a request failure...
58
session-manager-plugin
aws
Go
package s3shared import ( "fmt" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/internal/s3shared/arn" ) const ( invalidARNErrorErrCode = "InvalidARNError" configurationErrorErrCode = "ConfigurationError" ) // InvalidARNError denotes the error for Invalid ARN type InvalidARNError struct { ...
203
session-manager-plugin
aws
Go
package s3shared import ( "strings" "github.com/aws/aws-sdk-go/aws" awsarn "github.com/aws/aws-sdk-go/aws/arn" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/internal/s3shared/arn" ) // ResourceRequest represents the request and arn resource type ResourceRequest struct { Resource arn.Resour...
65
session-manager-plugin
aws
Go
package arn import ( "strings" "github.com/aws/aws-sdk-go/aws/arn" ) // AccessPointARN provides representation type AccessPointARN struct { arn.ARN AccessPointName string } // GetARN returns the base ARN for the Access Point resource func (a AccessPointARN) GetARN() arn.ARN { return a.ARN } // ParseAccessPoin...
51
session-manager-plugin
aws
Go
// +build go1.7 package arn import ( "reflect" "strings" "testing" "github.com/aws/aws-sdk-go/aws/arn" ) func TestParseAccessPointResource(t *testing.T) { cases := map[string]struct { ARN arn.ARN ExpectErr string ExpectARN AccessPointARN }{ "region not set": { ARN: arn.ARN{ Partition: "aw...
110
session-manager-plugin
aws
Go
package arn import ( "fmt" "strings" "github.com/aws/aws-sdk-go/aws/arn" ) var supportedServiceARN = []string{ "s3", "s3-outposts", "s3-object-lambda", } func isSupportedServiceARN(service string) bool { for _, name := range supportedServiceARN { if name == service { return true } } return false } ...
95
session-manager-plugin
aws
Go
// +build go1.7 package arn import ( "reflect" "strings" "testing" "github.com/aws/aws-sdk-go/aws/arn" ) func TestParseResource(t *testing.T) { cases := map[string]struct { Input string MappedResources map[string]func(arn.ARN, []string) (Resource, error) Expect Resource ExpectErr ...
177
session-manager-plugin
aws
Go
package arn import ( "strings" "github.com/aws/aws-sdk-go/aws/arn" ) // OutpostARN interface that should be satisfied by outpost ARNs type OutpostARN interface { Resource GetOutpostID() string } // ParseOutpostARNResource will parse a provided ARNs resource using the appropriate ARN format // and return a speci...
127
session-manager-plugin
aws
Go
// +build go1.7 package arn import ( "reflect" "strings" "testing" "github.com/aws/aws-sdk-go/aws/arn" ) func TestParseOutpostAccessPointARNResource(t *testing.T) { cases := map[string]struct { ARN arn.ARN ExpectErr string ExpectARN OutpostAccessPointARN }{ "region not set": { ARN: arn.ARN{ ...
274
session-manager-plugin
aws
Go
package arn // S3ObjectLambdaARN represents an ARN for the s3-object-lambda service type S3ObjectLambdaARN interface { Resource isS3ObjectLambdasARN() } // S3ObjectLambdaAccessPointARN is an S3ObjectLambdaARN for the Access Point resource type type S3ObjectLambdaAccessPointARN struct { AccessPointARN } func (s S...
16
session-manager-plugin
aws
Go
package s3err import ( "fmt" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" ) // RequestFailure provides additional S3 specific metadata for the request // failure. type RequestFailure struct { awserr.RequestFailure hostID string } // NewRequestFailure returns a request failure...
58
session-manager-plugin
aws
Go
package sdkio const ( // Byte is 8 bits Byte int64 = 1 // KibiByte (KiB) is 1024 Bytes KibiByte = Byte * 1024 // MebiByte (MiB) is 1024 KiB MebiByte = KibiByte * 1024 // GibiByte (GiB) is 1024 MiB GibiByte = MebiByte * 1024 )
13
session-manager-plugin
aws
Go
// +build !go1.7 package sdkio // Copy of Go 1.7 io package's Seeker constants. const ( SeekStart = 0 // seek relative to the origin of the file SeekCurrent = 1 // seek relative to the current offset SeekEnd = 2 // seek relative to the end )
11
session-manager-plugin
aws
Go
// +build go1.7 package sdkio import "io" // Alias for Go 1.7 io package Seeker constants const ( SeekStart = io.SeekStart // seek relative to the origin of the file SeekCurrent = io.SeekCurrent // seek relative to the current offset SeekEnd = io.SeekEnd // seek relative to the end )
13
session-manager-plugin
aws
Go
// +build go1.10 package sdkmath import "math" // Round returns the nearest integer, rounding half away from zero. // // Special cases are: // Round(±0) = ±0 // Round(±Inf) = ±Inf // Round(NaN) = NaN func Round(x float64) float64 { return math.Round(x) }
16
session-manager-plugin
aws
Go
// +build !go1.10 package sdkmath import "math" // Copied from the Go standard library's (Go 1.12) math/floor.go for use in // Go version prior to Go 1.10. const ( uvone = 0x3FF0000000000000 mask = 0x7FF shift = 64 - 11 - 1 bias = 1023 signMask = 1 << 63 fracMask = 1<<shift - 1 ) // Round return...
57
session-manager-plugin
aws
Go
package sdkrand import ( "math/rand" "sync" "time" ) // lockedSource is a thread-safe implementation of rand.Source type lockedSource struct { lk sync.Mutex src rand.Source } func (r *lockedSource) Int63() (n int64) { r.lk.Lock() n = r.src.Int63() r.lk.Unlock() return } func (r *lockedSource) Seed(seed in...
30
session-manager-plugin
aws
Go
// +build go1.6 package sdkrand import "math/rand" // Read provides the stub for math.Rand.Read method support for go version's // 1.6 and greater. func Read(r *rand.Rand, p []byte) (int, error) { return r.Read(p) }
12
session-manager-plugin
aws
Go
// +build !go1.6 package sdkrand import "math/rand" // Read backfills Go 1.6's math.Rand.Reader for Go 1.5 func Read(r *rand.Rand, p []byte) (n int, err error) { // Copy of Go standard libraries math package's read function not added to // standard library until Go 1.6. var pos int8 var val int64 for n = 0; n <...
25
session-manager-plugin
aws
Go
package sdktesting import ( "os" "runtime" "strings" ) // StashEnv stashes the current environment variables except variables listed in envToKeepx // Returns an function to pop out old environment func StashEnv(envToKeep ...string) func() { if runtime.GOOS == "windows" { envToKeep = append(envToKeep, "ComSpec")...
54
session-manager-plugin
aws
Go
package sdkuri import ( "path" "strings" ) // PathJoin will join the elements of the path delimited by the "/" // character. Similar to path.Join with the exception the trailing "/" // character is preserved if present. func PathJoin(elems ...string) string { if len(elems) == 0 { return "" } hasTrailing := st...
24
session-manager-plugin
aws
Go
package sdkuri import "testing" func TestPathJoin(t *testing.T) { cases := []struct { Elems []string Expect string }{ {Elems: []string{"/"}, Expect: "/"}, {Elems: []string{}, Expect: ""}, {Elems: []string{"blah", "el", "blah/"}, Expect: "blah/el/blah/"}, {Elems: []string{"/asd", "asdfa", "asdfasd/"}, E...
22
session-manager-plugin
aws
Go
package shareddefaults const ( // ECSCredsProviderEnvVar is an environmental variable key used to // determine which path needs to be hit. ECSCredsProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" ) // ECSContainerCredentialsURI is the endpoint to retrieve container // credentials. This can be overridden t...
13
session-manager-plugin
aws
Go
package shareddefaults import ( "os" "path/filepath" "runtime" ) // SharedCredentialsFilename returns the SDK's default file path // for the shared credentials file. // // Builds the shared config file path based on the OS's platform. // // - Linux/Unix: $HOME/.aws/credentials // - Windows: %USERPROFILE%\.aws\...
41
session-manager-plugin
aws
Go
// +build !windows package shareddefaults_test import ( "os" "path/filepath" "testing" "github.com/aws/aws-sdk-go/internal/sdktesting" "github.com/aws/aws-sdk-go/internal/shareddefaults" ) func TestSharedCredsFilename(t *testing.T) { restoreEnvFn := sdktesting.StashEnv() defer restoreEnvFn() os.Setenv("HOM...
43
session-manager-plugin
aws
Go
// +build windows package shareddefaults_test import ( "os" "path/filepath" "testing" "github.com/aws/aws-sdk-go/internal/sdktesting" "github.com/aws/aws-sdk-go/internal/shareddefaults" ) func TestSharedCredsFilename(t *testing.T) { restoreEnvFn := sdktesting.StashEnv() defer restoreEnvFn() os.Setenv("HOME...
43
session-manager-plugin
aws
Go
package smithytesting import ( "bytes" "fmt" "reflect" "github.com/aws/aws-sdk-go/internal/smithytesting/xml" ) // XMLEqual asserts two XML documents by sorting the XML and comparing the // strings It returns an error in case of mismatch or in case of malformed XML // found while sorting. In case of mismatched ...
33
session-manager-plugin
aws
Go
// +build go1.9 package smithytesting import ( "strings" "testing" ) func TestEqualXMLUtil(t *testing.T) { cases := map[string]struct { expectedXML string actualXML string expectErr string }{ "empty": { expectedXML: ``, actualXML: ``, }, "emptyWithDiff": { expectedXML: ``, actualXML...
158
session-manager-plugin
aws
Go
// Package xml is XML testing package that supports XML comparison utility. // The package consists of ToStruct and StructToXML utils that help sort XML // elements as per their nesting level. ToStruct function converts an XML // document into a sorted tree node structure, while StructToXML converts the // sorted XML n...
8
session-manager-plugin
aws
Go
package xml import ( "bytes" "encoding/xml" "io" "strings" ) type xmlAttrSlice []xml.Attr func (x xmlAttrSlice) Len() int { return len(x) } func (x xmlAttrSlice) Less(i, j int) bool { spaceI, spaceJ := x[i].Name.Space, x[j].Name.Space localI, localJ := x[i].Name.Local, x[j].Name.Local valueI, valueJ := x[i]...
49
session-manager-plugin
aws
Go
package xml import ( "bytes" "reflect" "testing" ) func TestSortXML(t *testing.T) { xmlInput := bytes.NewReader([]byte(`<Root><cde>xyz</cde><abc>123</abc><xyz><item>1</item></xyz></Root>`)) sortedXML, err := SortXML(xmlInput, false) expectedsortedXML := `<Root><abc>123</abc><cde>xyz</cde><xyz><item>1</item></xy...
21
session-manager-plugin
aws
Go
package xml import ( "encoding/xml" "fmt" "io" "sort" "strings" ) // A Node contains the values to be encoded or decoded. type Node struct { Name xml.Name `json:",omitempty"` Children map[string][]*Node `json:",omitempty"` Text string `json:",omitempty"` Attr []xml.Attr ...
340
session-manager-plugin
aws
Go
package strings import ( "strings" ) // HasPrefixFold tests whether the string s begins with prefix, interpreted as UTF-8 strings, // under Unicode case-folding. func HasPrefixFold(s, prefix string) bool { return len(s) >= len(prefix) && strings.EqualFold(s[0:len(prefix)], prefix) }
12
session-manager-plugin
aws
Go
// +build go1.7 package strings import ( "strings" "testing" ) func TestHasPrefixFold(t *testing.T) { type args struct { s string prefix string } tests := map[string]struct { args args want bool }{ "empty strings and prefix": { args: args{ s: "", prefix: "", }, want: true, ...
84
session-manager-plugin
aws
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. // Package singleflight provides a duplicate function call suppression // mechanism. package singleflight import "sync" // call is an in-flight or completed s...
121
session-manager-plugin
aws
Go
// Copyright 2013 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. package singleflight import ( "errors" "fmt" "sync" "sync/atomic" "testing" "time" ) func TestDo(t *testing.T) { t.Skip("singleflight tests not stable"...
164
session-manager-plugin
aws
Go
// +build awsinclude package apis import ( "os/exec" "strings" "testing" ) func TestCollidingFolders(t *testing.T) { m := map[string]struct{}{} folders, err := getFolderNames() if err != nil { t.Error(err) } for _, folder := range folders { lcName := strings.ToLower(folder) if _, ok := m[lcName]; ok {...
36
session-manager-plugin
aws
Go
// +build awsinclude package apis
4
session-manager-plugin
aws
Go
// Package endpoints contains the models for endpoints that should be used // to generate endpoint definition files for the SDK. package endpoints //go:generate go run -tags codegen ../../private/model/cli/gen-endpoints/main.go -model ./endpoints.json -out ../../aws/endpoints/defaults.go //go:generate gofmt -s -w ../....
7
session-manager-plugin
aws
Go
package checksum import ( "crypto/md5" "encoding/base64" "fmt" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" ) const contentMD5Header = "Content-Md5" // AddBodyContentMD5Handler computes and sets the HTTP Content-MD5 header for requests that // ...
54
session-manager-plugin
aws
Go
// +build codegen // Package api represents API abstractions for rendering service generated files. package api import ( "bytes" "fmt" "path" "regexp" "sort" "strings" "text/template" "unicode" ) // SDKImportRoot is the root import path of the SDK. const SDKImportRoot = "github.com/aws/aws-sdk-go" // An API...
1,029
session-manager-plugin
aws
Go
// +build go1.8,codegen package api import ( "testing" ) func TestAPI_StructName(t *testing.T) { origAliases := serviceAliaseNames defer func() { serviceAliaseNames = origAliases }() cases := map[string]struct { Aliases map[string]string Metadata Metadata StructName string }{ "FullName": { Meta...
74
session-manager-plugin
aws
Go
// +build codegen package api import ( "fmt" "io/ioutil" "os" "path/filepath" "strings" ) type service struct { srcName string dstName string serviceVersion string } var mergeServices = map[string]service{ "dynamodbstreams": { dstName: "dynamodb", srcName: "streams.dynamodb", }, "wafregional": { d...
399
session-manager-plugin
aws
Go
// +build codegen package api import ( "bufio" "encoding/json" "fmt" "html" "io" "os" "regexp" "strings" xhtml "golang.org/x/net/html" "golang.org/x/net/html/atom" ) type apiDocumentation struct { Operations map[string]string Service string Shapes map[string]shapeDocumentation } type shapeDocum...
547
session-manager-plugin
aws
Go
// +build go1.8,codegen package api import ( "testing" ) func TestDocstring(t *testing.T) { cases := map[string]struct { In string Expect string }{ "non HTML": { In: "Testing 1 2 3", Expect: "// Testing 1 2 3", }, "link": { In: `<a href="https://example.com">a link</a>`, Expect: ...
82
session-manager-plugin
aws
Go
package api import "text/template" const endpointARNShapeTmplDef = ` {{- define "endpointARNShapeTmpl" }} {{ range $_, $name := $.MemberNames -}} {{ $elem := index $.MemberRefs $name -}} {{ if $elem.EndpointARN -}} func (s *{{ $.ShapeName }}) getEndpointARN() (arn.Resource, error) { if s.{{ $name }} == nil { ...
101
session-manager-plugin
aws
Go
// +build codegen package api import ( "fmt" "text/template" ) func setupEndpointHostPrefix(op *Operation) { op.API.AddSDKImport("private/protocol") buildHandler := fmt.Sprintf("protocol.NewHostPrefixHandler(%q, ", op.Endpoint.HostPrefix) if op.InputRef.Shape.HasHostLabelMembers() { buildHandler += "input...
60
session-manager-plugin
aws
Go
// +build codegen package api import ( "bytes" "fmt" "text/template" ) // EventStreamAPI provides details about the event stream async API and // associated EventStream shapes. type EventStreamAPI struct { API *API Operation *Operation Name string InputStream *EventStream OutputStream *E...
321
session-manager-plugin
aws
Go
// +build codegen package api import ( "fmt" "io" "strings" "text/template" ) func renderEventStreamAPI(w io.Writer, op *Operation) error { // Imports needed by the EventStream APIs. op.API.AddImport("fmt") op.API.AddImport("bytes") op.API.AddImport("io") op.API.AddImport("time") op.API.AddSDKImport("aws")...
666
session-manager-plugin
aws
Go
// +build codegen package api import "text/template" var eventStreamShapeReaderTmpl = template.Must(template.New("eventStreamShapeReaderTmpl"). Funcs(template.FuncMap{}). Parse(` {{- $es := $.EventStream }} // {{ $es.StreamReaderAPIName }} provides the interface for reading to the stream. The // default implement...
159
session-manager-plugin
aws
Go
// +build codegen package api import ( "text/template" ) var eventStreamReaderTestTmpl = template.Must( template.New("eventStreamReaderTestTmpl").Funcs(template.FuncMap{ "ValueForType": valueForType, "HasNonBlobPayloadMembers": eventHasNonBlobPayloadMembers, "EventHeaderValueForType": setEventHe...
440
session-manager-plugin
aws
Go
// +build codegen package api import ( "bytes" "fmt" "strings" ) // APIEventStreamTestGoCode generates Go code for EventStream operation tests. func (a *API) APIEventStreamTestGoCode() string { var buf bytes.Buffer a.resetImports() a.AddImport("bytes") a.AddImport("io/ioutil") a.AddImport("net/http") a.Add...
149
session-manager-plugin
aws
Go
// +build codegen package api import "text/template" var eventStreamShapeWriterTmpl = template.Must(template.New("eventStreamShapeWriterTmpl"). Funcs(template.FuncMap{}). Parse(` {{- $es := $.EventStream }} // {{ $es.StreamWriterAPIName }} provides the interface for writing events to the stream. // The default im...
60
session-manager-plugin
aws
Go
// +build codegen package api import ( "text/template" ) var eventStreamWriterTestTmpl = template.Must( template.New("eventStreamWriterTestTmpl").Funcs(template.FuncMap{ "ValueForType": valueForType, "HasNonBlobPayloadMembers": eventHasNonBlobPayloadMembers, "EventHeaderValueForType": setEventHe...
280
session-manager-plugin
aws
Go
// +build codegen package api import ( "bytes" "encoding/json" "fmt" "os" "sort" "strings" "text/template" "github.com/aws/aws-sdk-go/private/util" ) type Examples map[string][]Example // ExamplesDefinition is the structural representation of the examples-1.json file type ExamplesDefinition struct { *API ...
307
session-manager-plugin
aws
Go
// +build codegen package api import ( "fmt" "github.com/aws/aws-sdk-go/private/protocol" ) type examplesBuilder interface { BuildShape(*ShapeRef, map[string]interface{}, bool) string BuildList(string, string, *ShapeRef, []interface{}) string BuildComplex(string, string, *ShapeRef, *Shape, map[string]interface...
59
session-manager-plugin
aws
Go
// +build codegen package api type wafregionalExamplesBuilder struct { defaultExamplesBuilder } func NewWAFregionalExamplesBuilder() wafregionalExamplesBuilder { return wafregionalExamplesBuilder{defaultExamplesBuilder: NewExamplesBuilder()} } func (builder wafregionalExamplesBuilder) Imports(a *API) string { ret...
24
session-manager-plugin
aws
Go
// +build go1.10,codegen package api import ( "encoding/json" "testing" ) func buildAPI() *API { a := &API{} stringShape := &Shape{ API: a, ShapeName: "string", Type: "string", } stringShapeRef := &ShapeRef{ API: a, ShapeName: "string", Shape: stringShape, } intShape := &Sh...
331
session-manager-plugin
aws
Go
// +build codegen package api import "strings" // ExportableName a name which is exportable as a value or name in Go code func (a *API) ExportableName(name string) string { if name == "" { return name } return strings.ToUpper(name[0:1]) + name[1:] }
15
session-manager-plugin
aws
Go
// +build codegen package api // IoSuffix represents map of service to shape names that // are suffixed with `Input`, `Output` string and are not // Input or Output shapes used by any operation within // the service enclosure. type IoSuffix map[string]map[string]struct{} // LegacyIoSuffix returns if the shape names ...
248
session-manager-plugin
aws
Go
package api type stutterNames struct { Operations map[string]string Shapes map[string]string ShapeOrder []string } var legacyStutterNames = map[string]stutterNames{ "WorkSpaces": { Shapes: map[string]string{ "WorkspacesIpGroup": "IpGroup", "WorkspacesIpGroupsList": "IpGroupsList", }, }, "Work...
253
session-manager-plugin
aws
Go
package api type persistAPIType struct { output bool input bool } type persistAPITypes map[string]map[string]persistAPIType func (ts persistAPITypes) Lookup(serviceName, opName string) persistAPIType { service, ok := shamelist[serviceName] if !ok { return persistAPIType{} } return service[opName] } func (...
584
session-manager-plugin
aws
Go
// +build codegen package api import ( "encoding/json" "fmt" "log" "os" "path/filepath" "sort" "strings" ) // APIs provides a set of API models loaded by API package name. type APIs map[string]*API // Loader provides the loading of APIs from files. type Loader struct { // The base Go import path the loaded ...
263
session-manager-plugin
aws
Go
// +build codegen package api import ( "path/filepath" "reflect" "strconv" "testing" ) func TestResolvedReferences(t *testing.T) { json := `{ "operations": { "OperationName": { "input": { "shape": "TestName" } } }, "shapes": { "TestName": { "type": "structure", "members": { "memb...
77
session-manager-plugin
aws
Go
// +build codegen package api import ( "fmt" "io" "sync" ) var debugLogger *logger var initDebugLoggerOnce sync.Once // logger provides a basic logging type logger struct { w io.Writer } // LogDebug initialize's the debug logger for the components in the api // package to log debug lines to. // // Panics if ca...
55
session-manager-plugin
aws
Go
// +build codegen package api import ( "bytes" "fmt" "regexp" "sort" "strings" "text/template" ) // An Operation defines a specific API Operation. type Operation struct { API *API `json:"-"` ExportedName string Name string Documentation string HTTP ...
838
session-manager-plugin
aws
Go
// +build codegen package api import ( "encoding/json" "fmt" "os" ) // Paginator keeps track of pagination configuration for an API operation. type Paginator struct { InputTokens interface{} `json:"input_token"` OutputTokens interface{} `json:"output_token"` LimitKey string `json:"limit_key"` MoreRe...
103
session-manager-plugin
aws
Go
// +build codegen package api import ( "encoding/json" "fmt" "reflect" "strings" "github.com/aws/aws-sdk-go/private/util" ) // A paramFiller provides string formatting for a shape and its types. type paramFiller struct { prefixPackageName bool } // typeName returns the type name of a shape. func (f paramFill...
148