mirror of
https://github.com/docker/compose.git
synced 2025-07-26 23:24:05 +02:00
Make all functions in aci.go package private
They shouldn't be used outside of the package any way
This commit is contained in:
parent
9fd5f7bef3
commit
6fa941686c
17
azure/aci.go
17
azure/aci.go
@ -29,7 +29,7 @@ func init() {
|
|||||||
_ = os.Setenv("AZURE_KEYVAULT_RESOURCE", "https://management.azure.com")
|
_ = os.Setenv("AZURE_KEYVAULT_RESOURCE", "https://management.azure.com")
|
||||||
}
|
}
|
||||||
|
|
||||||
func CreateACIContainers(ctx context.Context, aciContext store.AciContext, groupDefinition containerinstance.ContainerGroup) (c containerinstance.ContainerGroup, err error) {
|
func createACIContainers(ctx context.Context, aciContext store.AciContext, groupDefinition containerinstance.ContainerGroup) (c containerinstance.ContainerGroup, err error) {
|
||||||
containerGroupsClient, err := getContainerGroupsClient(aciContext.SubscriptionID)
|
containerGroupsClient, err := getContainerGroupsClient(aciContext.SubscriptionID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return c, fmt.Errorf("cannot get container group client: %v", err)
|
return c, fmt.Errorf("cannot get container group client: %v", err)
|
||||||
@ -78,12 +78,12 @@ func CreateACIContainers(ctx context.Context, aciContext store.AciContext, group
|
|||||||
|
|
||||||
containers := *containerGroup.Containers
|
containers := *containerGroup.Containers
|
||||||
container := containers[0]
|
container := containers[0]
|
||||||
response, err := ExecACIContainer(ctx, "/bin/sh", *containerGroup.Name, *container.Name, aciContext)
|
response, err := execACIContainer(ctx, "/bin/sh", *containerGroup.Name, *container.Name, aciContext)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return c, err
|
return c, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ExecWebSocketLoopWithCmd(
|
err = execWebSocketLoopWithCmd(
|
||||||
ctx,
|
ctx,
|
||||||
*response.WebSocketURI,
|
*response.WebSocketURI,
|
||||||
*response.Password,
|
*response.Password,
|
||||||
@ -97,8 +97,7 @@ func CreateACIContainers(ctx context.Context, aciContext store.AciContext, group
|
|||||||
return containerGroup, err
|
return containerGroup, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// ListACIContainers List available containers
|
func listACIContainers(aciContext store.AciContext) (c []containerinstance.ContainerGroup, err error) {
|
||||||
func ListACIContainers(aciContext store.AciContext) (c []containerinstance.ContainerGroup, err error) {
|
|
||||||
ctx := context.TODO()
|
ctx := context.TODO()
|
||||||
containerGroupsClient, err := getContainerGroupsClient(aciContext.SubscriptionID)
|
containerGroupsClient, err := getContainerGroupsClient(aciContext.SubscriptionID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -120,7 +119,7 @@ func ListACIContainers(aciContext store.AciContext) (c []containerinstance.Conta
|
|||||||
return containers, err
|
return containers, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExecACIContainer(ctx context.Context, command, containerGroup string, containerName string, aciContext store.AciContext) (c containerinstance.ContainerExecResponse, err error) {
|
func execACIContainer(ctx context.Context, command, containerGroup string, containerName string, aciContext store.AciContext) (c containerinstance.ContainerExecResponse, err error) {
|
||||||
containerClient := getContainerClient(aciContext.SubscriptionID)
|
containerClient := getContainerClient(aciContext.SubscriptionID)
|
||||||
rows, cols := getTermSize()
|
rows, cols := getTermSize()
|
||||||
containerExecRequest := containerinstance.ContainerExecRequest{
|
containerExecRequest := containerinstance.ContainerExecRequest{
|
||||||
@ -144,11 +143,11 @@ func getTermSize() (*int32, *int32) {
|
|||||||
return to.Int32Ptr(int32(rows)), to.Int32Ptr(int32(cols))
|
return to.Int32Ptr(int32(rows)), to.Int32Ptr(int32(cols))
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExecWebSocketLoop(ctx context.Context, wsURL, passwd string) error {
|
func execWebSocketLoop(ctx context.Context, wsURL, passwd string) error {
|
||||||
return ExecWebSocketLoopWithCmd(ctx, wsURL, passwd, []string{}, true)
|
return execWebSocketLoopWithCmd(ctx, wsURL, passwd, []string{}, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ExecWebSocketLoopWithCmd(ctx context.Context, wsURL, passwd string, commands []string, outputEnabled bool) error {
|
func execWebSocketLoopWithCmd(ctx context.Context, wsURL, passwd string, commands []string, outputEnabled bool) error {
|
||||||
ctx, cancel := context.WithCancel(ctx)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
conn, _, _, err := ws.DefaultDialer.Dial(ctx, wsURL)
|
conn, _, _, err := ws.DefaultDialer.Dial(ctx, wsURL)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -115,6 +115,6 @@ func (cs *containerService) Run(ctx context.Context, r containers.ContainerConfi
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = CreateACIContainers(ctx, cs.ctx, groupDefinition)
|
_, err = createACIContainers(ctx, cs.ctx, groupDefinition)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user