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 | // +build go1.7
package session
import (
"fmt"
"io/ioutil"
"net/http"
"net/http/httptest"
"os"
"path/filepath"
"reflect"
"runtime"
"strconv"
"strings"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/... | 854 |
session-manager-plugin | aws | Go | // +build go1.7
package session
import (
"os"
"path/filepath"
"strings"
"testing"
"github.com/aws/aws-sdk-go/internal/sdktesting"
)
func TestSession_loadCSMConfig(t *testing.T) {
defConfigFiles := []string{
filepath.Join("testdata", "csm_shared_config"),
}
cases := map[string]struct {
Envs map[st... | 125 |
session-manager-plugin | aws | Go | package session
import (
"bytes"
"fmt"
"net"
"net/http"
"os"
"strings"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/awstesting"
)
var TLSBundleCertFile string
var TLSBundleKeyFile string
var ... | 272 |
session-manager-plugin | aws | Go | // +build go1.13
package session
import (
"net"
"net/http"
"time"
)
// Transport that should be used when a custom CA bundle is specified with the
// SDK.
func getCustomTransport() *http.Transport {
return &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 * time.S... | 28 |
session-manager-plugin | aws | Go | // +build !go1.13,go1.7
package session
import (
"net"
"net/http"
"time"
)
// Transport that should be used when a custom CA bundle is specified with the
// SDK.
func getCustomTransport() *http.Transport {
return &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: 30 *... | 27 |
session-manager-plugin | aws | Go | // +build !go1.6,go1.5
package session
import (
"net"
"net/http"
"time"
)
// Transport that should be used when a custom CA bundle is specified with the
// SDK.
func getCustomTransport() *http.Transport {
return &http.Transport{
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 30 * time.Se... | 23 |
session-manager-plugin | aws | Go | // +build !go1.7,go1.6
package session
import (
"net"
"net/http"
"time"
)
// Transport that should be used when a custom CA bundle is specified with the
// SDK.
func getCustomTransport() *http.Transport {
return &http.Transport{
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 30 * time.Se... | 24 |
session-manager-plugin | aws | Go | /*
Package session provides configuration for the SDK's service clients. Sessions
can be shared across service clients that share the same base configuration.
Sessions are safe to use concurrently as long as the Session is not being
modified. Sessions should be cached when possible, because creating a new
Session will... | 290 |
session-manager-plugin | aws | Go | package session
import (
"fmt"
"os"
"strconv"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/endpoints"
)
// EnvProviderName provides a name of the provider when config is loaded from environment.
c... | 404 |
session-manager-plugin | aws | Go | // +build go1.7
package session
import (
"os"
"reflect"
"strconv"
"testing"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/awstesting"
"github.com/aws/aws-sdk-go/internal/sdktesting"
"github.com/aws/aws-sdk-go/internal/shareddefaults"
)
func... | 468 |
session-manager-plugin | aws | Go | package session
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/corehandlers"
"github.com/aws/aws-sdk-go/aws/credentials"
"github... | 942 |
session-manager-plugin | aws | Go | // +build go1.7
package session
import (
"bytes"
"fmt"
"net/http"
"os"
"path/filepath"
"strings"
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/request"... | 829 |
session-manager-plugin | aws | Go | package session
import (
"fmt"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/internal/ini"
)
const (
// Static Credentials group
accessKeyIDKey = `aws_access_key_id` // group requi... | 676 |
session-manager-plugin | aws | Go | // +build go1.7
package session
import (
"fmt"
"path/filepath"
"reflect"
"strconv"
"strings"
"testing"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/internal/ini"
)
var (
testConfigFilename = filepath.Join("testdata", "shared_config")... | 520 |
session-manager-plugin | aws | Go | package session
import (
"os"
"github.com/aws/aws-sdk-go/internal/sdktesting"
)
func initSessionTestEnv() (oldEnv func()) {
oldEnv = sdktesting.StashEnv()
os.Setenv("AWS_CONFIG_FILE", "file_not_exists")
os.Setenv("AWS_SHARED_CREDENTIALS_FILE", "file_not_exists")
return oldEnv
}
| 16 |
session-manager-plugin | aws | Go | // +build go1.5
package v4_test
import (
"fmt"
"net/http"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/awstesting/unit"
)
func TestStandaloneSign(t *testing.T) {
creds := unit.Session.Config.Credentials
signer := v4.NewSigner(creds)
for _, c := range standaloneSign... | 87 |
session-manager-plugin | aws | Go | package v4_test
import (
"net/http"
"net/url"
"reflect"
"strings"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/awstesting/unit"
"github.com/aws/aws-sdk-go/service/s3"
)
var standaloneSignCases ... | 272 |
session-manager-plugin | aws | Go | // +build go1.7
package v4
import "testing"
func TestAllowedQueryHoisting(t *testing.T) {
cases := map[string]struct {
Header string
ExpectHoist bool
}{
"object-lock": {
Header: "X-Amz-Object-Lock-Mode",
ExpectHoist: false,
},
"s3 metadata": {
Header: "X-Amz-Meta-SomeName",
Exp... | 38 |
session-manager-plugin | aws | Go | package v4
import (
"github.com/aws/aws-sdk-go/internal/strings"
)
// validator houses a set of rule needed for validation of a
// string value
type rules []rule
// rule interface allows for more flexible rules and just simply
// checks whether or not a value adheres to that rule
type rule interface {
IsValid(valu... | 82 |
session-manager-plugin | aws | Go | package v4
import (
"testing"
)
func TestRuleCheckWhitelist(t *testing.T) {
w := allowList{
mapRule{
"Cache-Control": struct{}{},
},
}
if !w.IsValid("Cache-Control") {
t.Error("expected true value")
}
if w.IsValid("Cache-") {
t.Error("expected false value")
}
}
func TestRuleCheckBlacklist(t *testi... | 78 |
session-manager-plugin | aws | Go | package v4
// WithUnsignedPayload will enable and set the UnsignedPayload field to
// true of the signer.
func WithUnsignedPayload(v4 *Signer) {
v4.UnsignedPayload = true
}
| 8 |
session-manager-plugin | aws | Go | // +build !go1.7
package v4
import (
"net/http"
"github.com/aws/aws-sdk-go/aws"
)
func requestContext(r *http.Request) aws.Context {
return aws.BackgroundContext()
}
| 14 |
session-manager-plugin | aws | Go | // +build go1.7
package v4
import (
"net/http"
"github.com/aws/aws-sdk-go/aws"
)
func requestContext(r *http.Request) aws.Context {
return r.Context()
}
| 14 |
session-manager-plugin | aws | Go | package v4
import (
"encoding/hex"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws/credentials"
)
type credentialValueProvider interface {
Get() (credentials.Value, error)
}
// StreamSigner implements signing of event stream encoded payloads
type StreamSigner struct {
region string
service string
credenti... | 64 |
session-manager-plugin | aws | Go | // +build go1.7
package v4
import (
"encoding/hex"
"fmt"
"strings"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws/credentials"
)
type periodicBadCredentials struct {
call int
credentials *credentials.Credentials
}
func (p *periodicBadCredentials) Get() (credentials.Value, error) {
defer func() {
... | 134 |
session-manager-plugin | aws | Go | // +build go1.5
package v4
import (
"net/url"
"strings"
)
func getURIPath(u *url.URL) string {
var uri string
if len(u.Opaque) > 0 {
uri = "/" + strings.Join(strings.Split(u.Opaque, "/")[3:], "/")
} else {
uri = u.EscapedPath()
}
if len(uri) == 0 {
uri = "/"
}
return uri
}
| 25 |
session-manager-plugin | aws | Go | // Package v4 implements signing for AWS V4 signer
//
// Provides request signing for request that need to be signed with
// AWS V4 Signatures.
//
// Standalone Signer
//
// Generally using the signer outside of the SDK should not require any additional
// logic when using Go v1.5 or higher. The signer does this by tak... | 851 |
session-manager-plugin | aws | Go | package v4
import (
"bytes"
"io"
"io/ioutil"
"net/http"
"net/http/httptest"
"reflect"
"strconv"
"strings"
"testing"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/awstesting"
)
func epochTime() time.T... | 770 |
session-manager-plugin | aws | Go | package awstesting
import (
"encoding/json"
"fmt"
"net/url"
"reflect"
"regexp"
"sort"
"strings"
"testing"
"github.com/aws/aws-sdk-go/internal/smithytesting"
)
// Match is a testing helper to test for testing error by comparing expected
// with a regular expression.
func Match(t *testing.T, regex, expected s... | 210 |
session-manager-plugin | aws | Go | package awstesting_test
import (
"encoding/xml"
"testing"
"github.com/aws/aws-sdk-go/awstesting"
)
func TestAssertJSON(t *testing.T) {
cases := []struct {
e, a string
asserts bool
}{
{
e: `{"RecursiveStruct":{"RecursiveMap":{"foo":{"NoRecurse":"foo"},"bar":{"NoRecurse":"bar"}}}}`,
a: ... | 96 |
session-manager-plugin | aws | Go | package awstesting
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/defaults"
)
// NewClient creates and initializes a generic service client for testing.
func NewClient(cfgs ...*aws.Config) *client.Clien... | 25 |
session-manager-plugin | aws | Go | package awstesting
import (
"crypto/tls"
"crypto/x509"
"fmt"
"net/http"
"net/http/httptest"
)
// NewTLSClientCertServer creates a new HTTP test server initialize to require
// HTTP clients authenticate with TLS client certificates.
func NewTLSClientCertServer(handler http.Handler) (*httptest.Server, error) {
se... | 183 |
session-manager-plugin | aws | Go | package awstesting
import (
"io/ioutil"
"net"
"net/http"
"os"
"strings"
"time"
)
func availableLocalAddr(ip string) (string, error) {
l, err := net.Listen("tcp", ip+":0")
if err != nil {
return "", err
}
defer l.Close()
return l.Addr().String(), nil
}
// CreateTLSServer will create the TLS server on an... | 200 |
session-manager-plugin | aws | Go | package awstesting
// DiscardAt is an io.WriteAt that discards
// the requested bytes to be written
type DiscardAt struct{}
// WriteAt discards the given []byte slice and returns len(p) bytes
// as having been written at the given offset. It will never return an error.
func (d DiscardAt) WriteAt(p []byte, off int64) ... | 12 |
session-manager-plugin | aws | Go | package awstesting
// EndlessReader is an io.Reader that will always return
// that bytes have been read.
type EndlessReader struct{}
// Read will report that it has read len(p) bytes in p.
// The content in the []byte will be unmodified.
// This will never return an error.
func (e EndlessReader) Read(p []byte) (int,... | 13 |
session-manager-plugin | aws | Go | package awstesting
import (
"io"
"os"
"strings"
"time"
"github.com/aws/aws-sdk-go/private/util"
)
// ZeroReader is a io.Reader which will always write zeros to the byte slice provided.
type ZeroReader struct{}
// Read fills the provided byte slice with zeros returning the number of bytes written.
func (r *Zero... | 129 |
session-manager-plugin | aws | Go | package awstesting_test
import (
"io"
"testing"
"github.com/aws/aws-sdk-go/awstesting"
)
func TestReadCloserClose(t *testing.T) {
rc := awstesting.ReadCloser{Size: 1}
err := rc.Close()
if err != nil {
t.Errorf("expect nil, got %v", err)
}
if !rc.Closed {
t.Errorf("expect closed, was not")
}
if e, a :=... | 76 |
session-manager-plugin | aws | Go | // +build integration
package main
import (
"fmt"
"os"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
// Searches the buckets of an account that match the prefix, and deletes
// those buckets, and all objects within. Before deleting w... | 95 |
session-manager-plugin | aws | Go | // +build integration
// Package integration performs initialization and validation for integration
// tests.
package integration
import (
"crypto/rand"
"fmt"
"io"
"io/ioutil"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
)
// Session is a shared session for all integration tes... | 88 |
session-manager-plugin | aws | Go | // +build go1.13,integration,perftest
package main
import (
"net"
"net/http"
"time"
)
func NewClient(cfg ClientConfig) *http.Client {
tr := &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: cfg.Timeouts.Connect,
KeepAlive: 30 * time.Second,
DualStack: true,
}... | 36 |
session-manager-plugin | aws | Go | // +build go1.13,integration,perftest
package main
import (
"flag"
"fmt"
"net/http"
"strings"
"time"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
type Config struct {
Bucket string
Size int64
Key string
LogVerbose bool
UploadPartSize int64
SDK SDKConfig
Clie... | 166 |
session-manager-plugin | aws | Go | // +build go1.13,integration,perftest
package main
import (
"flag"
"fmt"
"io"
"log"
"os"
"path/filepath"
"runtime"
"runtime/pprof"
"runtime/trace"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/awstesting... | 335 |
session-manager-plugin | aws | Go | // +build go1.13,integration,perftest
package main
import (
"flag"
"fmt"
"io"
"os"
"strconv"
"strings"
"testing"
"github.com/aws/aws-sdk-go/awstesting"
"github.com/aws/aws-sdk-go/awstesting/integration"
"github.com/aws/aws-sdk-go/internal/sdkio"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-... | 197 |
session-manager-plugin | aws | Go | // +build go1.13,integration,perftest
package main
import (
"context"
"crypto/tls"
"fmt"
"net/http/httptrace"
"strconv"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws/request"
)
type RequestTrace struct {
Operation string
ID string
context.Context
start, finish time.Time
errs Errors
a... | 205 |
session-manager-plugin | aws | Go | // +build integration,perftest
package main
import (
"net"
"net/http"
"time"
)
func NewClient(cfg ClientConfig) *http.Client {
tr := &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: cfg.Timeouts.Connect,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialC... | 32 |
session-manager-plugin | aws | Go | // +build integration,perftest
package main
import (
"flag"
"fmt"
"net/http"
"strings"
"time"
)
type Config struct {
RequestDuration time.Duration
RequestCount int64
RequestDelay time.Duration
Endpoint string
Bucket, Key string
SDK SDKConfig
Client ClientConfig
}
func (c *Config) SetupFlag... | 157 |
session-manager-plugin | aws | Go | // +build integration,perftest
package main
import (
"encoding/csv"
"fmt"
"io"
"os"
"strconv"
"strings"
"time"
)
type Logger struct {
out *csv.Writer
}
func NewLogger(writer io.Writer) *Logger {
l := &Logger{
out: csv.NewWriter(writer),
}
err := l.out.Write([]string{
"ID", "Attempt",
"Latency",
... | 135 |
session-manager-plugin | aws | Go | // +build integration,perftest
package main
import (
"context"
"flag"
"fmt"
"io"
"io/ioutil"
"os"
"os/signal"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/serv... | 146 |
session-manager-plugin | aws | Go | // +build integration,perftest
package main
import (
"context"
"crypto/tls"
"net/http/httptrace"
"time"
"github.com/aws/aws-sdk-go/aws/request"
)
type RequestTrace struct {
ID int64
context.Context
start, finish time.Time
errs Errors
attempts []RequestAttempt
curAttempt RequestAttempt
}
func NewR... | 135 |
session-manager-plugin | aws | Go | // +build integration,perftest
package main
import (
"net"
"net/http"
"time"
)
func NewClient(cfg ClientConfig) *http.Client {
tr := &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: cfg.Timeouts.Connect,
KeepAlive: 30 * time.Second,
DualStack: true,
}).DialC... | 33 |
session-manager-plugin | aws | Go | // +build integration,perftest
package main
import (
"flag"
"fmt"
"net/http"
"os"
"strings"
"time"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
type Config struct {
Bucket string
Filename string
Size int64
TempDir string
LogVerbose bool
SDK SDKConfig
Client ClientConfig
}
fun... | 169 |
session-manager-plugin | aws | Go | // +build integration,perftest
package main
import (
"flag"
"log"
"os"
"path/filepath"
"strconv"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/awstesting/integration"
"github.com/aws/aws-sdk-go/service/s3"
... | 205 |
session-manager-plugin | aws | Go | // +build integration,perftest
package main
import (
"flag"
"fmt"
"io"
"os"
"strconv"
"strings"
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/awstesting"
"github.com/aws/aws-sdk-go/awstesting/integration"
"github.com/aws/aws-sdk-go/internal/sdkio"
"github.com/aws/aws-sdk-go/service... | 196 |
session-manager-plugin | aws | Go | // +build integration,perftest
package main
import (
"context"
"crypto/tls"
"fmt"
"net/http/httptrace"
"strconv"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws/request"
)
type RequestTrace struct {
Operation string
ID string
context.Context
start, finish time.Time
errs Errors
attempts... | 205 |
session-manager-plugin | aws | Go | // +build integration
package s3integ
import (
"fmt"
"github.com/aws/aws-sdk-go/awstesting/integration"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3iface"
"github.com/aws/aws-sdk-go/service/s3control"
"github.com/aws/aws-sdk-go/service/s3control/s3controliface"
)
// BucketPr... | 124 |
session-manager-plugin | aws | Go | package mock
import (
"crypto/rsa"
"math/big"
"net/http"
"net/http/httptest"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/session"
)
// Session is a mock session which is used to hit the mock server
var S... | 75 |
session-manager-plugin | aws | Go | // Package unit performs initialization and validation for unit tests
package unit
import (
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/session"
)
// Session is a shared session for unit tests to use.
var Session = session.Must(session.NewSess... | 18 |
session-manager-plugin | aws | Go | // +build example,go18
package main
import (
"context"
"fmt"
"os"
"plugin"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials/plugincreds"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk... | 84 |
session-manager-plugin | aws | Go | // +build example,go18
package main
import (
"encoding/json"
"os"
"github.com/pkg/errors"
)
// Example plugin that will retrieve credentials from a JSON file that the
// "PLUGIN_CREDS_FILE" environment variable points to
//
// Build with:
// go build -tags example -o plugin.so -buildmode=plugin plugin.go
func ... | 62 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/sqs"
)
func main() {
defaultResolver ... | 78 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"flag"
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws/endpoints"
)
// Demostrates how the SDK's endpoints can be enumerated over to discover
// regions, services, and endpoints defined by the SDK's Regions and Endpoints
// metadata.
//
// Usage:
// -p=id partition id, e.g: aw... | 127 |
session-manager-plugin | aws | Go | // +build example,go1.15
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"fmt"
"io/ioutil"
"log"
"net"
"net/http"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"golang.org/x/net/http2"
)
// Example of creating an HTTP Clien... | 124 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/credentials"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go... | 79 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"os"
"path/filepath"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
func exitErrorf(msg string, args ...interface{}) {
fmt.Fprintf(os.Stderr, msg+"\n", args.... | 67 |
session-manager-plugin | aws | Go | package main
import (
"net"
"net/http"
"time"
)
// NewClient creates a new HTTP Client using the ClientConfig values.
func NewClient(cfg ClientConfig) *http.Client {
tr := &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
Timeout: cfg.Timeouts.Connect,
KeepAlive: 30 * time.... | 31 |
session-manager-plugin | aws | Go | package main
import (
"flag"
"net/http"
"time"
)
// ClientConfig provides the timeouts from CLI flags and default values for the
// example apps's configuration.
type ClientConfig struct {
KeepAlive bool
Timeouts Timeouts
}
// SetupFlags initializes the CLI flags.
func (c *ClientConfig) SetupFlags(prefix strin... | 55 |
session-manager-plugin | aws | Go | // build example
package main
import (
"fmt"
"io"
"os"
"time"
)
// RecordTrace outputs the request trace as text.
func RecordTrace(w io.Writer, trace *RequestTrace) {
attempt := AttemptReport{
Reused: trace.Reused,
Latency: trace.Finish.Sub(trace.Start),
ReqWritten: trace.RequestWritten.Sub(trace.S... | 101 |
session-manager-plugin | aws | Go | // build example
package main
import (
"bufio"
"context"
"errors"
"flag"
"fmt"
"log"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sns"
)
var clientCfg ClientConfig
var topicARN string
func init() {
clientCfg.SetupFlags("", flag.CommandLi... | 90 |
session-manager-plugin | aws | Go | package main
import (
"bytes"
"context"
"crypto/tls"
"fmt"
"io"
"io/ioutil"
"net/http/httptrace"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws/request"
)
// RequestLatency provides latencies for the SDK API request and its attempts.
type RequestLatency struct {
Latency time.Duration
Validate time.Dura... | 426 |
session-manager-plugin | aws | Go | // +build example,go1.7
package main
import (
"context"
"flag"
"fmt"
"os"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
// Uploads a file to S3 given a b... | 72 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"flag"
"fmt"
"io/ioutil"
"net/http"
"time"
"github.com/aws/aws-sdk-go/service/cloudfront/sign"
)
// Makes a request for object using CloudFront cookie signing, and outputs
// the contents of the object to stdout.
//
// Usage example:
// signCookies -file <privkey file> ... | 80 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"flag"
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/expression"
)
func exitWithError(err error) {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
... | 89 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"flag"
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute"
)
func exitWithError(err error) {
fmt.Fprintln(os.Stderr, err)
os.Exi... | 99 |
session-manager-plugin | aws | Go | // +build example
// Package unitTest demonstrates how to unit test, without needing to pass a
// connector to every function, code that uses DynamoDB.
package unitTest
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribut... | 42 |
session-manager-plugin | aws | Go | // +build example
// Unit tests for package unitTest.
package unitTest
import (
"errors"
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/dynamodb"
"github.com/aws/aws-sdk-go/service/dynamodb/dynamodbiface"
)
// A fakeDynamoDB instance. During testing, instatiate ItemGetter, then si... | 60 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"log"
"os"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
)
// This example will list instances with a filter
//
// Usage:
// filter_ec2_by_tag <name_filter>
func main() {
sess := session... | 44 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"flag"
"fmt"
"os"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ec2"
)
// Prints a list of instances for each region. If no regions are provided
// all regions will be searched. The state is require... | 138 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ecr"
)
const DEFAULT_AWS_REGION = "us-east-1"
// This example creates a new ECR Repository
//
// Usage:
// AWS_REGION=us-east-1 go run -tags example cre... | 65 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/ecr"
)
const DEFAULT_AWS_REGION = "us-east-1"
// This example deletes an ECR Repository
//
// Usage:
// AWS_REGION=us-east-1 go run -tags example delete... | 66 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"io"
"log"
"math/rand"
"os"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/mediastore"
"github.com/aws/aws-sdk-go/service/mediastoredata"
)
func main() {
containerName := os.Args[1]
objectPat... | 93 |
session-manager-plugin | aws | Go | // +build example,skip
package main
import (
"database/sql"
"database/sql/driver"
"fmt"
"log"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials/stscreds"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/rds/rdsutils"
)
type stubDriver struct{}
func (... | 53 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"log"
"net/url"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
type client struct {
s3Client *s3.S3
bucket *string
}
// concatenate will contenate key1's object to key2's object under the key te... | 105 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"io"
"io/ioutil"
"log"
"os"
"strings"
"sync/atomic"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
// progressWriter tracks the download progres... | 134 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
// Lists all objects in a bucket using pagination
//
// Usage:
// listObjects <bucket>
func main() {
if len(os.Args) < 2 {
fmt.Println("you must specify a bucket")
return
}
... | 44 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"os"
"sort"
"sync"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
func exit(msg ...interface{}) {
fmt.Fprintln(os.Stderr, msg...)
os.Exit(1)
}
// Lists all encrypted objects owned by an ... | 237 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"io"
"log"
"os"
"runtime/debug"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
// Usage:
// go run -tags example <bucket> <key> <file to upload>
//
// Example:
// AWS_REGION... | 121 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"bytes"
"encoding/json"
"flag"
"fmt"
"io"
"io/ioutil"
"net/http"
"os"
"strconv"
"strings"
)
// client.go is an example of a client that will request URLs from a service that
// the client will use to upload and download content with.
//
// The server must be started ... | 267 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"encoding/json"
"flag"
"fmt"
"net"
"net/http"
"os"
"strconv"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/servi... | 187 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"flag"
"fmt"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
)
// Put an ACL on an S3 object
//
// Usage:
// putBucketAcl <params>
// -region <region> // required
// -bucket <bucket> // required
// -key <key>... | 92 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"log"
"os"
"sync"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
type CustomReader struct {
fp *os.File
size int64
read int64
signMap map[int64]struct{}
mux sync.Mutex... | 101 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"flag"
"fmt"
"mime"
"os"
"path/filepath"
"strings"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3/s3manager"
)
// SyncFolderIterator is used to upload a given folder
// to Amazon S3.
type SyncFolderIterat... | 121 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"io/ioutil"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3control"
)
const (
bucketName = "myBucketName"
keyName = "my... | 82 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"io/ioutil"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/arn"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"github.com/aws/aws-sdk-go/service/s3control"
)
const (
bucketName = "myBucketName"
keyName = "my... | 106 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"encoding/json"
"fmt"
"os"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/sqs"
"github.com/aws/aws-sdk-go/service/sqs/sqsiface"
)
func main() {
if len(os.Args) < 2 {
fmt.Fprintln(os.Stderr, "Queue URL requi... | 80 |
session-manager-plugin | aws | Go | // +build example
package main
import (
"fmt"
"testing"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/sqs"
"github.com/aws/aws-sdk-go/service/sqs/sqsiface"
)
type mockedReceiveMsgs struct {
sqsiface.SQSAPI
Resp sqs.ReceiveMessageOutput
}
func (m mockedReceiveMsgs) ReceiveMessage(in *sqs... | 66 |
session-manager-plugin | aws | Go | // +build !go1.7
package context
import "time"
// An emptyCtx is a copy of the Go 1.7 context.emptyCtx type. This is copied to
// provide a 1.6 and 1.5 safe version of context that is compatible with Go
// 1.7's Context.
//
// An emptyCtx is never canceled, has no values, and has no deadline. It is not
// struct{}, ... | 41 |
session-manager-plugin | aws | Go | package ini
// ASTKind represents different states in the parse table
// and the type of AST that is being constructed
type ASTKind int
// ASTKind* is used in the parse table to transition between
// the different states
const (
ASTKindNone = ASTKind(iota)
ASTKindStart
ASTKindExpr
ASTKindEqualExpr
ASTKindStateme... | 121 |
session-manager-plugin | aws | Go | package ini
import (
"testing"
)
const (
section = `[default]
region = us-west-2
credential_source = Ec2InstanceMetadata
s3 =
foo=bar
bar=baz
output = json
[assumerole]
output = json
region = us-west-2
`
)
func BenchmarkINIParser(b *testing.B) {
for i := 0; i < b.N; i++ {
ParseBytes([]byte(section))
}
}
fu... | 34 |
session-manager-plugin | aws | Go | package ini
var commaRunes = []rune(",")
func isComma(b rune) bool {
return b == ','
}
func newCommaToken() Token {
return newToken(TokenComma, commaRunes, NoneType)
}
| 12 |
session-manager-plugin | aws | Go | package ini
// isComment will return whether or not the next byte(s) is a
// comment.
func isComment(b []rune) bool {
if len(b) == 0 {
return false
}
switch b[0] {
case ';':
return true
case '#':
return true
}
return false
}
// newCommentToken will create a comment token and
// return how many bytes we... | 36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.