@@ -27,10 +27,9 @@ import (
2727
2828 "github.com/docker/compose-cli/aci/convert"
2929 "github.com/docker/compose-cli/aci/login"
30- "github.com/docker/compose-cli/api/compose"
3130 "github.com/docker/compose-cli/api/context/store"
32- "github.com/docker/compose-cli/api/errdefs "
33- "github.com/docker/compose-cli/api /progress"
31+ "github.com/docker/compose-cli/pkg/api "
32+ "github.com/docker/compose-cli/pkg /progress"
3433 "github.com/docker/compose-cli/utils/formatter"
3534)
3635
@@ -46,47 +45,47 @@ func newComposeService(ctx store.AciContext) aciComposeService {
4645 }
4746}
4847
49- func (cs * aciComposeService ) Build (ctx context.Context , project * types.Project , options compose .BuildOptions ) error {
50- return errdefs .ErrNotImplemented
48+ func (cs * aciComposeService ) Build (ctx context.Context , project * types.Project , options api .BuildOptions ) error {
49+ return api .ErrNotImplemented
5150}
5251
53- func (cs * aciComposeService ) Push (ctx context.Context , project * types.Project , options compose .PushOptions ) error {
54- return errdefs .ErrNotImplemented
52+ func (cs * aciComposeService ) Push (ctx context.Context , project * types.Project , options api .PushOptions ) error {
53+ return api .ErrNotImplemented
5554}
5655
57- func (cs * aciComposeService ) Pull (ctx context.Context , project * types.Project , options compose .PullOptions ) error {
58- return errdefs .ErrNotImplemented
56+ func (cs * aciComposeService ) Pull (ctx context.Context , project * types.Project , options api .PullOptions ) error {
57+ return api .ErrNotImplemented
5958}
6059
61- func (cs * aciComposeService ) Create (ctx context.Context , project * types.Project , opts compose .CreateOptions ) error {
62- return errdefs .ErrNotImplemented
60+ func (cs * aciComposeService ) Create (ctx context.Context , project * types.Project , opts api .CreateOptions ) error {
61+ return api .ErrNotImplemented
6362}
6463
65- func (cs * aciComposeService ) Start (ctx context.Context , project * types.Project , options compose .StartOptions ) error {
66- return errdefs .ErrNotImplemented
64+ func (cs * aciComposeService ) Start (ctx context.Context , project * types.Project , options api .StartOptions ) error {
65+ return api .ErrNotImplemented
6766}
6867
69- func (cs * aciComposeService ) Restart (ctx context.Context , project * types.Project , options compose .RestartOptions ) error {
70- return errdefs .ErrNotImplemented
68+ func (cs * aciComposeService ) Restart (ctx context.Context , project * types.Project , options api .RestartOptions ) error {
69+ return api .ErrNotImplemented
7170}
7271
73- func (cs * aciComposeService ) Stop (ctx context.Context , project * types.Project , options compose .StopOptions ) error {
74- return errdefs .ErrNotImplemented
72+ func (cs * aciComposeService ) Stop (ctx context.Context , project * types.Project , options api .StopOptions ) error {
73+ return api .ErrNotImplemented
7574}
7675
77- func (cs * aciComposeService ) Pause (ctx context.Context , project string , options compose .PauseOptions ) error {
78- return errdefs .ErrNotImplemented
76+ func (cs * aciComposeService ) Pause (ctx context.Context , project string , options api .PauseOptions ) error {
77+ return api .ErrNotImplemented
7978}
8079
81- func (cs * aciComposeService ) UnPause (ctx context.Context , project string , options compose .PauseOptions ) error {
82- return errdefs .ErrNotImplemented
80+ func (cs * aciComposeService ) UnPause (ctx context.Context , project string , options api .PauseOptions ) error {
81+ return api .ErrNotImplemented
8382}
8483
85- func (cs * aciComposeService ) Copy (ctx context.Context , project * types.Project , options compose .CopyOptions ) error {
86- return errdefs .ErrNotImplemented
84+ func (cs * aciComposeService ) Copy (ctx context.Context , project * types.Project , options api .CopyOptions ) error {
85+ return api .ErrNotImplemented
8786}
8887
89- func (cs * aciComposeService ) Up (ctx context.Context , project * types.Project , options compose .UpOptions ) error {
88+ func (cs * aciComposeService ) Up (ctx context.Context , project * types.Project , options api .UpOptions ) error {
9089 return progress .Run (ctx , func (ctx context.Context ) error {
9190 return cs .up (ctx , project )
9291 })
@@ -130,12 +129,12 @@ func (cs aciComposeService) warnKeepVolumeOnDown(ctx context.Context, projectNam
130129 return nil
131130}
132131
133- func (cs * aciComposeService ) Down (ctx context.Context , projectName string , options compose .DownOptions ) error {
132+ func (cs * aciComposeService ) Down (ctx context.Context , projectName string , options api .DownOptions ) error {
134133 if options .Volumes {
135- return errors .Wrap (errdefs .ErrNotImplemented , "--volumes option is not supported on ACI" )
134+ return errors .Wrap (api .ErrNotImplemented , "--volumes option is not supported on ACI" )
136135 }
137136 if options .Images != "" {
138- return errors .Wrap (errdefs .ErrNotImplemented , "--rmi option is not supported on ACI" )
137+ return errors .Wrap (api .ErrNotImplemented , "--rmi option is not supported on ACI" )
139138 }
140139 return progress .Run (ctx , func (ctx context.Context ) error {
141140 logrus .Debugf ("Down on project with name %q" , projectName )
@@ -149,14 +148,14 @@ func (cs *aciComposeService) Down(ctx context.Context, projectName string, optio
149148 return err
150149 }
151150 if cg .IsHTTPStatus (http .StatusNoContent ) {
152- return errdefs .ErrNotFound
151+ return api .ErrNotFound
153152 }
154153
155154 return err
156155 })
157156}
158157
159- func (cs * aciComposeService ) Ps (ctx context.Context , projectName string , options compose .PsOptions ) ([]compose .ContainerSummary , error ) {
158+ func (cs * aciComposeService ) Ps (ctx context.Context , projectName string , options api .PsOptions ) ([]api .ContainerSummary , error ) {
160159 groupsClient , err := login .NewContainerGroupsClient (cs .ctx .SubscriptionID )
161160 if err != nil {
162161 return nil , err
@@ -171,23 +170,23 @@ func (cs *aciComposeService) Ps(ctx context.Context, projectName string, options
171170 return nil , fmt .Errorf ("no containers found in ACI container group %s" , projectName )
172171 }
173172
174- res := []compose .ContainerSummary {}
173+ res := []api .ContainerSummary {}
175174 for _ , container := range * group .Containers {
176175 if isContainerVisible (container , group , false ) {
177176 continue
178177 }
179- var publishers []compose .PortPublisher
178+ var publishers []api .PortPublisher
180179 urls := formatter .PortsToStrings (convert .ToPorts (group .IPAddress , * container .Ports ), convert .FQDN (group , cs .ctx .Location ))
181180 for i , p := range * container .Ports {
182- publishers = append (publishers , compose .PortPublisher {
181+ publishers = append (publishers , api .PortPublisher {
183182 URL : urls [i ],
184183 TargetPort : int (* p .Port ),
185184 PublishedPort : int (* p .Port ),
186185 Protocol : string (p .Protocol ),
187186 })
188187 }
189188 id := getContainerID (group , container )
190- res = append (res , compose .ContainerSummary {
189+ res = append (res , api .ContainerSummary {
191190 ID : id ,
192191 Name : id ,
193192 Project : projectName ,
@@ -199,26 +198,26 @@ func (cs *aciComposeService) Ps(ctx context.Context, projectName string, options
199198 return res , nil
200199}
201200
202- func (cs * aciComposeService ) List (ctx context.Context , opts compose .ListOptions ) ([]compose .Stack , error ) {
201+ func (cs * aciComposeService ) List (ctx context.Context , opts api .ListOptions ) ([]api .Stack , error ) {
203202 containerGroups , err := getACIContainerGroups (ctx , cs .ctx .SubscriptionID , cs .ctx .ResourceGroup )
204203 if err != nil {
205204 return nil , err
206205 }
207206
208- var stacks []compose .Stack
207+ var stacks []api .Stack
209208 for _ , group := range containerGroups {
210209 if _ , found := group .Tags [composeContainerTag ]; ! found {
211210 continue
212211 }
213- state := compose .RUNNING
212+ state := api .RUNNING
214213 for _ , container := range * group .ContainerGroupProperties .Containers {
215214 containerState := convert .GetStatus (container , group )
216- if containerState != compose .RUNNING {
215+ if containerState != api .RUNNING {
217216 state = containerState
218217 break
219218 }
220219 }
221- stacks = append (stacks , compose .Stack {
220+ stacks = append (stacks , api .Stack {
222221 ID : * group .ID ,
223222 Name : * group .Name ,
224223 Status : state ,
@@ -227,41 +226,41 @@ func (cs *aciComposeService) List(ctx context.Context, opts compose.ListOptions)
227226 return stacks , nil
228227}
229228
230- func (cs * aciComposeService ) Logs (ctx context.Context , projectName string , consumer compose .LogConsumer , options compose .LogOptions ) error {
231- return errdefs .ErrNotImplemented
229+ func (cs * aciComposeService ) Logs (ctx context.Context , projectName string , consumer api .LogConsumer , options api .LogOptions ) error {
230+ return api .ErrNotImplemented
232231}
233232
234- func (cs * aciComposeService ) Convert (ctx context.Context , project * types.Project , options compose .ConvertOptions ) ([]byte , error ) {
235- return nil , errdefs .ErrNotImplemented
233+ func (cs * aciComposeService ) Convert (ctx context.Context , project * types.Project , options api .ConvertOptions ) ([]byte , error ) {
234+ return nil , api .ErrNotImplemented
236235}
237236
238- func (cs * aciComposeService ) Kill (ctx context.Context , project * types.Project , options compose .KillOptions ) error {
239- return errdefs .ErrNotImplemented
237+ func (cs * aciComposeService ) Kill (ctx context.Context , project * types.Project , options api .KillOptions ) error {
238+ return api .ErrNotImplemented
240239}
241240
242- func (cs * aciComposeService ) RunOneOffContainer (ctx context.Context , project * types.Project , opts compose .RunOptions ) (int , error ) {
243- return 0 , errdefs .ErrNotImplemented
241+ func (cs * aciComposeService ) RunOneOffContainer (ctx context.Context , project * types.Project , opts api .RunOptions ) (int , error ) {
242+ return 0 , api .ErrNotImplemented
244243}
245244
246- func (cs * aciComposeService ) Remove (ctx context.Context , project * types.Project , options compose .RemoveOptions ) error {
247- return errdefs .ErrNotImplemented
245+ func (cs * aciComposeService ) Remove (ctx context.Context , project * types.Project , options api .RemoveOptions ) error {
246+ return api .ErrNotImplemented
248247}
249248
250- func (cs * aciComposeService ) Exec (ctx context.Context , project * types.Project , opts compose .RunOptions ) (int , error ) {
251- return 0 , errdefs .ErrNotImplemented
249+ func (cs * aciComposeService ) Exec (ctx context.Context , project * types.Project , opts api .RunOptions ) (int , error ) {
250+ return 0 , api .ErrNotImplemented
252251}
253- func (cs * aciComposeService ) Top (ctx context.Context , projectName string , services []string ) ([]compose .ContainerProcSummary , error ) {
254- return nil , errdefs .ErrNotImplemented
252+ func (cs * aciComposeService ) Top (ctx context.Context , projectName string , services []string ) ([]api .ContainerProcSummary , error ) {
253+ return nil , api .ErrNotImplemented
255254}
256255
257- func (cs * aciComposeService ) Events (ctx context.Context , project string , options compose .EventsOptions ) error {
258- return errdefs .ErrNotImplemented
256+ func (cs * aciComposeService ) Events (ctx context.Context , project string , options api .EventsOptions ) error {
257+ return api .ErrNotImplemented
259258}
260259
261- func (cs * aciComposeService ) Port (ctx context.Context , project string , service string , port int , options compose .PortOptions ) (string , int , error ) {
262- return "" , 0 , errdefs .ErrNotImplemented
260+ func (cs * aciComposeService ) Port (ctx context.Context , project string , service string , port int , options api .PortOptions ) (string , int , error ) {
261+ return "" , 0 , api .ErrNotImplemented
263262}
264263
265- func (cs * aciComposeService ) Images (ctx context.Context , projectName string , options compose .ImagesOptions ) ([]compose .ImageSummary , error ) {
266- return nil , errdefs .ErrNotImplemented
264+ func (cs * aciComposeService ) Images (ctx context.Context , projectName string , options api .ImagesOptions ) ([]api .ImageSummary , error ) {
265+ return nil , api .ErrNotImplemented
267266}
0 commit comments