Documentation ¶
Overview ¶
Package cs implements features related to Lightsail (C)ontainer (S)ervice.
Example (SkipStatuses) ¶
r := skipStatuses( strings.NewReader(` {"status": "keep me"} {"status": "xyz skip1 abc"} {"status": "also keep me!"} {"status": "\tskip2"}`), "skip2", "skip1", ) if _, err := io.Copy(os.Stdout, r); err != nil { fmt.Println(err) return }
Output: {"status":"keep me"} {"status":"also keep me!"}
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PushImage ¶
func PushImage(ctx context.Context, in *PushImageInput, lio LightsailImageOperator, imgo ImageOperator) error
PushImage pushes and registers the image to Lightsail service registry.
Example ¶
defer func() { testNow, testRngReader = nil, nil }() testNow = func() time.Time { return time.Unix(1611796436, 0) } testRngReader = strings.NewReader("abcdefgh") ctx := context.Background() fls := &fakeLightsailImageOperator{} fimgo := &fakeImageOperator{} if err := PushImage(ctx, &PushImageInput{Service: "doge", Image: "nginx:latest", Label: "www"}, fls, fimgo); err != nil { fmt.Println(err) return } fmt.Println("docker engine call log:") for _, s := range fimgo.log { fmt.Println(" ", s) } fmt.Println("lightsail api call log:") for _, s := range fls.log { fmt.Println(" ", s) }
Output: Digest: sha256:10b8cc432d56da8b61b070f4c7d2543a9ed17c2b23010b43af434fd40e2ca4aa Image "nginx:latest" registered. Refer to this image as ":doge.www.12345" in deployments. docker engine call log: tag "nginx:latest" as "123456789012.dkr.ecr.so-fake-2.amazonaws.com/sr:1611796436000000000-c5h66p35cpjmg" push "123456789012.dkr.ecr.so-fake-2.amazonaws.com/sr:1611796436000000000-c5h66p35cpjmg" untag "123456789012.dkr.ecr.so-fake-2.amazonaws.com/sr:1611796436000000000-c5h66p35cpjmg" lightsail api call log: create login register (doge, www, sha256:10b8cc432d56da8b61b070f4c7d2543a9ed17c2b23010b43af434fd40e2ca4aa)
Types ¶
type DockerEngine ¶
type DockerEngine struct {
// contains filtered or unexported fields
}
DockerEngine defines a subset of client-side operations against local Docker Engine, relevant to lightsailctl.
func NewDockerEngine ¶
func NewDockerEngine(ctx context.Context) (*DockerEngine, error)
func (*DockerEngine) PushImage ¶
func (e *DockerEngine) PushImage(ctx context.Context, remoteImage RemoteImage) (digest string, err error)
func (*DockerEngine) TagImage ¶
func (e *DockerEngine) TagImage(ctx context.Context, source, target string) error
func (*DockerEngine) UntagImage ¶
func (e *DockerEngine) UntagImage(ctx context.Context, image string) error
type ImageOperator ¶
type LightsailImageOperator ¶
type LightsailImageOperator interface { RegistryLoginCreator RegisterContainerImage( context.Context, *lightsail.RegisterContainerImageInput, ...func(*lightsail.Options), ) (*lightsail.RegisterContainerImageOutput, error) }
type PushImageInput ¶
type RegistryLoginCreator ¶
type RegistryLoginCreator interface { CreateContainerServiceRegistryLogin( context.Context, *lightsail.CreateContainerServiceRegistryLoginInput, ...func(*lightsail.Options), ) (*lightsail.CreateContainerServiceRegistryLoginOutput, error) }
type RemoteImage ¶
type RemoteImage struct { registry.AuthConfig Tag string }
RemoteImage combines remote server auth details, address and an image tag into a value that has everything that one needs to push this image to a remote repo.
func (*RemoteImage) Ref ¶
func (r *RemoteImage) Ref() string
Click to show internal directories.
Click to hide internal directories.