// ContainerResizeHandler calls resize func (i *InteractionHandlersImpl) ContainerResizeHandler(params interaction.ContainerResizeParams) middleware.Responder { // See whether there is an active session to the container session, err := i.attachServer.Get(context.Background(), params.ID, 0) if err != nil { // just note the warning and return, resize requires an active connection log.Warnf("No resize connection found (id: %s): %s", params.ID, err) return interaction.NewContainerResizeOK() } // Request a resize cWidth := uint32(params.Width) cHeight := uint32(params.Height) if err = session.Resize(cWidth, cHeight, 0, 0); err != nil { log.Errorf("%s", err.Error()) return interaction.NewContainerResizeInternalServerError().WithPayload( &models.Error{Message: err.Error()}, ) } return interaction.NewContainerResizeOK() }
func (i *InteractionHandlersImpl) ContainerResizeHandler(params interaction.ContainerResizeParams) middleware.Responder { // Get the session to the container connContainer, err := i.attachServer.Get(context.Background(), params.ID, interactionTimeout) if err != nil { retErr := &models.Error{Message: fmt.Sprintf("No such container: %s", params.ID)} return interaction.NewContainerResizeNotFound().WithPayload(retErr) } // Request a resize cWidth := uint32(params.Width) cHeight := uint32(params.Height) err = connContainer.Resize(cWidth, cHeight, 0, 0) if err != nil { log.Errorf("InteractionHandler (%s) error: %s", params.ID, err.Error()) return interaction.NewContainerResizeInternalServerError() } return interaction.NewContainerResizeOK() }