本文整理汇总了Golang中github.com/containerops/wharf/models.Image.Log方法的典型用法代码示例。如果您正苦于以下问题:Golang Image.Log方法的具体用法?Golang Image.Log怎么用?Golang Image.Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/containerops/wharf/models.Image
的用法示例。
在下文中一共展示了Image.Log方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: PutChecksum
func (this *ImageAPIV1Controller) PutChecksum() {
imageId := string(this.Ctx.Input.Param(":image_id"))
image := new(models.Image)
checksum := strings.Split(this.Ctx.Input.Header("X-Docker-Checksum"), ":")[1]
payload := strings.Split(this.Ctx.Input.Header("X-Docker-Checksum-Payload"), ":")[1]
if err := image.PutChecksum(imageId, checksum, true, payload); err != nil {
this.JSONOut(http.StatusBadRequest, "Put Image Checksum & Payload Error", nil)
return
}
if err := image.PutAncestry(imageId); err != nil {
this.JSONOut(http.StatusBadRequest, "Put Image Ancestry Error", nil)
return
}
memo, _ := json.Marshal(this.Ctx.Input.Header)
image.Log(models.ACTION_PUT_IMAGES_CHECKSUM, models.LEVELINFORMATIONAL, models.TYPE_APIV1, image.Id, memo)
this.Ctx.Output.Context.Output.SetStatus(http.StatusOK)
this.Ctx.Output.Context.Output.Body([]byte(""))
return
}
示例2: PutImageJSON
func (this *ImageAPIV1Controller) PutImageJSON() {
imageId := this.Ctx.Input.Param(":image_id")
image := new(models.Image)
j := string(this.Ctx.Input.CopyBody())
if err := image.PutJSON(imageId, j, models.APIVERSION_V1); err != nil {
this.JSONOut(http.StatusBadRequest, "Put Image JSON Error", nil)
return
}
memo, _ := json.Marshal(this.Ctx.Input.Header)
image.Log(models.ACTION_PUT_IMAGES_JSON, models.LEVELINFORMATIONAL, models.TYPE_APIV1, image.Id, memo)
this.Ctx.Output.Context.Output.SetStatus(http.StatusOK)
this.Ctx.Output.Context.Output.Body([]byte(""))
return
}
示例3: PutImageLayer
func (this *ImageAPIV1Controller) PutImageLayer() {
imageId := string(this.Ctx.Input.Param(":image_id"))
image := new(models.Image)
basePath := beego.AppConfig.String("docker::BasePath")
imagePath := fmt.Sprintf("%v/images/%v", basePath, imageId)
layerfile := fmt.Sprintf("%v/images/%v/layer", basePath, imageId)
if !utils.IsDirExists(imagePath) {
os.MkdirAll(imagePath, os.ModePerm)
}
if _, err := os.Stat(layerfile); err == nil {
os.Remove(layerfile)
}
data, _ := ioutil.ReadAll(this.Ctx.Request.Body)
if err := ioutil.WriteFile(layerfile, data, 0777); err != nil {
this.JSONOut(http.StatusBadRequest, "Put Image Layer File Error", nil)
return
}
if err := image.PutLayer(imageId, layerfile, true, int64(len(data))); err != nil {
this.JSONOut(http.StatusBadRequest, "Put Image Layer File Data Error", nil)
return
}
memo, _ := json.Marshal(this.Ctx.Input.Header)
image.Log(models.ACTION_PUT_IMAGES_LAYER, models.LEVELINFORMATIONAL, models.TYPE_APIV1, image.Id, memo)
this.Ctx.Output.Context.Output.SetStatus(http.StatusOK)
this.Ctx.Output.Context.Output.Body([]byte(""))
return
}